On 02/12/2010 12:08 PM, gt wrote:
On Fri, Feb 12, 2010 at 11:22 AM, Nilesh Govindarajan<li...@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

Thanks :)

--
Nilesh Govindarajan
Site & Server Adminstrator
www.itech7.com

Reply via email to