Skip to content

Instantly share code, notes, and snippets.

@wesgibbs
Created December 1, 2009 14:14
Show Gist options
  • Save wesgibbs/246301 to your computer and use it in GitHub Desktop.
Save wesgibbs/246301 to your computer and use it in GitHub Desktop.
ctrl+b
page up
ctrl+f
page down
gg or 1G
top of file
G (shift+g)
bottom of file
0
beginning of a line
$
end of a line
^
first character of line
:%s/search/replace/gc
% = entire file
g = global
c = confirm, interactively confirm each replacement
C
delete to end of line and drop into insert mode
ct[char]
delete to given [char] and drop into insert mode
yiw
yank in word
Columnar select and insert
ctrl+v to enter visual block mode
select the lines you want to edit
I (shift+i) to enter some insert mode
make the change you want
esc to apply the change to all the selected lines
gg=g
reformat entire file
I (shift+i)
go to insert mode at the beginning of the line
:tab sb app/models/user.rb
open a buffer in a new tab
viws"
surround word with double quotes
ds"
delete surrounding double quote
cs"'
change surrounding double quote to single quote
ctrl-w r
rotate windows to the right; common use is to swap the files shown in two viewports
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment