[arch-general] VIM history

gt codered12 at gmail.com
Fri Feb 12 01:38:36 EST 2010


On Fri, Feb 12, 2010 at 11:22 AM, Nilesh Govindarajan <lists at itech7.com>wrote:

> Hi, while I was on Fedora, whenever I opened a file using vim, the next
> time I open it, it used to open at the same line where I closed it.
>
> What is the setting to enable this feature ? Its a big pain in the a$$ to
> scroll through the file every time I want to find the line.
>
> --
> Nilesh Govindarajan
> Site & Server Adminstrator
> www.itech7.com
>

Add this to your .vimrc

" When editing a file, always jump to the last known cursor position.
  " Don't do it when the position is invalid or when inside an event handler
  " (happens when dropping a file on gvim).
  " Also don't do it when the mark is in the first line, that is the default
  " position when opening a file.
  autocmd BufReadPost *
    \ if line("'\"") > 1 && line("'\"") <= line("$") |
    \   exe "normal! g`\"" |
    \ endif


More information about the arch-general mailing list