Skip to content

Instantly share code, notes, and snippets.

@dce
Created April 9, 2011 21:52
Show Gist options
  • Save dce/911813 to your computer and use it in GitHub Desktop.
Save dce/911813 to your computer and use it in GitHub Desktop.
Vim for Rails Developers notes

Vim for Rails Developers

http://www.codeulatescreencasts.com/products/vim-for-rails-developers

Intro

rails.vim

  • Rfind (w/ tab completion)
  • gf (go to file under cursor)
  • Runittest Rcontroller Rfunctionaltest
  • RVunittest (vertical split)
  • RSunittest (horizontal split)
  • RTunittest (new tab)
  • Rake (run tests)
  • Rgenerate migration add_foo_to_bar

snipMate

  • def + tab (new method): set method name, hit tab again
  • sel + tab, map + tab
  • .vim/bundle/snipmate.vim/snippets/ruby.snippets
  • New snippets in .vim/snippets

ctags

  • Install w/ homebrew, default is crap
  • Had to change path to get HB version first
  • ctags -R --exclude=.git --exclude=log --exclude=tmp *
  • set tags=./tags
  • ctrl + ] (jump to definition)
  • tag /validates_presence_.* (enter number to jump) ((doesn't work as expected))

ack

  • ack --ruby controller
  • .ackrc w/ --ignore-dir=rails (ignore rails directory)
  • set grepprg=ack, then grep --ruby controller
  • :cn (next result), :cp (prev result)

Extras

  • ci" change inside double quotes
  • da" delete around double quotes
  • daw delete around word (delete whole word)
  • gi go to where you were last inserting
  • ctrl + o go back one jump
  • ctrl + i go forward one jump
  • https://github.com/r00k/dotfiles (git blame macro)
  • tComment - another comment option
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment