希望有人可以帮助我解决一些非常不稳定的行为来自Vim中的omnicomplete与
Ruby& HTML.
问题是Ctrl X Ctrl O似乎只返回非本地命令.方法&变量名被遗漏了.如果我按Ctrl X Ctrl P它们会按预期显示,但omni只是没有提取它们.
一些东西:
> –version确认已安装Ruby(ruby)
>我安装了rails.vim,snipmate和supertab – 这些是我能想到的唯一安装的插件,可能会与ruby omnifunc混乱
> HTML omni也有同样的问题
> PHP& Python omni仍然可以正常工作
>我尝试删除HTML&下面与Ruby相关的部分,但没有区别 – 行为是相同的
.vimrc在下面 – 任何帮助非常感谢
" Set backup directory so that .swp files aren't stored in work folders set backup set backupdir=$HOME/temp/vim_backups/ set directory=$HOME/temp/vim_swp/ filetype on filetype off call pathogen#runtime_append_all_bundles() Syntax on filetype plugin indent on " Necessary for lot of cool vim things set nocompatible set tabstop=2 set smarttab set shiftwidth=2 set autoindent set expandtab set wildmode=longest,list,full set wildmenu " Backspace should delete set backspace=2 " make backspace work like most other apps " For HTML autocmd FileType html set omnifunc=htmlcomplete#CompleteTags " For 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=230 gui=bold " Remaps 'jj' to escape insert mode inoremap jj <Esc> " When closing tab,remove the buffer set nohidden " SuperTab Options " let g:SuperTabDefaultCompletionType="<C-x><C-o>" let g:SuperTabDefaultCompletionType="context" let g:SuperTabContextDefaultCompletionType="<C-X><C-O>" " Close tags imap,/ </<C-X><C-O>
以下是相关选项:
原文链接:https://www.f2er.com/bash/384471.htmlset omnifunc=rubycomplete#Complete let g:rubycomplete_buffer_loading = 1 let g:rubycomplete_classes_in_global = 1
你可能错过了complete_buffer_loading.
if has("autocmd") autocmd FileType ruby set omnifunc=rubycomplete#Complete autocmd FileType ruby let g:rubycomplete_buffer_loading=1 autocmd FileType ruby let g:rubycomplete_classes_in_global=1 endif