Emacs vs Vi – A single page reference to commands

There is nothing new about this post. Emacs and Vi are two of the most powerful editors in the Linux family and I’m no exception in not loving them! I thought it would be a good idea to group both of their commands and keep them on a single page (side-by-side) for a handy reference. I like emacs a little more than Vi as it allows me to listen to music while working on the text (I meant emacs plays music files within the editor interface!). But Vi was the first editor that I learnt to use. I’m equally loyal to both of them. They are both excellent editors and suitable for all of your needs from editing simple text to programming in different languages, whatever they may be. They are my favorites and must be yours too! So, let’s enjoy using them and have some fun!…..

Note: The following list is not exhaustive and only contains those commands which could be identified under both emacs and vi editors. The command descriptions are taken from the emacs reference card and the vi commands were mapped to them. You can download the emacs reference card from here.

Command Description Emacs Vi
Read a file C-x C-f :r <file>
Save a file to disk C-x C-s :w <file>
Insert contents of another file into this buffer C-x i :r <file>
Replace this file with the file you really want C-x C-v :e <file>
Write buffer to a specified file C-x C-w :w <file>
Redraw garbaged screen C-l C-l
Regular expression search C-M-s /regexp
Reverse regular expression search C-M-r ?regexp
Move one character backwards C-b h
Move one character forwards C-f l
Move one word backwards M-b b
Move one word forwards M-f w
Move cursor up by one line C-p j
Move cursor down by one line C-n k
Go to line beginning C-a ^ or 0
Go to line end C-e $
Scroll display backward a screen M-v C-b
Scroll display forward a screen C-v C-f
Scroll current line to center of screen C-u C-l C-d or C-u
Delete a character backwards DEL x
Delete a character forwards C-d x
Delete a word backwards M-DEL dw
Delete a word forwards M-d dw
Yank back last thing killed C-y p
Set mark here C-@ or C-SPC ml
Exchange point and mark C-x C-x ‘l(Goto line with label l)
Interactively replace a text string M-% s/a/b/gc
Split window horizontally C-x 2 C-ws
Delete this window C-x 0 C-wc
Split window vertically C-x 3 :vsplit
Indent current line TAB << or >>
Insert newline after point C-o O
Join with previous line M-^ J
Change word to uppercase M-U U
Change word to lowercase M-u u
Capitalize word M-c ~ (swap case)

Which editor do you prefer? Vi or Emacs?

View Results

Loading ... Loading ...
Share and Enjoy:
  • Digg
  • Sphinn
  • del.icio.us
  • Facebook
  • Mixx
  • Google Bookmarks
  • Furl
  • LinkedIn
  • Slashdot
  • Technorati
This entry was posted on Friday, September 11th, 2009 at 12:36 pm and is filed under Linux. You can follow any responses to this entry through the RSS 2.0 feed. You can leave a response, or trackback from your own site.

Post Comments

(required)
(required)

Comments

Roger: Hi Madan, I am having a nightmare! tried for last...

frikik: thanks for all..

lockerz: Thanks for the info. The I love the fact that...

kraloyun: altough it is easy to install wordpress –...

Webmaster Forum: Very nice information.