tags:

views:

125

answers:

3

Hi, sometimes I have to switch between 2 lines. To do this, I have to pass line number. Are there shortcuts to moving between 2 last 'visited' list. Something similar to '. (it moves to last edited line)

+8  A: 

You can use bookmarks, something like ma to mark a bookmark named a, and then 'a to go to it. Naming boomarks a and b for example, you can switch between them with 'a and 'b.

Greg Hewgill
Great! Is it possible to have global bookmarks to swiching between files?
Sławosz
Use capital letters A-Z for global bookmarks across files. Look at `:help :marks` or `:help '` for more info - after the command reference there are descriptions of marks a-z, A-Z, 0-9.
Nefrubyr
+3  A: 

ctrl-o and ctrl-i will move backwards and forwards through your history of jump points. A jump point is pretty much any command that moves the cursor more than one line. It will also go back to previous files that were loaded into the current buffer.

See :h jump-motions for more information.

Dave Kirby
+4  A: 

Double-backtick or double single-quote will do exactly that

There is a command that will bounce to the last location you jumped away from. If repeated, it will then return to the jump destination you were just on. If repeated further it will bounce you back and forth between the two locations.

The command has two forms:

``

or

''
DigitalRoss