Enabling Ruby syntax highlighting and autocomplete using MacVim

mvim snapshot


  1. Download and use MacVim using Homebrew:
    1. brew install macvim
  2. (If above doesn’t work to highlight .rb files automatically or if you prefer using vim instead of macvim)
    1. Download vim-ruby zip from: https://github.com/vim-ruby/vim-ruby
    2. Follow manual “Manually” instructions to install from a script file: https://github.com/vim-ruby/vim-ruby/wiki/VimRubySupport
    3. Enable extensions within your ~/.vimrc
      1. set nocompatible " We're running Vim, not Vi!
        syntax on " Enable syntax highlighting
        filetype on " Enable filetype detection
        filetype indent on " Enable filetype-specific indenting
        filetype plugin on " Enable filetype-specific plugins
  3. (Optional: enable better tabbing)
    1. Edit your ~/.vimrc with the following contents
      1. set smartindent
        set tabstop=2
        set shiftwidth=2
        set expandtab


  • Open a file in the terminal using: mvim -v <FILE_NAME>
  • Initiate auto-complete prompt by hitting CTRL-X CTRL-O