开发者

Vim start with cursor where last went off

How do i make Vim always start at the line I was at when i exit开发者_JAVA技巧ed that given file last time?


Put this in your .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

then you can use :let g:leave_my_cursor_position_alone=1 at runtime to deactivate the feature.


put this into your .vimrc

set viewoptions=cursor,folds

au BufWinLeave * mkview

au BufWinEnter * silent loadview
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜