tbarreto

Workstation cheat sheet

Neovim and tmux commands used in daily development. Search by shortcut, action, description, or an approximate spelling.

141 shortcuts
10

Modes and getting unstuck

Neovim

Return to Normal mode before issuing a command.

Esc
Return to Normal mode
The reset key when the editor behaves unexpectedly.modeescapenormal
Any
i
Insert before the cursor
Start typing at the current character.inserttypewrite
Normal
a
Insert after the cursor
Start typing after the current character.appendinserttype
Normal
I
Insert at line start
Start at the first non-blank character.insertlinestart
Normal
A
Append at line end
Move to the end and enter Insert mode.appendinsertline
Normal
o
Open a line below
Create a line below and enter Insert mode.linebelowinsert
Normal
O
Open a line above
Create a line above and enter Insert mode.lineaboveinsert
Normal
:
Enter Command-line mode
Run commands such as :edit, :help, and :quit.commandexcolon
Normal
20

Movement and line jumps

Neovim

Motions navigate text and also describe ranges for operators.

hjkl
Move left, down, up, or right
The basic character and line motions.movementnavigatecursor
Normal
5j5k
Move N lines down or up
Replace 5 with any count. Relative line numbers show nearby counts.movementcountline
Normal
wbe
Move by words
Move to the next word start, previous word start, or word end.movementwordnext
Normal
WBE
Move by whitespace-separated WORDs
Uppercase word motions ignore punctuation boundaries.movementwordwhitespace
Normal
0^$
Move within the line
Go to column zero, first non-blank character, or line end.movementlinestart
Normal
fcharacter
Jump onto a character
Find the next chosen character on the current line.findcharacterline
Normal
tcharacter
Jump before a character
Stop one character before the next chosen character.findcharacterline
Normal
;,
Repeat or reverse a character jump
Repeat the latest f, F, t, or T motion.repeatfindcharacter
Normal
%
Jump to the matching pair
Move between matching parentheses, brackets, or braces.matchingbracketbrace
Normal
{}
Move by paragraphs
Move to the previous or next blank-line-separated block.paragraphblockmovement
Normal
ggG
Jump to the first or last line
Use gg for the top and G for the bottom.filetopbottom
Normal
25G25gg:25
Jump to line N
Replace 25 with the destination line number.linenumbergoto
Normal
Ctrl-oCtrl-i
Move through jump history
Return to older or newer locations after definitions and searches.jumphistoryback
Normal
HML
Move to screen top, middle, or bottom
Move within the visible viewport.screenviewporttop
Normal
Ctrl-dCtrl-u
Scroll half a page down or up
Fast scrolling that keeps nearby context visible.scrollpagedown
Normal
Ctrl-fCtrl-b
Scroll a full page forward or backward
Move one screen at a time.scrollpageforward
Normal
zzztzb
Place the cursor line in the viewport
Center it, move it to the top, or move it to the bottom.scrollcenterviewport
Normal
30

Search and project find

Neovim

Search one file, project text, and quickfix results.

/patternEnter
Search forward
Search is case-insensitive until the pattern contains uppercase letters.searchfindforward
Normal
?patternEnter
Search backward
Use the same search history in the reverse direction.searchfindbackward
Normal
nN
Move between search matches
n follows the search direction; N reverses it.searchnextprevious
Normal
*#
Search for the word under the cursor
Search forward with * or backward with #.searchwordcursor
Normal
:nohEnter
Clear search highlighting
The search pattern remains available to n and N.searchhighlightclear
Command
Space/
Search project text
Type a pattern after :grep and press Enter.projectgrepworkspace
Custom
Spaceq
Open search results
Display the quickfix list populated by project search.quickfixresultssearch
Custom
:cnext:cprevious
Move through quickfix results
Open the next or previous result.quickfixnextprevious
Command
40

Editing and repetition

Neovim

Operators become powerful when paired with motions and text objects.

xX
Delete a character
x deletes under the cursor; X deletes before it.deletecharacterremove
Normal
rcharacter
Replace one character
Replace in place and stay in Normal mode.replacecharacter
Normal
R
Enter Replace mode
Typed characters overwrite text until Esc.replaceoverwritemode
Normal
dmotion
Delete through a motion
Examples include dw, d$, dG, and di".deleteoperatormotion
Normal
ddD
Delete a line or to line end
dd removes the line; D removes from the cursor through the end.deletelineend
Normal
cmotion
Change through a motion
Delete the target and enter Insert mode.changeoperatormotion
Normal
ccC
Change a line or to line end
cc changes the line; C changes from the cursor through the end.changelineend
Normal
sS
Substitute a character or line
Delete the target and enter Insert mode.substitutechangecharacter
Normal
J
Join the next line
Place the next line after the current one.joinline
Normal
~
Toggle character case
Switch uppercase to lowercase and vice versa.caseuppercaselowercase
Normal
>><<
Indent or unindent a line
Counts work: 3>> indents three lines.indentunindentline
Normal
==
Reindent the current line
Use = with a motion or selection for a larger range.formatindentline
Normal
:s/old/new/g
Replace matches on the current line
Remove g to replace only the first match.replacesubstitutesearch
Command
:%s/old/new/gc
Replace throughout the file
Remove c when every match should change without confirmation.replacesubstitutefile
Command
.
Repeat the latest change
Reapply the edit at a new location.repeatchangedot
Normal
uCtrl-r
Undo or redo
Walk backward or forward through change history.undoredohistory
Normal
qacommandsq
Record a macro in register a
Replay it with @a. Use @@ to repeat the latest macro.macrorecordreplay
Normal
50

Copy, registers, selection, and text objects

Neovim

Yank into registers, select visually, or target semantic structures.

ymotion
Yank through a motion
Yank means copy. For example, yw copies through a word motion.copyyankoperator
Normal
yy
Yank the current line
The line is copied internally; the screen does not change.copyyankline
Normal
pP
Paste after or before
Linewise text is pasted below with p or above with P.pasteputregister
Normal
"+yy"+p
Copy to or paste from macOS
The + register connects Neovim to the system clipboard.clipboardmacoscopy
Normal
"0p
Paste the latest yank
Register 0 survives when a later delete replaces the default register.registeryankpaste
Normal
"ayy"ap
Use named register a
Registers a through z hold copied text for later use.registernamedcopy
Normal
:registers
Inspect registers
Show copied, deleted, and named register contents.registerinspectclipboard
Command
vVCtrl-v
Start a Visual selection
Select by character, whole line, or rectangular block.visualselectblock
Normal
o
Move to the other selection end
Switch which end the next motion extends.visualselectionendpoint
Visual
gv
Reselect the latest Visual selection
Return to the previously selected area.visualselectionrepeat
Normal
ydc
Copy, delete, or change a selection
c enters Insert mode after removing the selected text.visualcopydelete
Visual
p
Replace a selection with a register
Paste copied text over the selected area.visualpastereplace
Visual
><=
Indent or reindent a selection
Use gv to reselect it afterward.visualindentformat
Visual
Uu~
Change selection case
Uppercase, lowercase, or toggle every selected character.visualcaseuppercase
Visual
ItypeEsc
Insert on every block line
Start with Ctrl-v. A appends at every selected line end.visualblockinsert
Block
iwaw
Target inner or around word
Use after d, c, y, or v. Around includes surrounding whitespace.text objectwordinner
Object
iWaW
Target inner or around WORD
WORD objects extend to whitespace instead of punctuation.text objectwordwhitespace
Object
i"a"
Target inside or around double quotes
Inner keeps the quotes; around includes them.text objectquotedouble
Object
i'a'
Target inside or around single quotes
Use after delete, change, yank, or Visual selection.text objectquotesingle
Object
i(a(i{a{i[a[
Target paired delimiters
Target parentheses, braces, or brackets, with or without the pair.text objectparenthesisbrace
Object
itat
Target inside or around a tag
Useful in HTML, XML, JSX, and TSX.text objecttaghtml
Object
ipap
Target inner or around paragraph
Around includes the paragraph separator.text objectparagraphblock
Object
60

Files, buffers, windows, and code

Neovim

A buffer holds text; a window displays a buffer.

:editpath
Open a file in the current window
The current buffer changes; no new window is created.fileopenedit
Command
gf
Open the filename under the cursor
Useful for paths in imports, logs, and documentation.fileopenpath
Normal
:vsplitpath
Open a file in a right split
The personal configuration places vertical splits on the right.filewindowsplit
Command
:splitpath
Open a file in a lower split
The personal configuration places horizontal splits below.filewindowsplit
Command
:vnewpath
Open a path in a new right split
A missing path becomes a file when written. :new opens below.filenewcreate
Command
Spacef
Find a file
Type a project-relative path or pattern after :find.filefindproject
Custom
:ls
List open buffers
Each entry has a buffer number and filename.bufferlistopen
Command
Spaceb
Switch buffers
Enter a buffer number or name after :buffer.bufferswitchopen
Custom
:bdelete
Remove the current buffer
The file remains on disk. Neovim refuses to discard unsaved changes.bufferclosedelete
Command
:b#Ctrl-6
Switch to the alternate buffer
Toggle between the current and previous buffer.bufferalternateprevious
Command
Ctrl-hCtrl-jCtrl-kCtrl-l
Move between windows
Move left, down, up, or right. These mappings also work in Netrw.windowfocusnavigate
Custom
:close
Close the current window
The buffer may remain open elsewhere.windowclose
Command
:only
Close every other window
Keep only the current window visible.windowcloseonly
Command
:write
Write the current buffer
Auto-save normally writes completed edits, but this forces it immediately.savewritefile
Command
:quit:qa
Exit one or every window
Neovim refuses if the action would discard unsaved work.quitexitwindow
Command
gdgD
Go to a definition or declaration
These mappings become language-aware after an LSP server attaches.lspdefinitiondeclaration
LSP
K
Show symbol documentation
Display hover information from the attached language server.lsphoverdocumentation
LSP
grrgrngra
References, rename, and code actions
Use language-aware symbol operations from the attached server.lspreferencerename
LSP
]d[d
Move between diagnostics
Navigate errors, warnings, and other diagnostics.lspdiagnosticerror
LSP
Spacecf
Format the current buffer
Use the attached language server formatter.lspformatbuffer
LSP
Ctrl-xCtrl-o
Request completion
Use in Insert mode when completion does not trigger automatically.lspcompletionautocomplete
Insert
:helptopic
Open local help
For example: :help text-objects.helpdocumentationmanual
Command
Ctrl-]Ctrl-t
Follow a help tag or return
Navigate links inside Neovim help without leaving the editor.helptaglink
Help
70

Filesystem view: Netrw

Neovim

Netrw is a special buffer and overrides several Normal-mode keys.

Spacee
Toggle the filesystem sidebar
Run the built-in :Lexplore command.filesystemexplorersidebar
Custom
jk
Move through entries
Use the same vertical movement as an ordinary buffer.filesystementrynavigate
Netrw
Enter
Open a file or expand a folder
Press Enter again on an expanded folder to collapse it.filesystemopenfolder
Netrw
gn
Make a folder the tree root
Show the selected folder as the top of the view.filesystemfolderroot
Netrw
-
Move to the parent folder
Move the filesystem view one directory upward.filesystemparentfolder
Netrw
gh
Show or hide dotfiles
Toggle entries such as .gitignore and .config.filesystemhiddendotfile
Netrw
v
Open the selected file in a vertical split
This key does not start Visual mode inside Netrw.filesystemfilesplit
Netrw
o
Open the selected item in a horizontal split
This key does not open a new line inside Netrw.filesystemfilesplit
Netrw
%
Create a file
Type the new filename when prompted.filesystemfilecreate
Netrw
d
Create a directory
Type the directory name when prompted.filesystemdirectoryfolder
Netrw
R
Rename the selected item
Netrw prompts for the new name.filesystemrenamefile
Netrw
D
Delete the selected item
Confirm the target carefully before deleting it from disk.filesystemdeleteremove
Netrw
/nameEnter
Search displayed entries
Use n and N for matches, then :noh to clear highlighting.filesystemsearchfile
Netrw
80

tmux window lifecycle and ordering

tmux

The prefix is Ctrl-b. The personal configuration starts windows in the current pane directory.

Ctrl-bc
Create a window
Open a new window in the current pane's directory.tmuxwindowcreate
Prefix
Ctrl-b&
Delete the current window
tmux asks for confirmation before killing it.tmuxwindowdelete
Prefix
Ctrl-b,
Rename the current window
Type the new name and press Enter.tmuxwindowrename
Prefix
Ctrl-b<l
Move the current window left
Open the window menu and choose Swap Left.tmuxwindowmove
Prefix
Ctrl-b<r
Move the current window right
Open the window menu and choose Swap Right.tmuxwindowmove
Prefix
Ctrl-b.
Move the window to an index
Type the destination number shown in the status bar.tmuxwindowmove
Prefix
Ctrl-bnp
Select the next or previous window
Cycle through windows in status-bar order.tmuxwindownext
Prefix
Ctrl-b1…9
Select a numbered window
Press the number displayed in the status bar.tmuxwindownumber
Prefix
Ctrl-bw
Open the window tree
Choose a window from an interactive list.tmuxwindowtree
Prefix
90

tmux pane layout and focus

tmux

Splits inherit the current pane directory in the personal configuration.

Ctrl-b%
Split a pane to the right
Create a horizontal layout split in the current directory.tmuxpanesplit
Prefix
Ctrl-b"
Split a pane below
Create a vertical layout split in the current directory.tmuxpanesplit
Prefix
Ctrl-bArrow
Focus a pane by direction
Use an arrow key to move to the adjacent pane.tmuxpanefocus
Prefix
Ctrl-bo
Focus the next pane
Cycle through panes in the current window.tmuxpanenext
Prefix
Ctrl-b;
Return to the previous pane
Toggle back to the last active pane.tmuxpaneprevious
Prefix
Ctrl-bx
Delete the current pane
tmux asks for confirmation before killing it.tmuxpanedelete
Prefix
Ctrl-bz
Zoom or unzoom the current pane
Temporarily make one pane fill the window.tmuxpanezoom
Prefix
Ctrl-bq
Show pane numbers
Press a displayed number to focus that pane.tmuxpanenumber
Prefix
Ctrl-b!
Turn the pane into a window
Break the current pane out into its own window.tmuxpanewindow
Prefix
100

tmux sessions

tmux

Detach from work without stopping the programs inside it.

Ctrl-bd
Detach from the session
The session and its programs keep running in the background.tmuxsessiondetach
Prefix
Ctrl-bs
Open the session tree
Choose another session interactively.tmuxsessiontree
Prefix
Ctrl-b()
Select the previous or next session
Cycle through sessions without opening the tree.tmuxsessionnext
Prefix
tmux new -s name
Create a named session
Start a new session with a memorable name.tmuxsessioncreate
Shell
tmux attach -t name
Attach to a session
Reconnect to an existing named session.tmuxsessionattach
Shell
tmux ls
List sessions
Show running tmux sessions.tmuxsessionlist
Shell
tmux kill-session -t name
Delete a session
Stop the named session and every process still running inside it.tmuxsessiondelete
Shell
110

Command patterns

Shared

Neovim commands form a small grammar instead of a flat list.

countcommand
Repeat or target with a number
5j moves five lines, 2dd deletes two lines, and 25G targets line 25.grammarcountnumber
Pattern
operatormotion
Apply an action across movement
dw deletes through a word, c$ changes to line end, and yG copies to file end.grammaroperatormotion
Pattern
operatori/aobject
Target semantic text
ciw changes inside a word; da" deletes quotes and their contents.grammartext objectinner
Pattern
operatoroperator
Apply an operator to the line
dd deletes, cc changes, yy copies, and >> indents the current line.grammarlineoperator
Pattern
ia
Choose inner or around
Inner keeps delimiters; around includes them.grammarinneraround
Pattern
.n;@@
Repeat the latest intent
Repeat a change, search, character jump, or macro with its matching command.grammarrepeatchange
Pattern
"registercommand
Choose a register
Direct copied or deleted text to the system, yank, or named register.grammarregisterclipboard
Pattern
bufferwindowfile
Keep the three concepts separate
A file is on disk, a buffer holds text, and a window displays a buffer.conceptbufferwindow
Pattern

Page keyboard commands

These commands navigate the page. Neovim and tmux commands remain the page content.

jk
Move one shortcut down or up.
5j5k
Move by a counted number of shortcuts.
hl
Move to the previous or next section.
80G80gg
Jump to a numbered section.
ggG
Jump to the first or last shortcut.
Ctrl-dCtrl-u
Scroll half a viewport down or up.
/
Focus fuzzy shortcut search.
nN
Move to the next or previous search result.
0$
Move to the first or last shortcut in a section.
Esc
Clear search or active navigation state.