Dup Ver Goto 📝

Vnoremap-silent

PT2/editor/vim/keys vim keymap silent does not exist
To
23 lines, 207 words, 1177 chars Page 'Vnoremap-silent' does not exist.

Remember that mappings expand to keys that are then interpreted. So think about exactly what keys you would press. Thus when you press :w, vim prepends '<'> so you find yourself at :'<'> and from there, to write normally, you would type w !pc and press enter. Thus to prepend silent, we would press <home> followed by silent followed by <end> and then append our destination, which is ! to pipe to a command followed by pc, which is my platform agnostic 'copy to clipboard' script.

vnoremap <leader>jc :w<home>silent <end> !pc<cr>

I also have a put command which puts its standard input into a named file in ~/.jstore from which I can recall it with get. (This allows for persistent named clipboards, at least for text.) For this it is necessary to type the target name, so <cr> is not added to the end. (Note there is a space after the put in the line below --- at some point I'll add functionality to PT that allows for code blocks to have options, one of which will turn spaces into some explicit symbol. Or perhaps put an explicit carriage return symbol on the end of a line.

vnoremap <leader>jp :w<home>silent <end> !put