Back to Blog

Neovim from Zero: Your First File, Four Modes & Navigation | Episode 1

Sandy LaneSandy Lane

Video: Neovim from Zero: Your First File, Four Modes & Navigation | Episode 1 by Taught by Celeste AI - AI Coding Coach

Watch full page →

Neovim from Zero: Your First File, Four Modes & Navigation

Get started with Neovim by learning how to install it and understand its four essential modes: Normal, Insert, Visual, and Command. This guide covers basic navigation using the home row keys, word motions, and how to save and quit your first file efficiently.

Code

" Open Neovim and try these commands:

" 1. Enter Insert mode to start typing:
i           " Insert before cursor
a           " Insert after cursor
A           " Insert at end of line
o           " Open new line below and insert
O           " Open new line above and insert

" 2. Return to Normal mode:
<Esc>     " Press Escape key

" 3. Navigate in Normal mode:
h           " Move left
j           " Move down
k           " Move up
l           " Move right
0           " Move to beginning of line
$           " Move to end of line
gg          " Go to top of file
G           " Go to bottom of file
w           " Jump to start of next word
b           " Jump to start of previous word
e           " Jump to end of current/next word
3w          " Move forward 3 words

" 4. Visual mode selections:
v           " Start character-wise selection
V           " Start line-wise selection

" 5. Editing and undo:
dd          " Delete current line
u           " Undo last change
Ctrl-r      " Redo undone change

" 6. Save and exit:
:w          " Save file
:q          " Quit Neovim
:wq         " Save and quit

Key Points

  • Neovim has four modes: Normal for commands, Insert for typing, Visual for selecting text, and Command for file operations.
  • Use h, j, k, l keys in Normal mode to navigate left, down, up, and right without leaving the home row.
  • Press i to enter Insert mode and Esc to return to Normal mode for efficient editing.
  • Word motions like w, b, and e help you jump between words quickly, and counts like 3w move multiple words at once.
  • Save your work with :w, quit with :q, or do both together with :wq to finish your session.