In my .vimrc file I have
autocmd BufWritePre *.c :g/./ normal gqq
with text width 119 in order to hardwrap the lines before saving the buffer.
I tried
autocmd BufWritePre *.c :g/./ normal gqq``zz
to move the cursor back to where it was and bring it in the centre but it seems like taking me to some arbitary location.
Can anyone help me with this?
kx | exe ':g/./ ... etc' | normal 'xzz
x
for the mark. Use whatever you want. (You could even use, believe it or not, ` ... though I'd probably avoid it to prevent confusion.)