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

Popular posts from this blog

Android layout hidden on keyboard show -

google app engine - 403 Forbidden POST - Flask WTForms -

c - Why would PK11_GenerateRandom() return an error -8023? -