Vim, Neovim and Emacs
Level 1 · The editor
The editors you drive with keys, inside a terminal. How Vim's modes work, what Neovim changed, how Emacs grows, and how to quit each one.
Course contentsLesson 3 of 13
Level 1 · The editor
Level 2 · Checking and fixing code
Level 3 · Trying code out
Level 4 · Other people's code
Level 5 · Building the project
After this lesson you can
- Switch between Vim's two main modes
- Save and quit in Vim and in Emacs
- Say what Neovim and Emacs add
11 mincovers 3 glossary entries
Worth reading first: Autocomplete and Extensions
How Vim's modes work, and how to get out
Vim is a free text editor that runs inside a terminal and is driven by keys, not a mouse. It has modes. In normal mode each key is a command, so dd deletes a line. In insert mode keys type letters. In Stack Overflow's 2024 survey, about 22 in 100 developers said they used it.
Vim matters even if you never pick it. It, or the older vi it grew from, is on almost every Linux server. When you log in to a server and a tool opens a file for you, it is often Vim. Knowing five keys gets you out of trouble.
Those keys are these. Press i to start typing. Press Esc to go back to normal mode. Type a colon to reach the command line at the bottom. Then :w saves, :q quits, :wq does both, and :q! quits without saving.
The common slip is typing words while still in normal mode. Each letter runs as a command, and the file changes in strange ways. Press Esc, then u to undo, and press i before you type again.
Neovim is a newer editor built from Vim. The keys and modes work the same, so a Vim user feels at home. Its main change is how you set it up: with a short script in a file called init.lua, rather than Vim's own settings language. It also talks to language tools for hints and errors.
Emacs is an older free editor that you grow with code. Nearly every part of it is written in its own small language, so you can change any of it. People add mail, notes and Git tools to it. Its keys lean on Ctrl: Ctrl+x then Ctrl+s saves, and Ctrl+x then Ctrl+c quits.
Practised users of all three edit very fast, because their hands never leave the keys. The price is the first few weeks, which are slow. Many people use VS Code for daily work and learn just enough Vim for servers.
$ vim notes.txt
i start typing (insert mode)
Esc back to normal mode
:wq write the file and quit
:q! quit and throw away changesWorked example
Emma edits a file on a server
Emma logs in to a server to change one setting. The file opens in Vim, and her first word turns into a mess of commands.
She presses Esc and u to undo, then i, types the new value, presses Esc and types :wq. The whole fix takes 2 minutes.
The words for this lesson3
Check yourself
How do I quit Vim without saving my changes?
Finished this lesson?
Marking it complete also marks its 3 glossary entries learned, which updates your roadmap and your saved page. 0 are already marked.