New answers tagged

2

The command ]p does almost what you want, except it is not guaranteed to be linewise. In tpope/vim-unimpaired plugin it's already remapped to work linewise only, so if you use it (which I suggest anyway), you get it for free. Otherwise, you can implement the same trick yourself: nnoremap <silent>]p :call <SID>putline("]p")<CR> function ...


2

All "long" jump commands, such as gg, automatically save the bookmark for the previous poisition (note that G here is a "motion", so it does not overwrite the bookmark again), so all you have to do is to go back by that bookmark with two backticks: nnoremap <leader>= gg=G`` Or you can use CTRLO and CTRLI to navigate through the jumplist (:h jumplist) ...


0

If you are willing to dedicate a keybinding to it (let's say \G for concreteness), then it's possible to set a mark and return to it in your keybinding. nnoremap \G mpgg=G`p mp set mark. A lowercase letter means that mark is associated with the current buffer. The mark P is universal, p is not. gg=G move to the top of the buffer and indent down to the ...


Top 50 recent answers are included