Tuesday, November 3, 2009

vim:: Restore cursor to file position in previous editing session

Add these lines to .vimrc file.


if has("autocmd")
  autocmd BufReadPost *
  \ if line("'\"") > 0 && line ("'\"") <= line("$") |
  \   exe "normal! g'\"" |
  \ endif
endif


You can read more about autocmd here

1 comment:

  1. I have found the below also useful ..


    set nocompatible
    set tabstop=4
    set shiftwidth=4
    set autoindent
    set smartindent

    ReplyDelete