changeset 16:17afab9bd228

Open vim at last known position
author zegervdv <zegervdv@me.com>
date Wed, 12 Mar 2014 21:35:40 +0100
parents 4e87e8610500
children d9f2af48349b
files Rakefile vimrc
diffstat 2 files changed, 11 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/Rakefile	Mon Mar 10 20:38:49 2014 +0100
+++ b/Rakefile	Wed Mar 12 21:35:40 2014 +0100
@@ -6,3 +6,5 @@
   sh 'git submodule foreach git checkout master'
   sh 'git submodule foreach git pull --rebase'
 end
+
+task up: :update
--- a/vimrc	Mon Mar 10 20:38:49 2014 +0100
+++ b/vimrc	Wed Mar 12 21:35:40 2014 +0100
@@ -64,6 +64,15 @@
 
 set clipboard=unnamed
 
+set viminfo='10,\"100,:20,%,n~/.viminfo
+
+" When editing a file, always jump to the last known cursor position.
+" Don't do it for commit messages, when the position is invalid, or when
+" inside an event handler (happens when dropping a file on gvim).
+autocmd BufReadPost *
+  \ if &ft != 'gitcommit' && line("'\"") > 0 && line("'\"") <= line("$") |
+  \   exe "normal g`\"" |
+  \ endif
 
 map <Leader>d  :bp<bar>sp<bar>bn<bar>bd<CR>