I have a version of Ruby + ruby ββvim 7.2 (you are also trying with 7.3 and a custom compiled version), but I only get omnicomplete (ctrl-x ctrl-o) to work in certain cases.
For example, if I have
class MegaGreeter attr_accessor :names def initialize(names = "world") @names = names if @names.nil? puts "hello #{@names}.each" end end end
omnicomplete works for .each , but not for .nil . In addition, it will not automatically populate the attr_ keywords.
I tried this when I disabled all my plugins, again with all enabled. I tried this also with vim-ruby plugin. The plugins I installed are AfterColors, CSApprox, surround, color_sample_pack, mimicpak, taglist.
I have the following section in my .vimrc (I can post all .vimrc if necessary). I also use VIM for C ++, JavaScript, and about 1/2 a dozen other languages, so for some of them there is also omnicomplete stuff:
" ============================ " " CTAGS / OMNICOMPLETE " ============================ " " map <ctrl>+F12 to generate ctags for current folder: map <C-F12> :!ctags -R --c++-kinds=+p --fields=+iaS --extra=+q .<CR><CR> " add current directory generated tags file to available tags set tags+=./projects/.tags " toggle list view map <F4> :TlistToggle<cr> " auto close omnicomplete options when exiting insert mode autocmd InsertLeave * if pumvisible() == 0|pclose|endif " configs for cpp let OmniCpp_MayCompleteDot = 1 " autocomplete with . let OmniCpp_MayCompleteArrow = 1 " autocomplete with -> let OmniCpp_MayCompleteScope = 1 " autocomplete with :: let OmniCpp_SelectFirstItem = 2 " select first item (but don't insert) let OmniCpp_NamespaceSearch = 2 " search namespaces in this and included files let OmniCpp_ShowPrototypeInAbbr = 1 " show function prototype (ie parameters) in popup window if has("win32") let Tlist_Ctags_Cmd='c:\programs\ctags\ctags58\ctags.exe' else if has("win32unix") let Tlist_Ctags_Cmd='/usr/bin/ctags.exe' else if has("unix") let Tlist_Ctags_Cmd='/usr/bin/ctags' endif endif endif " omnicomplete settings for the popout menu setlocal omnifunc=syntaxcomplete#Complete " makes list show longest matching item at top of list set completeopt=menuone,longest " makes enter select item inoremap <expr> <CR> pumvisible() ? "\<Cy>" : "\<CR>" inoremap <expr> <Space> pumvisible() ? "\<Cy>" : "\<Space>" inoremap <expr> <.> pumvisible() ? "\<Cy>" : "\<.>" inoremap <expr> <S-CR> pumvisible() ? "\<Cn>\<Cy>" : "" "manual up/down with tab & shift+tab inoremap <expr> <Tab> pumvisible() ? "\<Cn>" : "\<Tab>" inoremap <expr> <S-Tab> pumvisible() ? "\<Cp>" : "" "allows for autoselect of first item in user complete list inoremap <expr> <Cn> pumvisible() ? '<Cn>' : '<Cn><Cr>=pumvisible() ? "\<lt>Down>" : ""<CR>' "allows autoselect of first item for omni complete inoremap <expr> <leader>' pumvisible() ? '<Cn>' : '<Cx><Co><Cn><Cp><Cr>=pumvisible() ? "\<lt>Down>" : ""<CR>' " open omni completion menu closing previous if open and opening new menu without changing the text inoremap <expr> <C-Space> (pumvisible() ? (col('.') > 1 ? '<Esc>i<Right>' : '<Esc>i') : '') . \ '<Cx><Co><Cr>=pumvisible() ? "\<lt>Cn>\<lt>Cp>\<lt>Down>" : ""<CR>' " open user completion menu closing previous if open and opening new menu without changing the text inoremap <expr> <S-Space> (pumvisible() ? (col('.') > 1 ? '<Esc>i<Right>' : '<Esc>i') : '') . \ '<Cx><Cn><Cr>=pumvisible() ? "\<lt>Cn>\<lt>Cp>\<lt>Down>" : ""<CR>' " autocomplete for commands; and put most likely at top using tab complete " (like windows cmd) set wildmenu set wildmode=list:longest " for ruby if has("autocmd") filetype indent on autocmd FileType cucumber,rspec,ruby set number 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_include_object = 1 autocmd FileType ruby,eruby let g:rubycomplete_include_objectspace = 1 autocmd FileType ruby,eruby let g:rubycomplete_classes_in_global = 1 else set autoindent endif " ruby requires bash --login; " This is to correct running cmd from vim via :! if has("unix") set shell=/bin/bash\ -il endif "ruby end
So, is there a way to get full Ruby support in omnicomplete, if so, how? Or, is this what omnicomplete has to offer for Ruby?