I installed vim-ruby through pathogen. I think I should be able to use rubycomplete, which is included in the vim-ruby, after installing it, but I am not.
there is not any error, I just can't use it.
when i use :scriptnames to check loaded scripts, i can see some scripts from vim-ruby, such as:
~/.vim/bundle/vim-ruby/ftdetect/ruby.vim
but I can't find rubycomplete. I think it's not loaded, but I don't know why.
I am using the default vim7.3 on Mac OS X 10.8.3, and this is my .vimrc:
call pathogen#infect()
syntax on
set nocompatible
filetype plugin indent on
set number
set autoindent
set smartindent
set shiftwidth=4
set tabstop=4
set backspace=2
set title
set autoread
set ignorecase
set incsearch
set hlsearch
set smartcase
set smarttab
autocmd FileType python set tabstop=4|set shiftwidth=4|set expandtab
autocmd FileType ruby set tabstop=2|set sw=2
autocmd FileType html set tabstop=2|set sw=2
autocmd BufNewFile,BufRead *.html.erb set filetype=html
autocmd BufNewFile,BufRead *.css.scss set filetype=css
autocmd FileType haml set tabstop=4|set shiftwidth=4|set expandtab
autocmd FileType ruby,eruby let g:rubycomplete_buffer_loading = 1
autocmd FileType ruby,eruby let g:rubycomplete_classes_in_global = 1
autocmd FileType ruby,eruby let g:rubycomplete_rails = 1
how can I make my vim load rubycomplete properly? I really need this awesome feature!
--update--
1) when I want to use rubycomplete:
[].
I supposed it should show something like each and each_index, which are the default methods of Array, when I pressed tab(I am using supertab).
however, vim showed:
-- Keyword completion (^N^P) Pattern not found
2) my vim is the default one of mac OSX, but there is ruby+ in the output of vim --version | grep ruby. Therefore, I think my vim supports ruby, which means I don't need to recompile my vim. Am I right?
3) the output of :verbose set omnifunc is
omnifunc=rubycomplete#Complete
Last set from ~/.vim/bundle/vim-ruby/ftplugin/ruby.vim
Supertab has defaulted to keyword completion. This is not omnicompeltion. To get supertab to use omnicompletion you need to either use <C-x><C-o> first or set supertab to default to using omnicompletion.
To get supertab to use omnicompletion by default you can add the following line to your vimrc.
let g:SuperTabDefaultCompletionType = "<c-x><c-o>"
if you want it only for ruby you could use the autocmd below.
autocmd FileType ruby let g:SuperTabDefaultCompletionType = "<c-x><c-o>"
Also you can set supertab to switch between omni completion and one other completion mode automatically by setting it to context mode. To set this up you can just change the above line to
autocmd FileType ruby let g:SuperTabDefaultCompletionType = "context"
If you are planning on doing this I would recommend looking at :h supertab when fully setting it up.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With