1
0
mirror of https://github.com/SpaceVim/SpaceVim.git synced 2025-02-03 02:40:05 +08:00

feat(clipboard): add clipboard#set function

This commit is contained in:
wsdjeg 2022-10-11 11:02:00 +08:00
parent 0ecd2ec124
commit 1ed769feb2
2 changed files with 24 additions and 0 deletions

View File

@ -97,3 +97,11 @@ endfunction
let [s:yank_cmd, s:paste_cmd] = s:set_command() let [s:yank_cmd, s:paste_cmd] = s:set_command()
call s:LOGGER.info('yank_cmd is:' . string(s:yank_cmd)) call s:LOGGER.info('yank_cmd is:' . string(s:yank_cmd))
call s:LOGGER.info('paste_cmd is:' . string(s:paste_cmd)) call s:LOGGER.info('paste_cmd is:' . string(s:paste_cmd))
function! clipboard#set(yank, past) abort
let s:yank_cmd = a:yank
let s:paste_cmd = a:past
call s:LOGGER.info('yank_cmd is:' . string(s:yank_cmd))
call s:LOGGER.info('paste_cmd is:' . string(s:paste_cmd))
endfunction

View File

@ -1255,6 +1255,22 @@ Read `:h registers` for more info about other registers.
| `<Leader> P` | Paste text from system clipboard before here | | `<Leader> P` | Paste text from system clipboard before here |
| `<Leader> Y` | Copy selected text to pastebin | | `<Leader> Y` | Copy selected text to pastebin |
To change the command of clipboard, you nned to use bootstrap after function:
```viml
" for example, to use tmux clipboard:
function! myspacevim#after() abort
call clipboard#set('tmux load-buffer -', 'tmux save-buffer -')
endfunction
```
within the runtime log (`SPC h L`), the clipboard command will be displayed:
```
[ clipboard ] [11:00:35] [670.246] [ Info ] yank_cmd is:'tmux load-buffer -'
[ clipboard ] [11:00:35] [670.246] [ Info ] paste_cmd is:'tmux save-buffer -'
```
The `<Leader> Y` key binding will copy selected text to a pastebin server. It requires `curl` in your `$PATH`. The `<Leader> Y` key binding will copy selected text to a pastebin server. It requires `curl` in your `$PATH`.
The default command is: The default command is: