I use gg=G
to auto-format the whole file in VIM. After the whole file is indented, the cursor is returned to the begining of the file.
How can I do so that VIM returns the cursor to the last position? Say I called the command in the line 45, I want VIM to return me to this line after indenting the file.
Edit: if anyone is interested, I did add the following command to my .vimrc
" Autoformat document
nnoremap F gg=G''
So by using Shit+f
I can now reformat the whole document and stay at the same cursor.