serhii.net

In the middle of the desert you can say anything you want

11 Feb 2020

Day 407

Vim “Done” map/macro

The following inside the .vimrc moves the selected line to the end of the file and takes the cursor back: map <C-d> dGp''

For details, cursor movement - How do I jump to the location of my last edit? - Vi and Vim Stack Exchange.

From the first answer:

The `. command will bring you to your last change.

The ` goes to a mark, and . is a “special” mark which is automatically set to the position where the last change was made. See :help `. for some more information.

There is also `` which will bring you back to where the cursor was before you made your last jump. See :help `` for more information.

Another useful mark is `^; this is the position where the cursor was the last time when insert mode was stopped. See :help `^.

See :help mark-motions for some more general info about using marks (including some other “special” marks that are automatically set).

Nel mezzo del deserto posso dire tutto quello che voglio.
comments powered by Disqus