문제

nmap <F9> gg=G
imap <F9> <ESC>gg=Ga

I have this in my .vimrc, I'm in the middle of my source file and this lines works as expected which means that what is defined in equalprg is executed correctly, the problem is that after this execution my cursor returns at the top of the file which is something that I really don't want to happen: there is a way to avoid that ?

도움이 되었습니까?

해결책

You can set and return to a mark (e.g. a):

nmap <F9> magg=Gg`a

다른 팁

nnoremap <f9> gg=G``

`` will jump back to the spot before the last jump.

:h ``
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top