Skip to content

Instantly share code, notes, and snippets.

@stevenyap
Created February 21, 2014 08:40
Show Gist options
  • Select an option

  • Save stevenyap/9130763 to your computer and use it in GitHub Desktop.

Select an option

Save stevenyap/9130763 to your computer and use it in GitHub Desktop.
Vim

VIM Setup

  • Use macvim
  • brew install macvim --override-system-vim
    or install without macvim
  • brew install mercurial
  • brew install vim

VIM Bundles using vundle

.vimrc

cTags

  • cTags library allows indexing and fast searching of code classes and methods
  • To install, brew install ctags
  • Use Vim-tags to auto-magically tag your codes: https://github.com/szw/vim-tags
  • cTags does not support coffee/scss/css out-of-the-box, so get the .ctags file from my dotfile github and put it at ~/.ctags

RVM

  • If you are using ZSH you may find that MacVim is not loading your rvm configuration correctly. MacVim does not source the .zshrc file, but will source the .zshenv file. Hence, just cp ~/.zshrc ~/.zshenv.
    This is important for the proper running of rspec.
  • Note that you have to cd into your working directory and then run mvim else RVM will not work with your VIM too.

Useful Shortcuts

<c-w>= : Resize all windows equally (it actually ignores NERDTree)
<c-w>x : Switch current buffet with another window

Rspec-Quickfix hack

# end of spec_helper.rb
# Custom method to output debug message for Vim quickfix window
# Used together with TMUX + Tim Pope Dispatch
class Object
  def vp(obj)
    file = binding.of_caller(1).eval('__FILE__')
    line = binding.of_caller(1).eval('__LINE__')
    puts "#{file}:#{line}: warning: #{obj.inspect}"
  end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment