Ever faced the problem of cursor getting reset to beginning of file each time you open it in vi! Well, adding the following to .vimrc in your home directory or /etc/vimrc (whichever is appropriate) will get the cursor back to where you left it in last session.
” In text files, always limit the width of text to 78 characters
autocmd BufRead *.txt set tw=78
” When editing a file, always jump to the last cursor position
autocmd BufReadPost *
\ if line(“‘\””) > 0 && line (“‘\””) <= line(“$”) |
\ exe “normal g’\”” |