Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

YCM not loading for: 'rust' #259

Closed
miguelmartin75 opened this issue Jul 19, 2015 · 3 comments
Closed

YCM not loading for: 'rust' #259

miguelmartin75 opened this issue Jul 19, 2015 · 3 comments
Labels

Comments

@miguelmartin75
Copy link

In my vimc I have the following line:

Plug 'Valloric/YouCompleteMe', { 'do': './install.sh --clang-completer', 'for': 'c,cpp,objc,objcpp,cs,python,rust' }

Oddly enough, it does not load the YouCompleteMe plugin for rust file types (.rs files). However, I also have these lines specific for rust, but they seem to be loaded:

Plug 'phildawes/racer', { 'do': 'cargo build --release', 'for': 'rust' }
Plug 'wting/rust.vim', { 'for' : 'rust' }

If I remove the 'for': 'c,cpp,objc,objcpp,cs,python,rust' then it works fine, i.e. if I have the following instead:

Plug 'Valloric/YouCompleteMe', { 'do': './install.sh --clang-completer' }

Note for those interested, I'm using YCM to automatically pop-up Racer's omni-complete via manually setting an entry for rust in g:ycm_semantic_triggers.

@junegunn
Copy link
Owner

See YCM example here: https://github.com/junegunn/vim-plug#on-demand-loading-of-plugins

The reason YCM does not load is that it only executes its Enable function on VimEnter, so it has to be manually triggered.

@miguelmartin75
Copy link
Author

I changed my line to:

Plug 'Valloric/YouCompleteMe', { 'do': './install.sh --clang-completer', 'for': ['c', 'cpp', 'objc', 'objcpp', 'cs', 'python', 'rust'] }

and it works, without the line you suggested that I should add:

autocmd! User YouCompleteMe call youcompleteme#Enable()

😕

@junegunn
Copy link
Owner

Maybe they changed something? I don't know, I don't use YCM.

Anyway, for option was designed to take a string of a single file type or a list of multiple file types, and there's no code in vim-plug that processes comma-separated file types. It may not work correctly if you have multiple plugins with overlapping sets of for options.

Plug 'foo', { 'for': 'a,b,c' }
Plug 'bar', { 'for': 'b,c' }

When a file of type a is open, foo is loaded, and vim-plug will try to clear the hook by executing autocmd! PlugLOD Filetype a,b,c, which will cause the autocmds for bar to be cleared as well, and bar will never get loaded.

But if you specify the types as a list, vim-plug will correctly handle such cases.

Plug 'foo', { 'for': ['a', 'b', 'c'] }
Plug 'bar', { 'for': ['b', 'c'] }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants