diff rc/vimrc @ 412:7ceec4404caf

Add restore cursor position for vim.
author Edho Arief <edho@myconan.net>
date Thu, 15 Nov 2012 01:03:52 +0700
parents fd0a889066a6
children c0ac21407903
line wrap: on
line diff
--- 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