I have created the following key-binding for copying all text in the buffer to the system clipboard:
nnoremap <Leader>bA gg"*yG
However, it moves the cursor, so I need to append <C-o><C-o>
in order to jump back to the previous location.
How can I move back to the previous location without appending multiple <C-o>
for a key-binding?
:%y+
– Christian Brabandt Oct 15 '20 at 10:46+
. I initially tried:%y"+
etc. I created the mappingnoremap <Leader>by :<c-u>%y+<cr>
, do you like it, or could I improve it? – Shuzheng Oct 15 '20 at 10:58"
on the ex command line, since it is being considered the comment char. Please also have a look at the help::h :y
. It doesn't mention to use the"
in the ex commandline. – Christian Brabandt Oct 15 '20 at 11:53