The Mindset, A contextual shift

There were a few insights I got when I switched from vim to emacs. Hopefully they'll help you get a leg up.

Meta vs. Ctrl

Learning the difference between meta and ctrl 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>, which means hold Control and press the letter c, then release control and c, then press the next 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. The major distinction here is that major modes take over the entire buffer. Minor modes are like small functional additions.

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 recursively searching history of commands which comes in lots of handy.

© 2012 - 2020 · Home — Theme Simpleness