# HG changeset patch # User Edho Arief # Date 1352916232 -25200 # Node ID 7ceec4404caf5be26d551c4415d0eefbf0e218d7 # Parent 70a71c10b9f3ecdf70b2627dc8451cfe43c148d2 Add restore cursor position for vim. diff -r 70a71c10b9f3 -r 7ceec4404caf rc/vimrc --- a/rc/vimrc Wed Nov 14 03:41:40 2012 +0000 +++ b/rc/vimrc Thu Nov 15 01:03:52 2012 +0700 @@ -47,3 +47,17 @@ autocmd BufRead,BufNewFile *.scss :set ft=scss autocmd BufRead,BufNewFile *.coffee :set ft=coffee endif + +"Restore cursor position +set viminfo='10,\"100,:20,%,n~/.viminfo +function! ResCur() + if line("'\"") <= line("$") + normal! g`" + return 1 + endif +endfunction + +augroup resCur + autocmd! + autocmd BufWinEnter * call ResCur() +augroup END