把它放在.vimrc中:
" When editing a file, always jump to the last cursor position
au BufReadPost *
\ if ! exists("g:leave_my_cursor_position_alone") |
\ if line("'\"") > 0 && line ("'\"") <= line("$") |
\ exe "normal g'\"" |
\ endif |
\ endif
Run Code Online (Sandbox Code Playgroud)
然后您可以:let g:leave_my_cursor_position_alone=1在运行时使用此功能来停用该功能.