I often use :.m$
to move or :.t$
to copy current line to the end of the file. Sometimes it would be easier if the cursor won't jump to end of file or target location of the move / copy command. Is there an option for it?
give these two mappings a try:
"move current line to the end of buffer without moving cursor
nnoremap <leader>mv ddGp``
"copy current line to the end of buffer without moving cursor
nnoremap <leader>cp YGp``
note that for the move
case, the cursor position would be changed to the text of next line, since the original line of text has gone. But it sits on same line (number).
If you required the anonymous register ("
) to be untouched, I think we need write a function for it.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With