Skip to content
~/vim-&-nano-cheat-sheet
$

Vim & Nano Cheat Sheet

Interactive keyboard shortcut reference for Vim and Nano. Toggle between editors, search shortcuts, and browse by category.

🧭Normal Mode - Navigation(18)

h

Move cursor left

j

Move cursor down

k

Move cursor up

l

Move cursor right

w

Jump forward to start of next word

b

Jump backward to start of word

e

Jump forward to end of word

0

Jump to start of line

$

Jump to end of line

gg

Go to first line of document

G

Go to last line of document

Ctrl+d

Scroll half-page down

Ctrl+u

Scroll half-page up

}

Jump to next paragraph/block

{

Jump to previous paragraph/block

%

Jump to matching bracket

f{char}

Jump forward to character on current line

F{char}

Jump backward to character on current line

✏️Normal Mode - Editing(14)

i

Insert before cursor

a

Insert after cursor

o

Open new line below and enter insert mode

O

Open new line above and enter insert mode

x

Delete character under cursor

dd

Delete (cut) entire line

yy

Yank (copy) entire line

p

Paste after cursor

P

Paste before cursor

u

Undo last change

Ctrl+r

Redo last undone change

.

Repeat last command

J

Join current line with line below

~

Toggle case of character under cursor

🔍Normal Mode - Search(6)

/pattern

Search forward for pattern

?pattern

Search backward for pattern

n

Jump to next search match

N

Jump to previous search match

*

Search forward for word under cursor

#

Search backward for word under cursor

🎯Visual Mode(8)

v

Start character-wise visual selection

V

Start line-wise visual selection

Ctrl+v

Start block (column) visual selection

d

Delete selected text

y

Yank (copy) selected text

>

Indent selected text right

<

Indent selected text left

~

Toggle case of selected text

💻Command Mode(10)

:w

Save (write) file

:q

Quit editor

:wq

Save and quit

:q!

Quit without saving (force)

:e{file}

Open file for editing

:%s/old/new/g

Replace all occurrences in file

:setnumber

Show line numbers

:split

Horizontal split window

:vsplit

Vertical split window

:tabnew

Open new tab

📋Registers & Macros(5)

"ay

Yank into register "a"

"ap

Paste from register "a"

qa...q

Record macro into register "a" (qa to start, q to stop)

@a

Execute macro stored in register "a"

@@

Re-run last executed macro

🪟Window Management(8)

Ctrl+ws

Split window horizontally

Ctrl+wv

Split window vertically

Ctrl+ww

Cycle through windows

Ctrl+wh

Move to left window

Ctrl+wj

Move to window below

Ctrl+wk

Move to window above

Ctrl+wl

Move to right window

Ctrl+wq

Close current window

📦Text Objects(8)

iw

Inner word (select word without surrounding spaces)

aw

A word (select word with surrounding space)

i"

Inner double-quoted string

a"

A double-quoted string (including quotes)

i(

Inner parentheses content

a(

A parenthesized block (including parens)

it

Inner tag (content between HTML/XML tags)

at

A tag block (including tags)

Why Learn Vim and Nano?

Vim and Nano are terminal-based text editors available on virtually every Linux and macOS system. When you SSH into a remote server with no GUI, these editors are often your only option for editing configuration files, scripts, and code.

How This Reference Works

Toggle between Vim and Nano to see shortcuts for each editor. Search by key combination or description, and browse by category — navigation, editing, search, and more. Keyboard badges show the exact keys to press.

Getting Started with Terminal Editors

Nano is beginner-friendly with on-screen key hints, while Vim offers powerful modal editing for speed once you learn it. This reference helps bridge the learning curve for both editors.