From 03dc6bb5f281792a6f4caf11d22bdb4eb468fc69 Mon Sep 17 00:00:00 2001 From: Alexandre Dulaunoy Date: Tue, 25 Dec 2012 12:41:47 +0100 Subject: [PATCH] Cursor position stored in default vimrc Additional function added to set the cursor to the known last position. --- .vimrc | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/.vimrc b/.vimrc index 11943a2..b15a59d 100644 --- a/.vimrc +++ b/.vimrc @@ -35,3 +35,18 @@ if v:version >= 700 autocmd BufNewFile,BufRead COMMIT_EDITMSG setlocal spell spelllang=en 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 +