nx1.info | Vim Cheat Sheet
Basics: [^]
i - insert before cursor
I - insert at beginning of line
a - append after cursor
ea - insert at end of current word
A - append at end of line
O - open new line above cursor
o - open new line below cursor
ESC - return to normal mode
:w - write / save
:q - quit
:wq - write and quit
:q! - quit without saving
. - repeat last change
Navigation: [^]
h - left
j - down
k - up
l - right
w - jump forward to next word
b - jump backward to previous word
0 - beginning of line
^ - first non-blank character of line
$ - end of line
gg - go to beginning of file
G - go to end of file
:NUM - go to line NUM
% - jump between matching brackets / parentheses
Editing: [^]
x - delete character under cursor
dd - delete line
dw - delete word
D - delete to end of line
yy - yank (copy) line
p - paste after cursor
P - paste before cursor
u - undo
CTRL-r - redo
r - replace single character
Visual Mode: [^]
v - visual mode (character-wise)
V - visual line mode
CTRL-v - visual block mode
y - yank selection
d - delete selection
~ - toggle case
Search & Replace: [^]
/word - search forward for "word"
?word - search backward for "word"
n - next match
N - previous match
:%s/foo/bar/g - replace all foo with bar
:%s/foo/bar/gc - replace with confirmation
Cut & Paste: [^]
yy - copy line
2yy - copy 2 lines
yw - copy word under cursor
y$ - yank to end of line
Y - yank entire line
Deleting with motions & Text objects: [^]
daw - delete a word (and surrounding whitespace)
diw - delete inner word (no surrounding space)
dap - delete a paragraph
dip - delete inner paragraph
das - delete a sentence (includes punctuation)
dis - delete inner sentence
d} - delete until next paragraph
di( - delete inside parentheses
da( - delete around parentheses
di{ - delete inside curly braces
di[ - delete inside square brackets
vi( - visually select inside parentheses
va[ - visually select around square brackets
ci( - change inside parentheses
yi{ - yank inside curly braces
Jumping to start/end of blocks: [^]
[[ - jump to previous function start
]] - jump to next function start
[] - jump to previous block start (like { )
][ - jump to next block end (like } )
Buffers, Windows, Tabs: [^]
:ls or :buffers - list buffers
:bn - next buffer
:bp - previous buffer
:bd - delete buffer
:split or :sp - horizontal split
:vsplit or :vsp - vertical split
CTRL-w w - switch window
CTRL-w h/j/k/l - move to window
:tabnew - open new tab
gt - next tab
gT - previous tab
gqip - reformat paragraph (text object 'ip' = inner paragraph)
gqap - reformat paragraph (including surrounding blank lines)
gqq - reformat current line
gwip - reformat paragraph, preserving cursor
gwap - same as above but with surrounding blank lines
Macros: [^]
q[letter] - record macro to letter
qa - record macro to letter 'a'
q - stop recording macro
@a - run macro a
@@ - re-run last macro
CoC.nvim Commands
https://github.com/neoclide/coc.nvim
Code Navigation: [^]
gd - Go to definition
gD - Go to declaration
gi - Go to implementation
gr / gR - Show references (usages)
gy - Go to type definition
K - Show hover documentation
[ g - Go to previous diagnostic
] g - Go to next diagnostic
Code Actions: [^]
<leader>rn - Rename symbol (e.g., <space>rn)
<leader>ac - Code action for cursor position
<leader>a - Code action for selected region (visual mode)
<leader>f - Format current buffer
Completion & Snippets: [^]
<C-Space> - Trigger completion
<CR> - Confirm completion
<C-j> / <C-k> - Navigate completion menu
<C-n> / <C-p> - Next/Previous completion item
Misc & CocList: [^]
:CocList extensions - Show installed extensions
:CocList marketplace - Browse available extensions
:CocList diagnostics - Show diagnostics in a list
:CocList symbols - Show document symbols
:CocList symbols -I - Show workspace symbols
:CocList outline - Show document outline
:CocList references - Find references to symbol under cursor
:CocCommand - Run any CoC command
:CocRestart - Restart CoC
:CocUpdate - Update CoC extensions