Better autocomplete in VIM

女生的网名这么多〃 提交于 2019-12-03 06:33:34

Relatively satisfied with stock Vim's omnicomplete + vim-ruby and vim-rails having completion abilities on par with NetBeans but with all the bells&whistles of Vim and much lower resource requirements, of course.

From my .vimrc concerning completion options :

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

One thing that I have had a bit of luck with Rubymotion is YouCompleteMe and enabling tag Support. you will need a lot of ram(YCM uses ~2GB when indexing a large tag file) because the tags that rubymotion uses are about 40k tags.

The downside is that the rubymotion people don't seem to want to review pull requests and provide any feedback so I am not sure if they will add the needed things to the rake task that creates the tag files for ycm to work correctly out of the box.

To get it to work you need to set the tags files correct

set tags=./tags;,tags;

and then you need to setup ycm to complete off tags.

let g:ycm_collect_identifiers_from_tags_files = 1

you need to make the ctags file compatible with ycm as well. This pull request does that. You need to add a language field to the ctags creation and then change bridgesupport to ruby.

pull request for that

after that you need to run rake ctags in the root of your project.

If you don't want to modify the project.rb file you could probably create your own rake task that does pretty much the same thing.

Yes, Vim is an awesome... text editor.

As such, it can't be expected to match any IDE's "code awareness". Furthermore, it completely relies on the community for providing more than default support for a given language. If google or the rubymotion site didn't help you to find a serious "autocompletion" solution I doubt you'll find it here.

The process explained in the blog post below sounds ok, if not very precise on the vim configuration front.

http://rayhightower.com/blog/2013/02/12/automatic-ctags-with-rubymotion-and-vim/

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!