我在.vimrc
中使用以下命令来重新打开文件后恢复光标位置:
" Copied from defaults.vim
" Put these in an autocmd group, so that you can revert them with:
" ":augroup vimStartup | au! | augroup END"
augroup vimStartup
au!
" When editing a file, always jump to the last known cursor position.
" Don't do it when the position is invalid, when inside an event handler
" (happens when dropping a file on gvim) and for a commit message (it's
" likely a different one than last time).
autocmd BufReadPost *
\ if line("'\"") >= 1 && line("'\"") <= line("$") && &ft !~# 'commit'
\ | exe "normal! g`\""
\ | endif
augroup END
问题是当我键入:make
时,光标位置没有恢复;光标仅出现在键入:make
之前的行首。
您对如何解决此问题有任何建议吗?谢谢您的帮助。