Today’s my first day using Emacs at work. I picked a cognitively easy task (HTML markup editing) to practice on. Being somewhat wired up in Vim, I found myself thinking in terms of Vim operations, and trying to replicate it in Emacs. I know it’s not the most orthodox way of learning/doing Emacs, but it was the only way I knew to get started, and it’s helped me cope so far.
Here is my personal Vim to Emacs conversion table. It’s what I’ve been able to pick up and use fairly proficiently so far, in the order that made most sense to me as I picked the tool up.
“-” in the Vim column means I don’t know how it’s done, rather than Vim not being able to perform it. I expect that all these keys would work on a plain vanilla Emacs 23 install with no configuration or extra scripts added on.
You notice that I’ve used ctrl- and alt- notations directly instead of C- and M- which is the Emacs convention. I’ve done so because that’s what the labels say on the keyboard I use. Also, my brain is already bogged down enough making the cognitive leaps from Vim to Emacs, it doesn’t need to be bothered by M- to alt- and C- to ctrl- translations for now. If you’re not happy with it, go make your own list. Apologies to Mac users, you’ll have to think of alt- as your cmd- key.
Here we go.
|Start of Line||^||ctrl-a (alpha)|
|End of Line||$||ctrl-e(end)|
|Left by a word||w||alt-f (forward, bigger)|
|Right by a word||b||alt-b (back, bigger)|
|Next paragraph||ctrl-]||alt-e (end of next line)|
|Previous paragraph||ctrl-[||alt-a (alpha of previous line)|
|Start of buffer||gg||alt-<|
|End of buffer||G||alt->|
Basic file and program operations
|Open file||:e||ctrl-x ctrl-f|
|Save file||:w||ctrl-x ctrl-s|
Undo, Cut, Copy, Paste, Delete
|Undo||u||ctrl-_ or ctrl-/|
|Cycle through previous copies||-||ctrl-y (once) alt-y (to iterate)|
|Delete word||dw (to clipboard)||alt-d (no clipboard)|
|Cut line||dd||ctrl-a ctrl-k|
|Copy line||yy||ctrl-a ctrl-space ctrl-e alt-w|
|Copy entire buffer||gg v G y||alt-< ctrl-space alt-> alt-w|
Move around with search
|Search forward||/[search chars]||ctrl-s [search chars]|
|Search backwards||?[search chars]||ctrl-r [search chars] (reverse)|
|Next result||n||ctrl-s (after Search forward)|
|Previous result||N||ctrl-r (after Search backwards)|
Search and replace
|Whole document||:%s/[search]/[replace]/g||alt-x replace-string ret [search] ret[replace]alt-x replace-regex ret [search] ret [replace]|
|Within selection||(make selection):s/[search]/[replace]g||(make selection)alt-x replace-string ret [search] ret [replace]
alt-x replace-regex ret [search] ret [replace]
Opening new lines
|Before current line||O||ctrl-a ctrl-o|
|After current line||o||ctrl-e ctrl-o|
|Split top/bottom||ctrl-w s||ctrl-x 2|
|Split left/right||ctrl-w v||ctrl-x 3|
|Close current split||ctrl-w d||ctrl-x 0|
|Close other splits||ctrl-w o||ctrl-x 1|