I often find, when adopting a new tool or language, to try to learn how to use it as it was meant to be used. Sure you could write Ruby code like a Java developer but far better to write Ruby like a Ruby developer. Idiom\ s matter.
To that end, lets approach Emacs as a beginner with few preconceived notions from VIM. I’m not suggesting that you forget all of the lovely features that you enjoyed in VIM but instead that you should start with the basics\ and build up from there.
So to begin at the beginning:
A quick google led me to Emacs’s built-in tutorial:
C-h t. The built-in tutorial is a fantastic place to start. I found it more accessible, due to its narrow focus, than vim’s. That said, the tutorial will \
give you just enough to be comfortable with simple navigation within emacs.
Among the many features the tutorial will introduce you to is “help on help”:
C-h C-h is perhaps your best friend. From there, emacs provides several different avenues to discover new functionality and elabor\
ate upon what you will learn.
C-h C-h: help on help, literally. This function gives a summary of all of the built in help features and the keybindings to invoke them directly.
C-h b: list all keybindings.
C-h c: display the function run by a specific keybinding
Copying, yanking, pasting, deleting, and killing
As a newly-minted Emacs user, you’re probably wondering how to yank and delete. Be warned “yank” means exactly the opposite in Emacs as it does in VIM. Wacky, right?
In VIM, you yanked/deleted text and then pasted it. With Emacs, you “copy” or “kill” text then “yank” it into place.
With all of this in mind, let’s turn to our new friend
C-s RET : This puts you in interactive search mode (which, frankly, at this point, I’ve far from mastered). At its most basic, interactive search will navigate you forward through your current bu\
ffer toward the first matching characters. Subsequent presses of
C-s will lead you to matches further forward in the buffer and then eventually wrap to the top of the buffer.
My first big “Ah ha” moment with emacs came when I realized that I could use to invoke any “interactive” functions in emacs. That is, you enter
M-x then begin typing the name of a function. Aft\
er a few letters, if you hit return, emacs opens a window showing you all of the matching function names.
yanking: I’m sure there’s a scholarly article somewhere in uncovering the history of yanking in the *NIX community but I will leave that as an exercise for the extremely atypical readers.
interactive: functions are emacs lisp functions containing a call to the “interactive” function thus informing Emacs that they may be invoked interactively.
Posted by evan on Apr 24, 2013