[vox-tech] vim question
Peter Jay Salzman
vox-tech@lists.lugod.org
Tue, 12 Nov 2002 12:52:20 -0800
--0OAP2g/MAC+5xKAE
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable
putting this in .vimrc does the trick:
" 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("'\"") <=3D line("$") |
\ exe "normal g`\"" |
\ endif
i'm still unsure why that one instance of vim does this automaticaly and
all other vims i've used don't. i suppose i could use strace to see
what other config files are being pulled in, but at this point i'm more
happy than curious. ;-)
pete
begin Peter Jay Salzman <p@dirac.org>=20
> hi jan,
>=20
> the viminfo file just stores information. it doesn't actually do
> anything by itself. in other words, the viminfo file differs from the
> .vimrc file in that:
>=20
> viminfo: stores state data for vim
> .vimrc: a list of vim commands to run at the start of a vim session
>=20
> so how does the cursor get positioned when vim is started?
>=20
> pete
>=20
>=20
>=20
>=20
> begin Jan W <jcwynholds@yahoo.com>=20
> > Hi Peter:
> >=20
> > Look in ~/.viminfo
> >=20
> > There should be a line like:
> >=20
> > # File marks:
> > '0 37 0 ~/textfile3.txt
> > '1 35 0 ~/textfile.txt
> >=20
> > I think that is the place that you are talking about.
> >=20
> > :)
> >=20
> > HTHO,
> >=20
> > jan
> >=20
> > --- Peter Jay Salzman <p@dirac.org> wrote:
> > > hi lugod,
> > >=20
> > > i've seen vim on a mandrake system which, when opening a file a second
> > > time, will place the cursor at its last position when the file was
> > > initially opened.
> > >=20
> > > anyone know how to get vim to do this?
> > >=20
> > > i've checked the ~/.vimrc and can find nothing that does this. i also
> > > checked bash aliases to make sure vim wasn't aliased to vim plus some
> > > command line switches. nothing.
> > >=20
> > > i'd like for my own vim to do this. anyone know the magic?
> > >=20
> > > pete
--0OAP2g/MAC+5xKAE
Content-Type: application/pgp-signature
Content-Disposition: inline
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.0 (GNU/Linux)
iD8DBQE90WoEo7kZRWfqlR0RAmS2AJ4sjSWtwnX9k8SFVbFqrA2743nrCACeLJQQ
tjiBFi/XiBvi6Eww0RwukQA=
=e4QO
-----END PGP SIGNATURE-----
--0OAP2g/MAC+5xKAE--