www.ShoppingPodder.com

Leading Computer Shopping,
News and information


Part of the Identityscape.com network...

getxfactor.com jmoodmusic.com smartbusinesschoices.com mintdepot.com lowfaresalways.com evangelicalview.com shoppingpodder.com soproudlywehail.com webnews.ws currenthumor.com

 

 

Move to last position
   Shopping Podder - the Best of Computer Postings! Forum Index -> Computer - Editors  
View previous topic :: View next topic  
Author Message
Charles M
Guest






PostPosted: Sun Nov 16, 2008 11:24 pm    Post subject: Move to last position Reply with quote

Is there a command to move to your last position in vim?
For instance, I'm editing and maybe hit a key by mistake
that takes me far away from my cursor position. I don't
know how I got here and I don't have any marks set up.
How to I get back to my last cursor position?

CMM
Back to top
Rouben Rostamian
Guest






PostPosted: Mon Nov 17, 2008 12:20 am    Post subject: Re: Move to last position Reply with quote

In article <slrngi0lpi.11o.CharlesM@194.sub-70-194-175.myvzw.com>,
Charles M <CharlesM@194.sub-70-194-175.myvzw.com> wrote:
Quote:
Is there a command to move to your last position in vim?
For instance, I'm editing and maybe hit a key by mistake
that takes me far away from my cursor position. I don't
know how I got here and I don't have any marks set up.
How to I get back to my last cursor position?

The key sequence `` (two single backward quotes)
takes you to the position you jumped from.

The key sequence '' (two single forward quotes)
takes you to the line you jumped from.

--
Rouben Rostamian
Back to top
Charles M
Guest






PostPosted: Mon Nov 17, 2008 4:27 am    Post subject: Re: Move to last position Reply with quote

On 2008-11-16, Rouben Rostamian <rostamia@umbc.edu> wrote:
Quote:
In article <slrngi0lpi.11o.CharlesM@194.sub-70-194-175.myvzw.com>,
Charles M <CharlesM@194.sub-70-194-175.myvzw.com> wrote:
Is there a command to move to your last position in vim?
For instance, I'm editing and maybe hit a key by mistake
that takes me far away from my cursor position. I don't
know how I got here and I don't have any marks set up.
How to I get back to my last cursor position?

The key sequence `` (two single backward quotes)
takes you to the position you jumped from.

The key sequence '' (two single forward quotes)
takes you to the line you jumped from.


`` Doesn't do that, although I've read in a number of places that it
should. If I place the cursot at a middle spot on a document (right
before a word so I know that exact position of the cursor) then issue
a movement command (say, :$ go to end of file) and then type `` ,I go
to the top of the file NOT where I was. Same with '' .
Back to top
Rouben Rostamian
Guest






PostPosted: Mon Nov 17, 2008 9:06 am    Post subject: Re: Move to last position Reply with quote

In article <slrngi17hl.5je.CharlesM@Macintosh.local>,
Charles M <CharlesM@Macintosh.local> wrote:
Quote:

The key sequence `` (two single backward quotes)
takes you to the position you jumped from.

The key sequence '' (two single forward quotes)
takes you to the line you jumped from.

`` Doesn't do that, although I've read in a number of places that it
should. If I place the cursot at a middle spot on a document (right
before a word so I know that exact position of the cursor) then issue a
movement command (say, :$ go to end of file) and then type `` ,I go to
the top of the file NOT where I was. Same with '' .

The `` and '' commands you back to the previous position after a
"jump". Not all movements are jumps. This is from vim's help:

A "jump" is one of the following commands: "'", "`", "G",
"/", "?", "n", "N", "%", "(", ")", "[[", "]]", "{", "}", ":s",
":tag", "L", "M", "H" and the commands that start editing a new
file. If you make the cursor "jump" with one of these commands,
the position of the cursor before the jump is remembered.
You can return to that position with the "''" and "``" command,
unless the line containing that position was changed or deleted.

--
Rouben Rostamian
Back to top
Kenny McCormack
Guest






PostPosted: Mon Nov 17, 2008 12:14 pm    Post subject: Re: Move to last position Reply with quote

In article <gfqs7s$crc$1@linux2.gl.umbc.edu>,
Rouben Rostamian <rostamia@umbc.edu> wrote:
Quote:
In article <slrngi17hl.5je.CharlesM@Macintosh.local>,
Charles M <CharlesM@Macintosh.local> wrote:

The key sequence `` (two single backward quotes)
takes you to the position you jumped from.

The key sequence '' (two single forward quotes)
takes you to the line you jumped from.

`` Doesn't do that, although I've read in a number of places that it
should. If I place the cursot at a middle spot on a document (right
before a word so I know that exact position of the cursor) then issue a
movement command (say, :$ go to end of file) and then type `` ,I go to
the top of the file NOT where I was. Same with '' .

The `` and '' commands you back to the previous position after a
"jump". Not all movements are jumps. This is from vim's help:

A "jump" is one of the following commands: "'", "`", "G",
"/", "?", "n", "N", "%", "(", ")", "[[", "]]", "{", "}", ":s",
":tag", "L", "M", "H" and the commands that start editing a new
file. If you make the cursor "jump" with one of these commands,
the position of the cursor before the jump is remembered.
You can return to that position with the "''" and "``" command,
unless the line containing that position was changed or deleted.

All of which boils down to: It usually works, but it isn't guaranteed.

This agrees with my experience.
Back to top
Cesar Romani
Guest






PostPosted: Mon Nov 17, 2008 10:54 pm    Post subject: Re: Move to last position Reply with quote

Charles M wrote:
Quote:
Is there a command to move to your last position in vim?
For instance, I'm editing and maybe hit a key by mistake
that takes me far away from my cursor position. I don't
know how I got here and I don't have any marks set up.
How to I get back to my last cursor position?

CMM

CTRL-o

see :help CTRL-o

Regards,
CR
Back to top
Display posts from previous:   
   Shopping Podder - the Best of Computer Postings! Forum Index -> Computer - Editors  
Page 1 of 1
All times are GMT

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum