──────────────────────────────────────────────────────────────────────
Insert mode
──────────────────────────────────────────────────────────────────────
insert [i] ┄┄┐ ┌── [a] append
(left of cursor) ┆ ┆ (right of cursor)
┌─┐
Hello e│v│eryone. ┆
└─┘ └┄┄┄ [A] append
(end of line)
┌────────────────────┐
insert above [O] ┄┄┄┼┄┄ │
│ Here is text▓ │
insert below [o] ┄┄┄┼┄┄ │
└────────────────────┘
[esc] exit insert mode
──────────────────────────────────────────────────────────────────────
Navigating lines
──────────────────────────────────────────────────────────────────────
^ [^] start of text
0 ┆ $ [0] start of line, [$] end of line
┌│─┆───────────────────│─┐
│ This i┃s a nice line. │
└──│────────│─│──┆───────┘
b w ww ┆ [b]ack word, next [w]ord
┆ ┆
e ee [e]nd of next word
Compared to other editors:
Vim Windows MacOS
0 home cmd-left
$ end cmd-right
b ctrl-left opt-left
w ctrl-right opt-right
──────────────────────────────────────────────────────────────────────
Navigating pages
──────────────────────────────────────────────────────────────────────
┌────────────┐
start [gg] │ ━━━━━━━━ │ [ctrl-u] page up
of doc │ ━━━━━━ │ [ctrl-b] page back (half a page)
│ ━━━━━━┃ │
│ ━━━━ │ [ctrl-f] page forward (half a page)
end [G] │ ━━━━━━━ │ [ctrl-d] page down
of doc └────────────┘
Compared to other editors:
Vim Windows MacOS
gg ctrl-home home (fn-left)
g ctrl-end end (fn-right)
ctrl-u pgup pgup (fn-up)
ctrl-d pgdn pgdn (fn-down)
──────────────────────────────────────────────────────────────────────
Visual mode
──────────────────────────────────────────────────────────────────────
┌┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄ [v] select inline ("visual mode")
┌───────┳━┓ move the cursor to select more text
│Hello t┃h┃ere, world! [V] select block ("visual block mode")
└───────┻━┛
└┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄ [y] copy
[d] delete/cut
[c] change (delete then insert)
[p] paste text
Compared to other editors:
Vim Windows
v→→(esc) shift→→(release)
d ctrl-x
y ctrl-c
p ctrl-v
──────────────────────────────────────────────────────────────────────
Undo/redo
──────────────────────────────────────────────────────────────────────
[u] Undo [ctrl-r] redo
──────────────────────────────────────────────────────────────────────
Finding
──────────────────────────────────────────────────────────────────────
[/] find (regexp)
[23G] go to line 23 (or :23<enter>)
──────────────────────────────────────────────────────────────────────
Last active
March 16, 2023 05:18
-
-
Save rstacruz/5e7ca0b4bea79b0ac3641c6f8d8e448b to your computer and use it in GitHub Desktop.
Vim visual cheatsheet
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment