vim ruby auto completion and supertab

Ruby users, behold! Check this post. It is ruby autocomplete functionality for vim! As cuberick (the post author) points out, it needs ruby compiled with ruby support. It is distributed with vim and as part of the vim-ruby project according to the official rubycomplete.vim page.

If that is not enough you can even apply the completions with the TAB key by using the SuperTab vim script.

I am replicating for convenience (i.e. backup) the .vimrc chunk needed for all this magic to work:

"ruby
autocmd FileType ruby,eruby set omnifunc=rubycomplete#Complete
autocmd FileType ruby,eruby let g:rubycomplete_buffer_loading = 1
autocmd FileType ruby,eruby let g:rubycomplete_rails = 1
autocmd FileType ruby,eruby let g:rubycomplete_classes_in_global = 1
"improve autocomplete menu color
highlight Pmenu ctermbg=238 gui=bold

As pointed out by cuberick, the last line fixes the default rubycomplete color scheme.

Enjoy! :)

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> <pre lang="" line="" escaped="" highlight="">