a simplistic plugin for using clipboard in vim9
providing vim9scrpt wrap up for pyperclip
- vim9script
- vim compiled with python3
press <C-x>
in visual mode to cut
press <C-c>
in visual mode to copy
press <C-v>
in insert mode to paste
returns whatever is in the clipboard
sets clipboard data to the given string
copies the last-selected text in VISUAL mode
cuts the last-selected text in VISUAL mode
g:clip_no_maps = "default"
I have decided to switch from neovim back to vim9 a few months ago, one of things I missed the most is that neovim uses external toolsets to handle clipboard (what they call providers
), so that it's not broken when using wayland.
Though, with that said, some of existing vimscript may have performance issues -- they expect the registers to be fast, but now an external tool is spawned everytime they read or write the register.
This plugin sloves both of the problems : the clipboard now have nothing to do with registers. They're basically a set of apis you use when you explicitly want to access the clipboard, which by default is binded to the hotkeys desktop users most used to -- Ctrl-X, Ctrl-V, and Ctrl-V. The python library pyperclip handles external tools perfectly.