command + <arrows> h l k j – left, right, up, down b w – word left, word right Insert/Append Text i – start insert mode a – append after cursor o – open blank line below current line Esc – exit insert mode Editing u – undo last command control + p – autocomplete word column edit control + v (visual block) use arrows to select column to replace c + new text + Esc indent :> - indents current line :>> - indents current line twice :> # - indent # of lines :>> # - indents twice # of lines surround cs<old><new> (cs“*) ds<delimiter> – remove delimiters csw<delimiter> - surrounds word yss<delimiter> - surround line Marking Text v – start visual mode V – start Linewise visual mode Visual Commands aw – select word ap – select paragraph Copy/Cut and Paste yy – yank (copy) line dd – delete (cut) line p – put (paste) clipboard after cursor Search/Replace /pattern – search for pattern n – repeat search forward :set hlsearch – highlight all results of search :nohlsearch to turn off highlights :%s/old/new/g – replace all old with new in file :begline#,endline#/old/new/g – replace old with new between beg/end line #s Working with Multiple Files :e path/to/filename – edit file :NERDTree – opens left hand file explorer ctags control+] - navigate to definition control+t - navigate back on stack g+] - list all occurrences of word :tags – shows tag stack :tag <method or class definition> - open or list :tag /<definition> - search substring :Rfind substring of filename – search for, give you options to open file/directory in Rails project :Renvironment – opens environment.rb by default :Rinitializer – opens routes.rb by default :A – alternate file most often the spec file :R – related file, read rails.vim docs gf – mac daddy go anywhere command if clicked anywhere in relevant string it will do its best to go to related file. Examples with tons more in rails.vim docs, Po*st.find ---> models/post.rb has_many :c*omments ---> models/comment.rb gt – switch between open tabs <leader>b – view all buffers and select one (open files) :bd – close a buffer (file) Opening windows :sp path/to/filename – open file in horizontal split window :vsp path/to/filename – open file in vertical split window :AS – open alternate file in horizontal split :AV – open alternate file in vertical split :RS – open related file in horizontal split :RV – open related file in vertical split Running Specs :.Rake – runs one spec :Rake – runs whole spec suite Exit command + s (save) :w – save but don't exit :wq – save and exit :q! - quit and ignores edits Vim Plugins • Rails: http://www.vim.org/scripts/script.php?script_id=1567 • Fuzzy Finder: http://www.vim.org/scripts/script.php? script_id=1984 • NERDTree: http://www.vim.org/scripts/script.php?script_id=1658 • surround: http://www.vim.org/scripts/script.php?script_id=1697