From 03912044de30c1910b80395eb1a1d384d9df58b9 Mon Sep 17 00:00:00 2001 From: Hugues Hiegel Date: Wed, 30 Mar 2011 12:05:42 +0200 Subject: [Vim] goto last known position --- vimrc | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'vimrc') diff --git a/vimrc b/vimrc index a9b6bc2..278133e 100644 --- a/vimrc +++ b/vimrc @@ -65,6 +65,15 @@ map :setlocal invfoldenable "buffer moving map :bN +" When editing a file, always jump to the last known cursor position. +" Don't do it when the position is invalid or when inside an event handler +" (happens when dropping a file on gvim). +autocmd BufReadPost * + \ if line("'\"") > 0 && line("'\"") <= line("$") | + \ exe "normal g`\"" | + \ exe "normal zz" | + \ endif + " Load local cscope db if exists if filereadable( expand("$PWD/tags") ) set tags=tags -- cgit v1.2.3