Skip to content

Instantly share code, notes, and snippets.

@armstrongnate
Created August 26, 2014 03:43
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 armstrongnate/ceb57db78ce90d7cf670 to your computer and use it in GitHub Desktop.
Save armstrongnate/ceb57db78ce90d7cf670 to your computer and use it in GitHub Desktop.
some vim notes

Editing

Command(s) Description
o and O insert new line below and above respectively.
dd delete current line
x delete highlighted character
shift+x delete character to left
dw delete a word
de delete to end of word
/ to search, then n or N to go forward and back in results
:sp filename edit filename in split screen
ctrl+w+q kill splitted screen
cmd+k and cmd+j move line up and down
ctrl+y and ctrl+e move up and down one step without moving cursor
ce change word. similar to cmd+d in sublime c$ to change to end of line
r replace letter under the cursor.
% match parens eg () and {}
0 and $ move to begin and end of line
4. To change every occurrence of a character string between two lines,
     type   :s/old/new/g       to replace old with new on current line
     type   :#,#s/old/new/g    where #,# are the line numbers of the range
                               of lines where the substitution is to be done.
     Type   :%s/old/new/g      to change every occurrence in the whole file.
     Type   :%s/old/new/gc     to find every occurrence in the whole file,
                               with a prompt whether to substitute or not.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment