Search code examples
vimshortcut

VIM - How can I put my current position in jumplist?


I am wondering about a improvement for vim that I can jump back for where I was the last time I stopped to move around for like 3 seconds. Then I can scroll around and have a kick shortcut to jump back where I was with the same old CTRL+o.

Vim put a lot of movements in the :jumps list and I wondering that half of that is useless in any moment for me, so how could I do that ?

In any another words I'm trying to make the jumplist more sensible.

ps: Netbeans and VS has a similar behavior.


Solution

  • To have the current position automatically added to the jump list, you can utilize the CursorHold event:

    :autocmd CursorHold * normal! m'
    

    Navigation is with the default <C-o> / <C-i>.