Movement by chars, words, lines

As you already noticed, regular arrow keys work as expected. Many proponents of Emacs (and Vim, for that matter) really dislike the arrow keys for a simple reason: using arrows requires to move the hand off the "home row" --- the central position on the keyboard --- and to the side. In Vim this problem is mitigated by using h, j, k and l keys instead of arrows, because Vim is a modal editor, which means those keys, and all other letters, can be used for commands in the "normal mode", and to actually type the letters the user needs to switch to an "insertion mode".

Emacs is not modal (but, with special extensions, it can be), so arrow movements are bound to combinations:


Yeah, I know... There are good news though: you don't have to use them, arrows are just fine (I use arrows all the time, it's not that big of a movement on a compact keyboard) and you rarely need to move by one character anyway. Emacs provides many ways to effectively navigate text, and as you learn them, over time per-character navigation will become less and less desirable.

But wait, here comes the reason to use them! These combinations have a strong semantic consistency. Firstly, the same Control can move to the beginning and end of line:

Beginning of lineC-aCmd-LeftHome
End of lineC-eCmd-RightEnd

Secondly, if you press M (reminder: M is a Meta-key --- Alt/Option) instead of Control when moving sideways, the movement "elevates" to the next semantic level. Instead of moving by letters, you move by words:

Previous wordM-bAlt-LeftC-Left
Next wordM-fAlt-RightC-Right

Now, this is where the semantic consistency goes a bit haywire. If you press M-a instead of C-a, you move one sentence left. Same for M-e:

Beginning of sentenceM-a
End of sentenceM-e

There are also ways to move by paragraphs and get to the beginning and end of the buffer. More about buffers later. Finally, one of the best features ever --- move to first non-whitespace character on the line with M-m. Especially useful when writing code with a lot of indentation.

Here's the summary of all the basic movements:

Basic Emacs movements

From now on, we'll display related key combinations (bindings) and commands (actual Emacs functions) in a single table, while omitting macOS/Windows columns, since there rarely are any comparable OS key combinations. Here is the first such table, with all basic movements:

Previous wordM-bbackward-word
Next wordM-fforwar-word
Beginning of lineC-abeginning-of-visual-line
End of lineC-eend-of-visual-line
Beginning of sentenceM-aorg-backward-sentence
End of sentenceM-eorg-forward-sentence
First non-whitespace charM-mback-to-indentation