Using Vim and Ruby

ruby
vim

#1

I 'm trying to find a nice solution similar to the amazing vim-go plug-in by Fatih Arlsan https://github.com/fatih/vim-go. Things I would like are the ability to run an open file and have errors in a location list in vim, jump around them. Also linting.


#2

So far I’m pretty close, close enough for now. I already had Syntastic installed so I only had to install a few checkers and enable them.

I installed Rubocop and Ruby-lint:
gem install ruby-lint rubocop

Then in my .vimrc.local I added:
let g:syntastic_ruby_checkers=['mri', 'rubocop', 'rubylint']

The checker name for ruby-lint is indeed hyphen-free. I’m not sure if the mri checker works, it is enabled by default so I left it but with only that set nothing happens on save.

I also added a ruby only shortcut for quickly running the open buffer:
autocmd FileType ruby nmap <leader>r :!ruby %<CR>

This drops to a shell and runs the open file, pausing after until the user hits enter to go back to the editor.