> -----Original Message-----
> From: A.J.Mechelynck [mailto:[EMAIL PROTECTED] 
> Sent: Sunday, August 20, 2006 10:15 AM
> To: Lu Tan Hoa
> Cc: [email protected]
> Subject: Re: [viminfo] Vim can't remeber position
> 
> Lu Tan Hoa wrote:
> > Dear vim-list,
> > 
> > I compile Vim-7.0 from source with default config.
> > $ vim --version | grep viminfo
> > +user_commands +vertsplit +virtualedit +visual +visualextra 
> +viminfo 
> > +vreplace
> > 
> > I also put viminfo variable in ~/.vimrc as:
> > set viminfo='20,<50,s10,h,r/mnt/usb
> > 
> > But, when I open an old file, cursor always goto the first 
> line Do I 
> > miss something in configuration step
> > 
> > Thanks and regards,
> 
> I recommend adding the line
> 
>       runtime vimrc_example.vim
> 
> near the top of your vimrc.
> 
> But if you don't want to, you can still copy the autocommand 
> found near line 70 of $VIMRUNTIME/vimrc_example.vim, as follows:
> 
>    " 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).
>    autocmd BufReadPost *
>      \ if line("'\"") > 0 && line("'\"") <= line("$") |
>      \   exe "normal g`\"" |
>      \ endif
> 


This has been further enhanced and documented here:
http://vim.sourceforge.net/tips/tip.php?tip_id=80

HTH,
Dave

Reply via email to