Cursor position stored in default vimrc

Additional function added to set the cursor to the known last position.
This commit is contained in:
Alexandre Dulaunoy 2012-12-25 12:41:47 +01:00
parent 0131b0ff76
commit 03dc6bb5f2

15
.vimrc
View file

@ -35,3 +35,18 @@ if v:version >= 700
autocmd BufNewFile,BufRead COMMIT_EDITMSG setlocal spell spelllang=en autocmd BufNewFile,BufRead COMMIT_EDITMSG setlocal spell spelllang=en
endif endif
" store position (ctrl-o to recall)
set viminfo='10,\"100,:20,%,n~/.viminfo
" go to last position
function! ResCur()
if line("'\"") <= line("$")
normal! g`"
return 1
endif
endfunction
augroup resCur
autocmd!
autocmd BufWinEnter * call ResCur()
augroup END