2

I am using Tim Popes rail.vim and the ruby-vim. No matter what I have tried on the net I can't get code completion to work sensibly. The nearest I have got is

 <c-x><c-o>  -  auto completing ruby eg pu.. <c-x><c-o> shows "puts"
 <c-x><c-u>  -  auto completing rails e.g  ren.. <c-x><c-u> shows "render"

.vimrc (section mostly found on github)

.....

set omnifunc=rubycomplete#Complete
let g:rubycomplete_buffer_loading = 1
let g:rubycomplete_classes_in_global=1
let g:rubycomplete_rails = 1

......

"perform all your insert completion using the "Tab" key.
"let SuperTab decide which completion mode to use and should play with OmniCompletion
"let g:SuperTabMappingTabLiteral = '<c-tab>' " insert true TAB
let g:SuperTabDefaultCompletionType = "context"
let g:SuperTabContextDefaultCompletionType = "<c-x><c-u>"
 let g:SuperTabCompletionContexts = ['s:ContextText', 's:ContextDiscover']
 let g:SuperTabCompletionContexts = ['s:ContextDiscover']
 let g:SuperTabContextTextOmniPrecedence = ['&omnifunc', '&completefunc']
let g:SuperTabContextDiscoverDiscovery =  ["&completefunc:<c-x><c-u>", "&omnifunc:<c-x><c-o>"]
" let g:SuperTabMappingForword = '<c-space>' " replace default <Tab>
let g:SuperTabLongestEnhanced = 1 " when you have 'longest' in completeopt, enhanced longest.
let g:SuperTabLongestHighlight = 0 " highlight first one in popup menu let you hit <enter>.

I really would like the results of the two menus merged and under the one shortcut.

Thats is, both ruby and rails completion together.

Is this possible? perhaps using subertab chaining? which I couldn't get working either.

Other notes

Rails 3.2.8 
Ruby 1.9.2p320 and tried 1.8.7
Vim 7.3.429 (ubuntu vim-nox package) complied with ruby 1.8.7
Rbenv, Rbenv-build, Rbenv-bundle
4

1 回答 1

2

我使用 rails.vim 而我的 .vimrc 只有

let g:rubycomplete_buffer_loading = 1
let g:rubycomplete_rails = 1

代码完成与“选项卡”一起工作正常

于 2012-09-09T01:15:24.950 回答