Skip to content

Instantly share code, notes, and snippets.

@adamdb
Created August 30, 2013 17:04
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 adamdb/6392066 to your computer and use it in GitHub Desktop.
Save adamdb/6392066 to your computer and use it in GitHub Desktop.
A list of Vim commands for efficient Vim-ing.
#Search forward
:/ search term
#Search backward
:? search term
#Search and replace all occurrences
:s%/search/replace/g
#Search and replace all occurrences with confirmation
:s%/search/replace/gc
#Search and replace all in current line
:s/search/replace/g
#Search and replace all in current line with confirmation
:s%/search/replace/gc
#Select lines
V + arrow up or down
#Copy (Yank)
y
#Past
p
#Delete word
dw
#Delete line
dd
#Undo
u
#Redo
ctrl + r
#Repeat previous change
.
#Move to the end of a word
e
#Move backward to beginning of word
b
#Jump to the top of the screen
H
#Jump to the middle of the screen
M
#Jump to the end of the screen
L
#Page up
shift + page up
#Page down
shift + page down
#Change color scheme
:colorscheme name-of-color-scheme
#Turn on syntax highlighting
:syntax on
#Turn off syntax highlighting
:syntax off
#Turn on line numbers
:set nu
#Turn off line number
:set nu!
#Open new window
:new name-of-file
#Open new vertical window
:vert new name-of-file
#Switch to shell
:sh
#Close all windows except for current
:on
#Switch windows
ctrl-ww
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment