1 Basic Neovim
mitsimi edited this page 2026-07-01 22:43:51 +02:00

Basic Neovim

This page covers the core Neovim concepts that make the rest of the config less mysterious.

Modes

Neovim is modal. The same key can do different things depending on the current mode.

  • Normal mode: move around, delete/change/yank text, run commands.
  • Insert mode: type text.
  • Visual mode: select text.
  • Terminal mode: interact with a terminal buffer.
  • Command-line mode: run commands after pressing :.

Useful mode keys:

  • i: enter Insert mode before the cursor.
  • a: enter Insert mode after the cursor.
  • v: enter Visual mode.
  • V: enter line-wise Visual mode.
  • <Esc>: return to Normal mode.
  • <Esc><Esc> in a terminal buffer: leave Terminal mode.

Files, Buffers, Windows, Tabs

  • A file is what lives on disk.
  • A buffer is an open file or editable text in memory.
  • A window is a view into a buffer.
  • A tab page is a layout containing one or more windows.

Common commands:

:edit path/to/file
:write
:quit
:wq
:bnext
:bprevious
:ls
:split
:vsplit
:tabnew

This config also gives you <space><space> to search open buffers with Telescope.

Movement

Classic movement keys:

  • h: left.
  • j: down.
  • k: up.
  • l: right.
  • w: next word.
  • b: previous word.
  • e: end of word.
  • 0: start of line.
  • ^: first non-blank character.
  • $: end of line.
  • gg: top of file.
  • G: bottom of file.
  • <C-d>: half-page down.
  • <C-u>: half-page up.

Window movement in this config:

  • <C-h>: move to the left window.
  • <C-j>: move to the lower window.
  • <C-k>: move to the upper window.
  • <C-l>: move to the right window.

Editing Grammar

Neovim commands often follow a verb plus motion pattern:

  • d means delete.
  • c means change.
  • y means yank/copy.
  • > means indent.
  • < means unindent.

Examples:

  • dw: delete word.
  • ci": change inside quotes.
  • yap: yank around paragraph.
  • dd: delete line.
  • yy: yank line.
  • p: paste after the cursor.
  • P: paste before the cursor.

Searching

Built-in search:

  • /text: search forward.
  • ?text: search backward.
  • n: next match.
  • N: previous match.
  • <Esc>: clear search highlighting in this config.

Project search with Telescope:

  • <space>sg: live grep in the current project.
  • <space>sw: search for the word under the cursor.
  • <space>/: fuzzy search inside the current buffer.
  • <space>s/: search inside open files.

Help

Neovim help is part of the editor and is worth using.

Useful commands:

:help
:help user-manual
:help motion
:help windows
:help lua-guide
:help diagnostic
:help lsp

This config makes help easier to search with <space>sh.