I have the following sequence of vim commands I use to copy a function va{Vy
, how can I map this to a shortcut key like F1? I'd also like to persist this.
-
1vimhelp.org/usr_05.txt.html#05.4– Christian BrabandtMay 17 at 6:24
1 Answer
The command would be:
nmap <F1> va{Vy
You can store this command in your ~/.vimrc file. This will make it persistent. If it does not exist simply create it.
More infos about this you can find here.
My question would be what should this command do? If you want to yank the current line the shortest commmand would be yy
. If wou want to yank a paragraph (all text between an empty line) this does not work and the better command would be vipy
. vip
selects the current paragraph.
-
Well, the command is equivalent to
yVa{
, which yanks everything in{
forced-linewise.– D. Ben Knoble ♦May 17 at 20:56 -