Skip to content

Instantly share code, notes, and snippets.

@j1cs
Last active August 30, 2025 02:42
Show Gist options
  • Select an option

  • Save j1cs/00d00d79114bc741b28dbb51a44da516 to your computer and use it in GitHub Desktop.

Select an option

Save j1cs/00d00d79114bc741b28dbb51a44da516 to your computer and use it in GitHub Desktop.
Lazyvim notes

Vim Motions & Operators Cheat-Sheet

1. Basic Cursor Movement

Action Command
Left h
Down j
Up k
Right l
Start of line 0
First non-blank of line ^
End of line $
Column N |N
Middle of screen line gm
Top of file gg
Bottom of file G
Top of screen H
Middle of screen M
Bottom of screen L

2. Word Motions

Action Command
Move to next word w
Move to end of word e
Move to previous word b
Move to next WORD (whitespace-delimited) W
Move to end of WORD E
Move to previous WORD B

3. Paragraph & Sentence Motions

Action Command
Next sentence )
Previous sentence (
Next paragraph }
Previous paragraph {

4. Search & Repeat

Action Command
Search forward /pattern
Search backward ?pattern
Repeat forward n
Repeat backward N
Find char forward f
Till char forward t
Find char backward F
Till char backward T
Repeat last find ;
Repeat opposite dir ,
Delete lines by matching :g/http/d
Delete all do not match :v/http/d

5. Text Objects

Text objects do not move the cursor on their own—you must combine them with an operator (d, c, y, >, <, etc.)

Object Inner (i…) Around (a…)
word iw aw
WORD (big-word) iW aW
sentence is as
paragraph ip ap
block (any B) iB or ib aB or ab
parentheses ( ) i( or i) a( or a)
brackets [ ] i[ or i] a[ or a]
braces { } i{ or i} a{ or a}
single-quotes i' a'
double-quotes i" a"

6. Operators (combine with motions or text objects)

Operator Description
d{motion} Delete up to motion
c{motion} Change (delete + enter Insert mode)
y{motion} Yank (copy) up to motion
>{motion} Indent selection
<{motion} Un-indent selection
g~{motion} Swap case
gu{motion} Make lowercase
gU{motion} Make uppercase

7. Operator + Text-Object Examples

Example Effect
daw delete a word (including surrounding space)
diw delete inner word (just the word)
ciw change inner word → enter Insert mode
yaw yank a word (including any trailing space)
yip yank inner paragraph
>ap indent around paragraph

8. Marks, Jumps & Extended Motions

Action Command
Set mark m
Jump to mark (line) '
Jump to mark (exact position) `
Jumplist back Ctrl-O
Jumplist forward Ctrl-I
Jump to matching parenthesis/bracket/brace %
Search word under cursor forward *
Search word under cursor backward #
Partial-word search forward g*
Partial-word search backward g#
Jump through change-list (newer changes) g;
Jump through change-list (older changes) g,
Increment number under cursor Ctrl-a
Decrement number under cursor Ctrl-x

9. Macros & Registers

Action Command
Record macro into r q r
Stop recording q
Play macro r @r
Repeat last macro @@
Yank into register r " r y{motion}
Paste from register r " r p

10. Folding

Action Command
Close fold zc
Open fold zo
Fold more (deeper) zm
Fold less (shallower) zr
Close all folds zM
Open all folds zR
Toggle fold under cursor za
Toggle all under cursor zA
Toggle folding feature zi

11. Case Changes

Action Command
Toggle case under cursor ~
Swap case via motion g~{motion}
Lowercase via motion gu{motion}
Uppercase via motion gU{motion}
Lowercase entire line guu
Uppercase entire line gUU
Swap case on current char (repeat) g~~

12. Scrolling & Centering

Action Command
Half-page down Ctrl-d
Half-page up Ctrl-u
Center cursor on screen zz
Top of screen zt
Bottom of screen zb

13. Undo/Redo & Repeat

Action Command
Undo u
Redo Ctrl-r
Repeat last change .

14. Miscellaneous

Action Command
Save :w
Quit :q
Save & quit :wq or ZZ
Quit without saving :q! or ZQ
Search & replace in entire file :%s/old/new/g
Search & replace with confirmation :%s/old/new/gc
Auto-indent selection or motion =
Format whole file gg=G
Rename symbol cr
Start debug dc

15. Windows, Buffers & Tabs

Action Command
Split horizontally :split or :sp
Split vertically :vsplit or :vs
Move between windows Ctrl-W {h/j/k/l}
Open next buffer :bnext or :bn
Open previous buffer :bprev or :bp
List buffers :ls
Close buffer :bd
Next tab gt
Previous tab gT
Open new tab :tabnew
Sort key unique :sort u
Sort text asc :sort
Sort text desc :sort!
Add content to the buffer :read path
Add output command to the buffer :read !ls
Execute command select visual mode :'<,'>! jq .city

Other

description command
Show logs :MasonLog
show notifier errors :lua Snacks.notifier.show_history()
show hidden explorer and fuzzy { "folke/snacks.nvim",opts = {picker = { sources = {files = { hidden = true, ignored = true,},},hidden = true, ignored = true, },},},
restart lsp :LspRestart
load session current directory qs
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment