+Restore the cursor position after the file got opened.
[nethome.git] / .vimrc
diff --git a/.vimrc b/.vimrc
index ed7d998..4fc1e2f 100644 (file)
--- a/.vimrc
+++ b/.vimrc
@@ -33,6 +33,13 @@ function BufEnter()
                runtime! ./../../../../../../../../../../../.vimrc ./../../../../../../../../../../.vimrc ./../../../../../../../../../.vimrc ./../../../../../../../../.vimrc ./../../../../../../../.vimrc ./../../../../../../.vimrc ./../../../../../.vimrc ./../../../../.vimrc ./../../../.vimrc ./../../.vimrc ./../.vimrc ./.vimrc
        endif
 endfunction
+" From Red Hat vimrc - restore the cursor position after the file got opened:
+autocmd BufReadPost * call BufReadPost()
+function BufReadPost()
+       if line("'\"") > 0 && line ("'\"") <= line("$")
+               exe "normal! g'\""
+       endif
+endfunction
 
 set encoding=utf-8
 set termencoding=utf-8