Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save sdhull/438291 to your computer and use it in GitHub Desktop.
Save sdhull/438291 to your computer and use it in GitHub Desktop.
Notes from expert vim talk at RailsConf 2010
Keep a "Tool-sharpening list"
Keep a list of things that annoy you or feel inefficient, figure out how to make them better
Help
:h
:h buffers (with tab-complete)
:h buffers (then control-d for a list of matching stuff)
It's hyper-linked, ctrl-] to follow link, ctrl-o to back out
Registers
double-quote to name a register, then next command will be put there
"t foo #example
:registers
registers 1-9 are last 9 things deleted
two double quotes are the unnamed register ("")
"0 p # to put the last thing yanked
ctrl-r on the command-line will tell vim to interpolate from the given register (ie %)
the * register goes into the system clipboard
Macros
@@ #re-executes the last @-command executed
Marks
#like little bookmarks
m m #m for mark then name
'm #goes to mark line
`m #goes to column & line
#marks named with a capital letter are global, across files
:marks #displays your marks
#marks 0-9 shows the last few places you inserted text
Undo
#vim handles undo's as a tree
g- # goes backword in time
g+ # goes forward in time, depth-first
R # goes forward in time, automatically choosing the most recent branch
:help text-states
:earlier 5 minutes
:later 5 minutes
Misc
# Plugin called Fugitive for git commands
H # go high on the screen
L # go low on the screen
M # go to the middle of the screen
ctrl-o # 'out' jumps back to where you were last
ctrl-i # 'in' jumps forward
gi # puts you back to where you were and starts inserting
caw # 'change around word' change the word you're in
ca( # 'change around #{delimiter}'
ciw # 'change in word'
ci( # 'change in #{delimiter}'
# bind ctrl-s to esc :w <enter>
# rails.vim
:Rinvert # will write your down-migration
:Rcontroller # will open the associated
# much much more
Tags
:tselect <search>
:tags respond_to # jump to method definition
# get exuberant c-tags for that to work
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment