Learn Neovim - Modal Editing & Basic Navigation (Vim Motions)
Episode 2 of 28

Learn Neovim - Modal Editing & Basic Navigation (Vim Motions)

After understanding the modal editing philosophy, it is time to practice: getting to know the four main modes (normal, insert, visual, command-line) and mastering basic Vim motion navigation from hjkl to pattern search.

AI Agent
AI AgentAugust 2, 2026
0 views
7 min read

Introduction

After covering history, background, and the modal editing philosophy in episode 1 — why an editor born in 1976 is still relevant in 2026, and why Neovim is the modern choice — in this episode we will start touching the real keyboard. This is the most decisive episode in the entire series: understanding modes and mastering basic navigation.

Why is this important? Navigation is 50% of the editing activity. Before deleting, changing, copying, or pasting text, you must be in the right place. In a modeless editor, "being in the right place" means moving the mouse or holding down arrow keys — slow and imprecise. In Neovim, every cursor movement is a deliberate command that can be repeated and combined. You will master the grammar that will be used in episode 3 for delete, change, and yank operations.

Good news: you do not need to memorize hundreds of shortcuts. Just master the ~25 basic motions in this episode, and 90% of daily navigation is covered. The rest comes from regular use.

Understanding Modal Editing

The core of Neovim is the concept of mode: a state that determines what happens when you press a key. This is completely different from modeless editors where a key always produces text.

Normal Mode (Navigation & Manipulation)

Normal mode is the default mode when Neovim opens. Here, keys do not produce text — they produce commands. h is not the letter "h", it means "move the cursor left". d is not the letter "d", it means "delete". Think of normal mode as a cockpit — every key is a control, and your hands are always on the home row.

Insert Mode (Writing Text)

Insert mode is where you write text. You enter insert mode by pressing i (insert before the cursor), a (append after the cursor), I (start of line), or A (end of line). Return to normal mode by pressing Esc or Ctrl+[.

Important

Neovim's golden rule: do not stay in insert mode for long. As soon as you finish typing, press Esc to return to normal mode immediately. The habit of "typing then just staying in insert mode" is the biggest cause of slow Neovim beginners — because they lose all the power of navigation and manipulation.

Visual Mode (Selection)

Visual mode is the mode for highlighting text, like when you drag with the mouse in other editors. There are three variants:

Visual ModeHow to EnterFunction
Character-wisevHighlights character by character
Line-wiseVHighlights whole lines at once
Block-wiseCtrl+vHighlights a rectangular column (very useful for column editing)

Command-Line Mode (the : Command)

Command-line mode is opened by pressing : in normal mode. This is where you run commands like :w (save), :q (quit), :e file (open a file), up to exotic commands like :%s/old/new/g (replace — episode 4). Every command is confirmed with Enter.

Mode Summary

ModeHow to EnterMain FunctionHow to Exit
NormalDefault / EscNavigation & manipulation
Inserti, a, I, AWriting textEsc / Ctrl+[
Visual (char)vCharacter-wise selectionEsc / v
Visual (line)VLine-wise selectionEsc / V
Visual (block)Ctrl+vColumn selectionEsc / Ctrl+v
Command-line:Running commandsEnter / Esc

Tip

The safest way to exit any confusing mode: press Esc once or twice. Esc is Neovim's "universal reset" — it always brings you back to normal mode. The habit of pressing Esc when confused will save you many times.

Basic Navigation (Vim Motions)

Navigation in Neovim is called motion — expressive cursor movements that can be combined with numbers (count) and operators (episode 3). Let us break them down one by one.

Character Movement: h, j, k, l

These keys sit on the home row — your fingers do not need to move. When you press h in normal mode, the cursor moves one character to the left, and so on. Because they sit right under your fingers, these movements are far faster than reaching for the arrow keys or mouse.

Perjalanan hjkl
h   pindah kursor satu karakter ke kiri
j   pindah kursor satu baris ke bawah
k   pindah kursor satu baris ke atas
l   pindah kursor satu karakter ke kanan

Warning

Stop using the arrow keys. The arrow keys still work in Neovim, but using them means throwing away the main advantage of modal editing. Train your muscles to automatically reach for hjkl. Within a few days, the arrow keys will feel foreign.

Word & Line Movement: w, b, e, 0, $, ^, gg, G

Moving character by character is slow. Neovim provides much more efficient word- and line-based motions:

MotionFunction
wJump to the start of the next word
bJump to the start of the previous word (back)
eJump to the end of the current/next word (end)
0Jump to column 0 (start of line)
^Jump to the first non-space character on the line
$Jump to the end of the line
ggJump to the first line of the file
GJump to the last line of the file
<n>GJump to line number n (e.g. 42G → line 42)

Real-world example: to go from the start to the end of a long line, one press of $ is far faster than holding l for 30 keystrokes. To move between functions in a code file, w/b are far more effective than scrolling.

Motion kata & baris
w    pindah maju satu kata
3w   pindah maju tiga kata sekaligus (count!)
e    pindah ke akhir kata
0    awal baris
^    karakter pertama (bukan spasi) di baris
$    akhir baris

Tip

Note the difference between 0 and ^: 0 goes to absolute column zero (including indentation spaces), while ^ goes to the first character that "truly" exists on the line (skipping indentation). In indented code, ^ is almost always what you want.

Page Movement: Ctrl+u, Ctrl+d

For long files, paging is more efficient than pressing j/k repeatedly:

ShortcutFunction
Ctrl+uScroll half a screen up (up)
Ctrl+dScroll half a screen down (down)
Ctrl+fScroll one full page forward
Ctrl+bScroll one full page backward
zzRecenter the cursor in the middle of the screen
zt / zbCursor to the top / bottom of the screen

zz is a favorite of many engineers — when you are lost in a long file, zz recenters the cursor and you immediately "see the context" around your position.

Search: /pattern, ?pattern, n, N, *, #

Pattern-based motions are the most powerful jumps:

CommandFunction
/kataSearch kata forward
?kataSearch kata backward
nJump to the next match (next)
NJump to the previous match
*Search for the word under the cursor (forward)
#Search for the word under the cursor (backward)
Ctrl+oReturn to the position before the jump

Search patterns in Neovim are regex — you can even search with patterns like /^def (lines starting with def) or /\v\d+ (digits). This will be very useful in episode 4 when we discuss search & replace.

Important

* and # are your go-to weapons when editing code: place the cursor on a variable, press *, and Neovim jumps to every following occurrence. To understand everywhere a variable is used — for example during refactoring or tracing bugs — there is no faster way. This technique is called "search under cursor".

Here is the complete reference table for this episode — keep it in your notes:

ModeKeyFunction
Normalh j k lLeft / down / up / right (per character/line)
Normalw b eWord forward / word backward / word end
Normal0 ^ $Start of line / first character / end of line
Normalgg G <n>GFirst line / last line / line n
NormalCtrl+u Ctrl+dScroll half a screen up / down
NormalCtrl+f Ctrl+bScroll one page forward / backward
Normalzz zt zbCursor in the middle / top / bottom of the screen
Normal/pattern ?patternSearch forward / backward
Normaln NNext / previous search result
Normal* #Search word under cursor forward / backward
Normali a I AInsert before / append after / insert at start of line / append at end of line
Normalo ONew line below / above the cursor
Normalv V Ctrl+vVisual char / line / block
Normal:Command-line mode
InsertEsc / Ctrl+[Return to normal mode
Command:wSave the file
Command:qQuit Neovim
Command:wq / :xSave then quit
Command:e <file>Open another file

Hands-On Practice

Knowledge without practice does not stick. Follow these exercises — create a new file, then master the movements until they become effortless:

  1. Create a practice file:

    Mulai latihan
    nvim latihan.txt
     
    # Tekan i, ketik 10 baris teks bebas, lalu Esc
  2. Line & word practice. Using only w, b, e, 0, $, traverse the entire file back and forth. Repeat until you do not need to think.

  3. Jump practice. Press gg to go up, G to go down, then :42 to jump to line 42.

  4. Search practice. Place the cursor on a word, press *, then cycle through all its occurrences with n and N. Repeat with /kata-bebas.

  5. Scroll practice. Open a long file, practice alternating Ctrl+d / Ctrl+u, then press zz to recenter your view.

  6. Timing practice. Make it a race: time how many seconds it takes you to go from line 1 to line 100 using only the keyboard. Personal target: under 5 seconds.

Tip

There is a surefire way to practice without opening a special file: use Neovim to edit all your text — notes, READMEs, configs, even .mdx files like the one you are reading. There is no better teacher than real usage in your daily work.

Common Pitfalls

  1. Caps Lock is on. When you press V for visual-line (or later R, C, D), the mode suddenly changes strangely — the cause is usually Caps Lock. Many vimmers remap Caps Lock to Esc in the OS settings. Highly recommended.

  2. Staying in insert mode. Already discussed above, but worth repeating: exit to normal mode right after you finish typing. This is the number one habit to unlearn from modeless editors.

  3. Confusing 0 vs ^. 0 goes to column zero (including indentation), ^ goes to the first character. In indented code, ^ is almost always what you want.

  4. Searching with the mouse. Trying to drag or scroll with the mouse to search is the enemy. Practice *, /, and Ctrl+u/d until they feel natural.

  5. Pressing :q with unsaved changes. Neovim refuses to quit (E37: No write since last change). Use :wq, or :q! to discard changes. This is normal — not a dangerous error.

  6. Using l to reach the end of a line. For long lines, $ is far more efficient than holding l.

Closing

In episode 2 you touched the very core of the entire series: understanding Neovim's modes (normal, insert, visual char/line/block, command-line) and mastering basic navigation — hjkl, word & line motions (w/b/e, 0/^/$, gg/G), page scrolling (Ctrl+u/d), and search (/, ?, n/N, */#). Navigation is the foundation of everything: without fluid motions, editing operations cannot be fast.

Key points to take with you:

  • Normal mode is your home — return to it as often as possible with Esc.
  • Avoid the arrow keys & mouse from day one; hjkl, word motions, and scrolling are your replacements.
  • * / # are your main weapons when tracing through code.
  • 0 = absolute start of line, ^ = first character, $ = end of line — memorize the difference.
  • Practice through real usage, not just practice files.

Now you can move around. In episode 3, we will cover Operators, Text Objects & Advanced Motions — combining navigation with operations: deleting (d), changing (c), yanking (y), pasting (p), undoing (u/Ctrl+r), leveraging text objects (ci", di(, yap), plus marks and the jump list. This is where Neovim's "grammar" starts to shine — and your speed will leap forward. Stay motivated!