I’ve hacked irb/completion into something resembling an omni-completion function for vim 7. It currently works for me. I looked at pycomplete.vim and ccomplete.vim to create it. There is a bit of work ahead as far as variable-type detection and require’s are concerned. If you’re feeling your oats and want to hack away at it, you’ll find it here (rubycomplete.vim (0.7)). If you want to see the old versions check the release history. It was originally called rbcomplete.vim, but a discussion on the vim-dev mailing list led to a rename matching the filetype definitions. There are probably many improvements possible, I’ll see how much I can make it do in the next few weeks. I’ve joined up with the vim-ruby project, so you can find the file in their cvs repository.
features:
usage:
add something similar to the following to your vimrc and place rbcomplete in your autoload directory
autocmd FileType ruby,eruby set omnifunc=rubycomplete#Completeif you want buffer/rails/global completion you must add the following:autocmd FileType ruby,eruby let g:rubycomplete_buffer_loading = 1if you want rails support add the following in additionautocmd FileType ruby,eruby let g:rubycomplete_rails = 1if you want classes included in global completions add the following autocmd FileType ruby,eruby let g:rubycomplete_classes_in_global = 1open a ruby file, add some object call, say Array. and hit CTRL-X CTRL-O.
Obligatory screenshot