Neovim#

Neovim (nvim) is the modal terminal editor that ships with built-in LSP, Tree-sitter, terminal, floating windows, and a Lua scripting runtime. Bindings are Vim-compatible by default, so every motion / verb / textobject that works in classic Vim works here; the additions are Neovim-only features (terminal mode, :Telescope-style pickers via plugins, the built-in LSP keymap, and Lua vim.keymap.set for user bindings).

For startup files, plugin managers (lazy.nvim, packer.nvim), and the difference from Vim, see Neovim (if present) or the upstream docs.

Modes#

Key

Action

Esc / Ctrl-[

return to normal mode

i

insert before cursor

a

insert after cursor (append)

I

insert at start of line (first non-blank)

A

insert at end of line

o

open new line below, enter insert

O

open new line above, enter insert

R

enter replace mode (overtype)

v

enter character-wise visual

V

enter line-wise visual

Ctrl-v

enter block (column) visual

gv

reselect last visual region

:

enter command-line mode

/ / ?

enter search forward / backward

Ctrl-\\ Ctrl-n

return to normal mode from terminal mode

Movement#

Key

Action

h / j / k / l

left / down / up / right

w / b / e

next word start / prev word start / word end

W / B / E

WORD variants (whitespace-delimited)

ge

previous word end

0 / ^ / $

start / first non-blank / end of line

g_

last non-blank on line

f<c> / F<c>

find next / previous c on line

t<c> / T<c>

till next / previous c

; / ,

repeat last f / t (same / opposite direction)

gg

go to file start

G

go to file end

<n>G / <n>gg

go to line N

:<n>

go to line N (command form)

H / M / L

top / middle / bottom of screen

Ctrl-d / Ctrl-u

half-page down / up

Ctrl-f / Ctrl-b

full-page down / up

%

jump to matching (), [], {}

* / #

search forward / backward for word under cursor

Ctrl-o / Ctrl-i

jump backward / forward through jumplist

g; / g,

previous / next change in changelist

'' / `` ` ` ``

jump to mark (line / exact position)

m<a-z>

set mark in current buffer

m<A-Z>

set global mark across buffers

Editing#

Key

Action

x / X

delete char under / before cursor

s / S

substitute char / whole line (enter insert)

r<c>

replace single char with c

d<motion>

delete over motion (dw, d$, dgg)

dd

delete whole line

D

delete to end of line

c<motion>

change over motion (cw, c$)

cc

change whole line

C

change to end of line

y<motion>

yank over motion

yy

yank whole line

Y

yank to end of line

p / P

paste after / before cursor

"<reg>

prefix to choose a register (e.g. "+y yank to system clipboard)

u

undo

Ctrl-r

redo

U

undo every change on current line

.

repeat last change

J

join line below into current

gJ

join without inserting whitespace

~

toggle case of char under cursor

g~<motion>

toggle case over motion

gu<motion> / gU<motion>

lowercase / uppercase over motion

>> / <<

indent / dedent current line

>i{ / <i{

indent / dedent inside a code block

= / ==

reindent over motion / current line

Ctrl-a / Ctrl-x

increment / decrement number under cursor

Textobjects#

Combine with verbs: daw deletes a word with surrounding whitespace, ci( changes inside parens, yi" yanks inside a string.

Key (after verb)

Action

iw / aw

inside / around word

iW / aW

inside / around WORD

is / as

inside / around sentence

ip / ap

inside / around paragraph

i( / a(

inside / around parens (same as i) / a))

i[ / a[

inside / around brackets

i{ / a{

inside / around braces

i< / a<

inside / around angle brackets

i" / a"

inside / around double-quoted string

i' / a'

inside / around single-quoted string

i + backtick / a + backtick

inside / around backtick string

it / at

inside / around XML / HTML tag

Visual Mode#

After entering v / V / Ctrl-v, motions extend the selection; verbs act on it.

Key

Action

o / O

move to other end of selection (toggle anchor)

aw / ip etc.

grow selection to textobject

d

delete selection

c

change selection

y

yank selection

> / <

shift right / left

u / U

lowercase / uppercase selection

~

toggle case of selection

:s/old/new/

substitute within selection

I<text> (in block-visual)

insert text at start of every selected line

A<text> (in block-visual)

append text at end of every selected line

Esc

exit visual mode

Search and Replace#

Key

Action

/<pat>

search forward

?<pat>

search backward

n / N

next / previous match

* / #

search forward / backward for word under cursor

g* / g#

same as * / # without word boundaries

:noh

clear search highlight

:s/old/new/

substitute first match on current line

:s/old/new/g

substitute every match on current line

:%s/old/new/g

substitute every match in the buffer

:%s/old/new/gc

same, but confirm each replacement

:g/pat/d

delete every line matching pat

:v/pat/d

delete every line not matching pat

Windows / Splits / Tabs#

Key

Action

Ctrl-w s / :split

horizontal split

Ctrl-w v / :vsplit

vertical split

Ctrl-w h / j / k / l

focus split left / down / up / right

Ctrl-w H / J / K / L

move current window left / down / up / right

Ctrl-w w

cycle through splits

Ctrl-w o

close every split except current

Ctrl-w q / :q

close current split

Ctrl-w =

equalize sizes

Ctrl-w _

maximize current split’s height

Ctrl-w |

maximize current split’s width

Ctrl-w + / -

taller / shorter

Ctrl-w > / <

wider / narrower

:tabnew <file>

new tab

gt / gT

next / previous tab

<n>gt

jump to tab N

:tabclose

close current tab

Buffers#

Command

Action

:e <file> / :edit <file>

open file in current window

:enew

new empty buffer

:ls / :buffers

list buffers

:b <name> / :b <n>

switch to buffer by name or number

:bn / :bp

next / previous buffer

:bd

delete (close) current buffer

:bd!

force-close without saving

Ctrl-^ / Ctrl-6

swap to alternate buffer

:w

write current buffer

:w <file>

write to a different file

:wa

write all

:wq

write and quit

:q!

quit, discarding changes

LSP (Built-in)#

Neovim’s built-in LSP client. :LspInfo shows attached servers. Default bindings are sparse; most distributions (LazyVim, AstroNvim, NvChad, kickstart.nvim) set up the gd / K / gr family on LspAttach.

Key / Command

Action

K

hover (signature + docs)

gd

goto definition (when bound; default in nightly)

gD

goto declaration

gi

goto implementation

gy

goto type definition

gr

list references

Ctrl-]

alternate goto-definition binding (tags / LSP)

Ctrl-t

jump back from tag / definition

[d / ]d

previous / next diagnostic

<leader>ca

LSP code action (common mapping)

<leader>rn

LSP rename (common mapping)

<leader>f

format buffer (common mapping)

:LspInfo

show attached servers / capabilities

:LspRestart

restart language server

:LspLog

open LSP log

Terminal Mode#

Neovim ships a built-in terminal emulator.

Key / Command

Action

:terminal

open terminal in current window

:split | terminal

terminal in horizontal split

Ctrl-\\ Ctrl-n

exit terminal mode (go to normal mode)

:q

close terminal buffer

i

re-enter terminal mode (from normal mode)

Ctrl-w :

command-line from terminal mode (rebind common)

Folds#

Key

Action

zf<motion>

create fold over motion

zo

open fold under cursor

zO

open fold and every nested fold under cursor

zc

close fold under cursor

zC

close fold and every nested fold

za

toggle fold under cursor

zR

open all folds in buffer

zM

close all folds in buffer

zj / zk

next / previous fold

zd

delete fold under cursor

zE

eliminate every manually-created fold

Macros and Registers#

Key

Action

q<reg>

start recording macro into register <reg>

q

stop recording

@<reg>

replay macro stored in <reg>

@@

replay last-run macro

<n>@<reg>

replay macro N times

"<reg>y / p

yank to / paste from register

"+y / "+p

yank / paste through system clipboard (+ register)

"*y / "*p

yank / paste through X11 PRIMARY (* register)

"0p

paste last yank (skipping the delete register)

:reg

print every register

Ctrl-r <reg> (insert mode)

paste from register at cursor

Command Line (:)#

Command

Action

:w

write

:wa

write all

:q / :q!

quit / force-quit

:wq / :x

write + quit

:qa

quit all (fails on unsaved)

:qa!

force-quit all

:e <file>

open file

:e!

reload buffer, discard unsaved changes

:set <opt> / :set no<opt>

enable / disable option

:set <opt>?

print current value

:setlocal

buffer-local option

:source <file>

read commands from a vim / lua file

:luafile <file>

read commands from a Lua file

:help <topic>

open help

:checkhealth

run health checks (Neovim’s own diagnostic)

:messages

show recent messages

Discovery#

Command

Action

nvim --version

print Neovim version + build features

nvim --clean

launch without user config / plugins

nvim -u NONE

launch with no init file

vimtutor

bundled 30-minute interactive tutorial

:help index

master index of every key in normal mode

:help vim-modes

mode reference

:checkhealth

environment / provider checks

:Lazy (if installed)

lazy.nvim plugin UI

:LspInfo

attached LSP servers

:Telescope (if installed)

common picker plugin

~/.config/nvim/init.lua

default Lua-based init file

~/.config/nvim/init.vim

legacy Vimscript init file