[prev in list] [next in list] [prev in thread] [next in thread]
List: vim
Subject: Re: Returning to same line
From: Bram Moolenaar <Bram () moolenaar ! net>
Date: 2002-12-31 21:03:35
[Download RAW message or body]
Michael Keightley wrote:
> When I start the version of Vim that comes with Red Hat 7.X or 8.0,
> the cursor is placed on the same line as when I lasted edited the
> file. I've compiled up Vim 6.1 or Red Hat 7.1 and Solaris 2.6, but I
> don't get this behaviour. The cursor is always at the top of the file
> when I start Vim. My .vimrc is the same in both cases. Is this a
> compile time option, or is there something in /usr/share/vim on Red
> Hat that does this?
This must be something in the Red Hat startup script. Look for the
"system vimrc file" line in the output of the ":version" command.
This is what I use myself:
" When editing a file, always jump to the last known cursor position.
autocmd BufReadPost *
\ if line("'\"") > 0 && line("'\"") <= line("$") |
\ exe "normal g`\"" |
\ let b:doopenfold = 1 |
\ endif
" Need to postpone using "zv" until after reading the modelines.
autocmd BufWinEnter *
\ if exists("b:doopenfold") |
\ unlet b:doopenfold |
\ exe "normal zv" |
\ endif
--
hundred-and-one symptoms of being an internet addict:
261. You find diskettes in your pockets when doing laundry.
/// Bram Moolenaar -- Bram@moolenaar.net -- http://www.moolenaar.net \\\
/// Creator of Vim - Vi IMproved -- http://www.vim.org \\\
\\\ Project leader for A-A-P -- http://www.a-a-p.org ///
\\\ Lord Of The Rings helps Uganda - http://iccf-holland.org/lotr.html ///
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic