indentation - Return to last cursor in VIM after indenting -
i use gg=g
auto-format whole file in vim. after whole file indented, cursor returned begining of file.
how can vim returns cursor last position? called command in line 45, want vim return me line after indenting file.
edit: if interested, did add following command .vimrc
" autoformat document nnoremap f gg=g''
so using shit+f
can reformat whole document , stay @ same cursor.
as stated /u/nemo157, in answer comment in how fix indentation of entire file in vi?, issueing ''
returns last position. per vim docs:
*''* *``* '' `` position before latest jump, or last "m'" or "m`" command given. not set when |:keepjumps| command modifier used. see |restore-position|.
so if gg=g''
you're started.
Comments
Post a Comment