Skip to content

Instantly share code, notes, and snippets.

@arlimus
Last active November 17, 2017 16:23
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save arlimus/2920972fe293f170ad1efd590d107e78 to your computer and use it in GitHub Desktop.
Save arlimus/2920972fe293f170ad1efd590d107e78 to your computer and use it in GitHub Desktop.
vim.essential.md
Personal most used commands in vim (VSCode, Atom, ... any editor really)
# motion.txt
y c d ... yank / change / delete
v V ... visual mode character-wise/Line-wise
< > ... indent and outdent
/ ? ... search forward or backwards,
eg "/word" => go to "word"
n ... next result
f F ... move forward/back in line to char X,
eg "fX" move to next "X" in line
t T ... move forward/back in line until just before char X,
eg "t " move to just before the next space
## text selection
i a ... inner and outer
w ... word (a-z0-9_), eg "Hello"
W ... word-like, e.g. "Hi1_2!"
s ... sentence, anything ending on ".!?"
p ... paragraph
[]<>"'` ... bracket/angle/quote blocks
()b ... round blocks ()
{}B ... curly blocks {}
t ... tag block, e.g. "<p>...</p>"
## text motion
w W ... next word/Word
e E ... next word/Word end
b B ... back word/Word
ge gE ... back word/Word end
( ) ... next/prev sentence
{ } ... next/prev paragraph
]] ][ ... next section (or {/} in first col)
[[ [] ... prev section (or {/} in first col)
# vim.surround
edit surrounding brackets like '"`(){}[]<>
## insert-mode
Action s Selector Brackets
Action ... [ycd]
s ... for surround
Selector ...
iw ... inner word
[({<"'` ... for all types of surrounding things
s ... for the entire line
Brackets ...
[({ ... for bracket + spaces when appropriate
<...> ... for full tag, e.g. `ysiw<p>` does `hello` => `<p>hello</p>`
])}>"'` ... for bracket only
## visual-mode
S Brackets ... surround selected text with brackets
eg select something and `S"` to surround it with quotes
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment