vim For Emacs Users


Bookmarks in vi, and Emulating Emacs "mark" and "point"

One of the most important movement commands in Emacs (for me) is bookmark-set, along with its companion, bookmark-jump. I usually keep these bound to ^Xm and ^Xj, but those are not the default bindings. Anyway, in vim:
Esc X bookmark-set q mq ...
Esc X bookmark-jump q `q (that's a backquote)
Also, 'q (that's a regular quote) takes you to the beginning of the line containing bookmark q. The "q" can be any single letter, so you have 26 bookmarks available. This is limited compared to Emacs, which allows arbitrary bookmark names, but who uses more than 26 bookmarks?

Any time you move from one line to another, using commands other than j or k , vim remembers the origin of the movement. You can move backward through the list of remembered positions using ^O , and forward through the list using ^I . You can also toggle between the current position and the last remembered position using `` (those are back-quotes). So approximately,

^X^X `` ...
.

You can also pick a bookmark (I usually use "a") and use it as an analog of Emacs's "mark". That implies:

^[space](move somewhere)^W ma(move somewhere)d`a Emacs idiom for deleting a marked block of text
That is, we place bookmark "a", then move the cursor and apply the d command to the range of characters between wherever we are and the bookmark named "a".

Last changed:
01-22-06 18:26:53


This page was rendered by LittleSite.
LittleSite is Copyright (c) 2005 by J.Knapka.
Questions and comments to JK