neovim tmux macOS tools

Text Objects

iw / awinner word / a word
is / asinner sentence / a sentence
ip / apinner paragraph / a paragraph
i) / a)inner parens / a parens
i' / a'inner single quotes / a single quotes
i" / a"inner double quotes / a double quotes
it / atinner tag / a tag
ihinner diff hunk
il / alinner line / a line
iB / aBinner buffer / a buffer
iI / aIinner indent / a indent
iN / aNinner number / a number
iD / aDinner diagnostic / a diagnostic
if / afinner function call / a function call
ia / aainner argument / a argument
iq / aqinner quote (any) / a quote (any)

Operator Examples

d[jk]delete down/up a line
dt)delete until next closing )
d/railsdelete until the word rails
ci"change inside "
[c|d|y]wchange/delete/yank word
[c|d|y]i"change/delete/yank inside "
vi"pvisual select inside " and paste

Surround

cs])change surrounding [] to ()
ds]delete surrounding []
ysi[w|l]"insert " around word/line
S"wrap visual selection with "

Treesitter

gristart incremental selection
grnincrement select node
grpdecrement select node
grsincrement select scope

Spelling

z=suggest
zglearn word
zwmark word misspelled

Comment

[count]gcccomment line(s)
gc[O|o]comment line above / below
gcAcomment end of line
gc[count]{motion}comment with motion

Folds

zatoggle open/close fold
zRopen all folds

Recording

qqstart recording into q
@qplay q recording

Motions / Movements

[f|F]<char>find char and jump to it
[t|T]<char>find char and jump until it
w / bjump by word forward / backward
[shift]-/search up / down
N / nrepeat search forward / backwards
# / *search back / forward for cursor word
<leader>nremove highlight
ctrl-o / ctrl-igo back to before / after
^first non-blank char of line
$end of line
0beginning of line
ggfirst line in buffer
Glast line in buffer
H / M / Lhigh / middle / low of window
ctrl-d / ctrl-uscroll down / up half screens
zzcenter current line

Operators

ddelete
yyank
cchange
> / <indent / dedent
=reformat
~toggle case
gqformat lines to textwidth
gssort selection
ga=align selection on = sign

Basic Usage

][bcycle buffers
.repeat last motion/command
ZZwrite file and exit
ZQexit without writing file
i / Iinsert before cursor / beginning of line
x / Xdelete char after / before cursor
r / Rreplace char / overwrite chars
Ddelete cursor to end of line
a / Ainsert after cursor / end of line
o / Onew line below / above cursor

Menus

glLSP
gdDiagnostics
<leader>ttesting menu
<leader>hgit hunks menu
<leader>ddebug / diagnostic menu
<leader>aAI menu
ctrl-fSnacks menu

AI

<leader>aa / ctrl-/toggle AI
ctrl-binsert buffers
ctrl-finsert files
ctrl-pprompt
ctrl-qstop insert / quit

Terminal

ctrl-\toggle a terminal
ctrl-]escape to normal mode

LSP

glmain menu
Khover info (K into float, q close)
ctrl-]go definition → symbol → c-tag

Pickers

ctrl-nfile tree
<leader>ffind file mode
<leader>slive grep mode
ctrl-lscope folder(s)
ctrl-fscope file extension
<leader>wgrep cursor word
ctrl-f hhelp
ctrl-f kkey mappings
ctrl-f ccommands
ctrl-rcommand history (cmd mode)
ctrl-p / ctrl-nprevious / next
ctrl-u / ctrl-dup / down in preview
returnopen result
ctrl-vopen in vertical split
ctrl-xopen in horizontal split
ctrl-topen in tab
ctrl-gtoggle fuzzy / live grep
ctrl-qsend to quickfix
[shift] tabtoggle selection up/down

Search & Replace

Within quickfix/loclist. cdo per line entry, cfdo per file (use % for whole file).

cdo s/\vfoo/bar/g | writereplace per line
cfdo %s/\vfoo/bar/g | writereplace per file
cfdo writewrite all files
cfdo normal undoundo last change

\v non-vim regex g multi-match c confirm () groups with \1 \2

Quickfix / Loclist

<leader>qtoggle quickfix list
<leader>ltoggle location list
tabmark/sign an item
z tabclear marks/signs
zn / zNnew qf signed / non-signed
zffuzzy find qf list
< / >cycle between qf lists

Completion

ctrl-p / ctrl-nprevious / next
ctrl-u / ctrl-dup / down in docs
ctrl-yconfirm selection
ctrl-eabort completion
ctrl-spacetrigger completion

Snippets

tabprev / next / trigger jumpable
ctrl-p / ctrl-n / ctrl-uprev / next / ui choice(s)

Git Hunks (<leader>h)

<leader>hnnext hunk
<leader>hpprevious hunk
<leader>hsstage hunk
<leader>hrreset hunk
<leader>hbstage buffer
<leader>hRreset buffer
<leader>hhblame line float
<leader>hFtoggle current line blame
<leader>hdtdiff this
<leader>hdodiff this (other)
<leader>httoggle deleted
<leader>hipreview hunk float
<leader>hIpreview hunk inline
<leader>hlhunks to loclist

Vimdiff (git mergetool)

ggldiff get local (right)
dgudiff get upstream (left)
]mnext conflict

Kaleidoscope (mergetool --gui)

cmd-[left|right]accept arrow side
cmd-alt-[left|right]accept both, arrow first
cmd-[up|down]cycle changes