jmglov.net -- Documentation

Vi for Emacs Users

The purpose of this document is to provide a quick Rosetta Stone-type reference for Emacs users who are using Vi[m] (probably against their will!).

The below tables use standard emacs conventions for describing keystrokes, C being the Control key (usually Ctrl), M being the Meta key (usually Alt), and - indication a combination. Therefore, C-x C-s mean that you hold down the Control key while pressing the 'x' key, then hold down the Control key while pressing the 's' key. Please refer to the GNU emacs manual for more information: http://www.gnu.org/manual/emacs-21.2/html_node/emacs_13.html#SEC13

 

 

Movement

emacs keystroke(s) Function vi keystroke(s)
C-b Move back (left) one character h
C-n Move down one line j
C-p Move up one line k
C-f Move forward (right) one character l
M-b Move back (left) one word b
M-f Move forward (right) one word w
C-a Move to beginning of line 0
C-e Move to end of line $
M-< Jump to beginning of document :0
M-> Jump to end of document :$
C-v Scroll down a page C-f
M-v Scroll up a page C-b
M-x goto-line ret n Move to line n nG

 

File manipulations

emacs keystroke(s) Function vi keystroke(s)
C-x s Save current file :w
C-x c Exit :q [1]
C-x f Open a new file ???

 

Case

emacs keystroke(s) Function vi keystroke(s)
M-u Make current word uppercase gUaw
M-l Make current word lowercase guaw
??? Make current line uppercase gUU
??? Make current line lowercase guu
??? Switch case of current character ~
??? Switch case of next N characters N~
??? Switch case of current line g~~

 

Footnotes

[1] The emacs C-x c command does prompt you to save if you have any dirty buffers. Likewise, vi's :q command will save you from yourself by not allowing you to exit with a dirty buffer. If you really want to save and discard changes, you must use the :q! command. vi provides a shortcut for "save and quit" that emacs does not, however. Use the :x command to save your changes and then quit vi.