Emacs II: The Mindset, a contextual shift
November 9th, 2008
I’d like to take the opportunity to talk a bit about a few of the contextual shifts that I found it necessary to make when switching from vim to emacs.
Meta vs. Ctrl
This point was my first aha moment when I started using emacs. There is a definite difference in the general functions of the control key and the meta key in reference for navigation and text manipulation.
The meta key tends to be aware of grammatical segments. It understands what paragraphs, sentences and words are. The control key, on the other hand, understands the buffer. It knows how to deal with lines and characters. Want to kill a line? C-k. Want to kill to the end a paragraph? M-k. Move to the front of a line? C-a. Move to the start of a paragraph? M-a, and so on.
Emacs Conventions
There are a few emacs conventions that are worth mentioning, though I won’t spend much time on them. There is a subset of keyboard shortcuts set aside for users to define. They are C-c <letter>.
Everything is a mode. You want python support? Major mode. Want to highlight your current line? Minor mode. Want spell check? Minor mode. Line numbers? You guessed it.. Minor mode. This isn’t nearly as frustrating and convoluted as it sounds. It works out that is a pretty nice segmentation for functionality.
Emacs shortcuts are Bash shortcuts
This was another pretty key realization. As I got into using emacs, I started accidentally typing my navigation shortcuts as I would if I were in an emacs buffer. I was really surprised when they actually worked! This is a major improvement over randomly inserting 0’s or $’s at random points throughout my document as I tried to navigate via vim’s keystrokes. Another cool thing is that emacs’s encourages using the C-s and C-r commands. C-r also works in bash for perusing history of commands which comes in lots of handy. Even more, it works in the ipython shell!
If you have questions, feel free to contact me. Also, be sure to check out everyone else doing the post-a-day marathon: Greg Newman, Eric Florenzano, Brian Rosner, James Tauber and Eric Holsher.
Comments are disabled. If that bothers you, please contact me on twitter at @justinlilly and let me know.