Mercurial > ec-dotfiles
changeset 412:7ceec4404caf
Add restore cursor position for vim.
author | Edho Arief <edho@myconan.net> |
---|---|
date | Thu, 15 Nov 2012 01:03:52 +0700 |
parents | 70a71c10b9f3 |
children | fda660f86df3 |
files | rc/vimrc |
diffstat | 1 files changed, 14 insertions(+), 0 deletions(-) [+] |
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