Skip to content

Instantly share code, notes, and snippets.

@dimanyc dimanyc/vim_commands.md
Last active Jul 14, 2016

Embed
What would you like to do?
basic VIM commands

Clipboard

v(*)"+y - will copy lines selected in Visual mode.

Folding

zfat or zfit - folds HTML by indentation?

Find / Replace:

:s%/foo/bar/g - Change each 'foo' to 'bar', (% means in every line)

Windows Resizing:

ctrl + w then [n](optional) then direction (<< or >>)

Buffer

:b# - back to previusly buffered command

Explorer

:Vexplore - vertical explorer window

Indentation

gg = G - normalizes indentation

Vim Surround

cst=[tag] - change surround tag or symbol

Navigating

h - left

j - down

k - up

l - right

Exit:

:q - discard and quit :x - save and quite. add ! (bang) to force

Deletion:

x - delete single charater d$ - delete everything follwoing the current cursor position ( to the end of the line ) dw - delete word , or everyting until the start of the next word, EXCLUDING its first character 'de' - delete everything to the end of the current word, INCLUDING the last character.

Motions with count:

(n)w- move n words forward (n)e- move to the end of the nth word foward 0 - move to the begining of the current line

Deletion with motions:

d(n)w - deletes the n numbe of words (n)dd - deletes n number of lines

Undo:

u - undoes the last commands U - undoes changes to a line Ctrl (command) + r - undoes the undos #<= wtf??

Insertion:

A - start inerting at the end of line (without replacing the last char)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.