Re: VIM history

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]



On Fri, Feb 12, 2010 at 11:22 AM, Nilesh Govindarajan <lists@xxxxxxxxxx>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


[Index of Archives]     [Linux Wireless]     [Linux Kernel]     [ATH6KL]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [Share Photos]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Samba]     [Device Mapper]
  Powered by Linux