Table of Contents
Neovim Basics
Neovim is a modal text editor: different modes for different tasks. Start in normal mode (commands), press i to enter insert mode (type text), press Esc to return to normal mode.
$ nvim file.txt # open file $ nvim +10 file.txt # open file, jump to line 10 $ nvim +/pattern file.txt # open file, search for pattern $ nvim -c "command" file.txt # open file, run ex command
Three main modes:
Normal mode — for commands. Press keys to move, delete, change, etc. This is where you spend most time. Examples:
- h, j, k, l — move cursor left/down/up/right
- w, b — move to next/previous word
- dd — delete line
- yy — copy line
- :q — quit (ex command)
Insert mode — for typing text. Press i to enter, Esc to exit. Keys are literal characters, not commands.
Visual mode — for selecting text. Press v for character selection, V for line selection, Ctrl+V for block selection. Then use normal commands on selection.
Ex commands start with : (colon in normal mode). Examples: :w (write/save), :q (quit), :set number (show line numbers), :help topic (help).
Most editing in Neovim is: position cursor → select text → apply command. This is more efficient than reaching for the mouse.
