YouCompleteMe - A code-completion engine for Vim
valloric.github.io
valloric.github.io
Can anyone figure out an actually quick way to install it with Pathogen?
PS: the plugin looks great - I'm just bitching about the installation docs because I'm in the middle of 10 different things at the moment and don't have the time to engage in a potential yak shaving expedition...
Edit: It suddenly occurred to me just how reliant everyone now is on package managers. Once upon a time, I would think installing a dependency or two before compiling a new toy commonplace, if not expected. Nowadays... it's yak shaving.
Not that I'm no less guilty of this. I've even downloaded AUR helper tools because I'm too lazy to even wget a package and do a makepkg any longer.
Where you follow the given steps carefully and one fails because whichever version of something is not the right one, then you end up in a weird state where you have a hard time going back to how your setup was before, and you have to google things like "Compiler error: missing dependency foo.h" even though you can see that foo.h is right there. You then finally fixed the foo.h error to discover that you need to update Ruby for whatever reason, but the system doesn't pick up the version you installed with Homebrew anymore but is using the old default one, you then start updating Homebrew. Etc., etc. until you don't even know what you were trying to achieve in the first place and you are now super irritable.
(yes, I had a recent experience with that kind of yak shaving :))
Been there, done that, got a billion t-shirts and switched away from Linux to get away from this.
Regardless, amazing vim plugin!
1. Read through the full page of installation instructions.
2. Update to latest version of MacVim.
3. Go research Vundle because up until now, I've been happily using Pathogen. Install Vundle.
4. Update vimrc file for Vundle, add YCM.
5. Launch vim, note error saying YCM needs installation.
6. Run :BundleInstall, which tells me I should compile and impolitely adding "Read the docs!" (Which docs? The GitHub docs, which tell me I should only need to recompile in rare cases? Or the bundle's vim docs, which didn't exist on my system prior to running this command?)
7. Back to terminal, launch ./install.sh --clang-completer in the YCM directory.
8. Go fix breakfast, return. Compilation eventually completes, no errors.
9. Launch vim, which immediately crashes with error: Vim: Caught deadly signal ABRT
10. Give up and delete any trace of YCM.
In a perfect world maybe I would have an extra hour or two to debug this, run through some regressions but right now I don't. Sounds like a nice plugin, maybe I'll try again in the future.
Had the same problem. There's something about this in the FAQ: One should delete and re-install python if it was installed through brew. (Doing this and recompiling YCM worked for me.)
The other gripe was: "Add YCM to vundle" ... without any mention of what exactly to add.
Then the thing started complaining about the missing .extra_ycm_something.py ...
2. git clone https://github.com/Valloric/YouCompleteMe.git ~/.vim/bundle/YouCompleteMe
3. cd ~/.vim/bundle/YouCompleteMe
4. ./install.sh --clang-completer
The problem appeared to be that YCM's install.sh script goes out of its way to determine the active version of python and link against its libraries[1].
For anyone with python installed via homebrew, that means it links to 2.7.3. Unfortunately, both MacVim and the homebrew version of vim link against the system python (2.7.2). As a result, loading YCM triggers an error resolving urandom and crashes vim.
[1] https://github.com/Valloric/YouCompleteMe/blob/master/instal...
* compile Vim from source
* install and understand Vundle
* depending on some library issues maybe recompile ycm
* Install development tools and CMake
* Make sure you have Python headers installed
How is the usual "unzip it to ~/.vim" installation called these days?
cd ~/.vim/bundle
git clone ....
and you are good to go. YouCompleteMe isn't this nice, and suffers for it I think. The "unzip it to ~/.vim" is usually called "a real pain in the ass to keep up to date and disabled or uninstall."Most complaints here are about the installation procedure. I tried to make it as easy as possible, but the root of the problem is that you _have to_ compile the ycm_core module so that completion is fast. There's no going around it. The compiled module is the main reason why YCM is so fast when you get it configured.
Other than complicated/rare configurations, installing YCM is IMO not that difficult. The _only_ difference between installing any "average" plugin with Vundle/Pathogen and YCM is running ./install.sh from the YCM directory after you pull it in. That's it. The script will download dependencies for you (libclang), run cmake, make and all the other tools so that everything is installed correctly. It will clean up after itself too. It's pretty hand-holdy so it will tell you if you need to install something (like CMake).
The docs are pretty extensive so you should not get stuck anywhere even if you encounter problems.
I'm happy to hear suggestions on how to further improve the installation procedure. As always, pull requests are welcome too.
YCM too goes out of its way to inform you if you missed something you needed to do, like create a ycm_extra_conf.py file with your build flags (if you want the C-family semantic completion to work) because YCM can't conjure out of the air all the include paths and such needed to compile your project. There's no going around this, a real compiler is used to build the AST so we need the compiler flags.
All in all, if the installation procedure is the main complaint, I'm happy (not really, but you get the point) because that means that actually _using_ the plugin is a good experience (I hope). The installation you go through once and forget about; you use the plugin every day.
Here are excerpts from the FAQ about some of the other things people have brought up:
# Why isn't YCM just written in plain VimScript, FFS?
Because of the identifier completion engine and subsequence-based filtering. Let's say you have many dozens of files open in a single Vim instance (I often do); the identifier-based engine then needs to store thousands (if not tens of thousands) of identifiers in its internal data-structures. When the user types, YCM needs to perform subsequence-based filtering on all of those identifiers (every single one!) in less than 10 milliseconds.
I'm sorry, but that level of performance is just plain impossible to achieve with VimScript. I've tried, and the language is just too slow. No, you can't get acceptable performance even if you limit yourself to just the identifiers in the current file and simple prefix-based fitering.
# Why does YCM demand such a recent version of Vim?
During YCM's development several show-stopper bugs were encountered in Vim. Those needed to be fixed upstream (and were). A few months after those bugs were fixed, Vim trunk landed the pyeval() function which improved YCM performance even more since less time was spent serializing and deserializing data between Vim and the embedded Python interpreter. A few critical bugfixes for pyeval() landed in Vim 7.3.584 (and a few commits before that).
For example, here is the install snippet from vimproc, which also requires compiling: https://gist.github.com/lynndylanhurley/5951180.
Couldn't you ship a several already compiled binaries for major OSes? What do you do during compilation (and do you have to do this during compilation instead of on runtime) that makes it impossible?
I'm not using VIM anymore, so the question is just at out of curiosity :)
Except, I don't. I haven't installed it because I have a feeling this will be way more hassle than it looks (a feeling validated by several comments in this thread) and I don't have the time to do that kind of stuff.
I would love to use it.
Please let us know when installation is less of a kluge.
I followed your full install directions to a T and I'm getting "YouCompleteMe unavailable: ycm_core too old, PLEASE RECOMPILE ycm_core" on Vim start-up. This doesn't appear to be a Python version issue (everything is showing 2.7) and I downloaded the Clang binaries as directed.
Seems like a pretty excellent installation process (on linux anyway) despite the "hackers" complaining in other comment threads.
But the important part is that I'm really impressed by the completion ability, I've only played with it a bit but I'm leaving the rest of my plugins for that turned off and staying with ycm for now. Excellent plugin, thank you!
Yep, I added that check to better support the use case of people checking out the repo themselves instead of using Vundle (which will checkout the git submodules for you automatically).
I'm happy you enjoy the plugin!
How does your pluggin scale?
[1] https://github.com/Valloric/YouCompleteMe/issues/84
i tried to add that functionality to youcompleteme, but the main problem with it is that youcompleteme tries to be very generic in completions, therefore there is no real way of knowing what kind of methods you get back from your completion backend. you could hack it to do some regex parsing on method names, but i'd really suggest that if objective-c is your main target go for clangcomplete+ultisnips.
Have you used both Xvim and ViEmu? How does ViEmu compare?
I already use Pathogen so I didn't use the suggested Vundle.
Just placed YouCompleteMe in ~/.vim/bundle/
ran the ./install.sh in the YouCompleteMe bundle directory and it worked.
Thank you guys, this seems awesome so far! :)
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
and for Supertab let g:SuperTabDefaultCompletionType = "<c-x><c-o>"
or autocmd FileType ruby let g:SuperTabDefaultCompletionType = "context"
That way you will get omni completion with supertab.I compiled this from http://www.cuberick.com/2008/10/ruby-autocomplete-in-vim.htm... and some SO answers.
My only issue with installation was that I would prefer to actually upgrade my systems clang, instead of just installing it in my home dir, and there aren't step by step instructions for doing so.
Once it is installed it is great for C lang stuff and python. It makes me wish other languages had equally good support you could integrate. Perl omni complete is super slow for example. But I know that isn't you.
Once you get it working. It's amazing with Go :)
I haven't had the opportunity to try it on any gigantic projects, but I have found configuration files for YCM in the Chromium source tree which suggests that it scales nicely (assuming it's usable on the Chromium tree).
Time to install the new beta of vim, and check out ycm! :)
Now, I went in and removed the -Werror flag from the makefiles and that got around it, but I get a ton of errors when i start vim, doing that:
Error detected while processing function youcompleteme#Enable: line 11: Traceback (most recent call last): Press ENTER or type command to continue Error detected while processing function youcompleteme#Enable: line 11: File "<string>", line 1, in ? Press ENTER or type command to continue Error detected while processing function youcompleteme#Enable: line 11: File "/home/zdrillings/.vim/bundle/YouCompleteMe/autoload/../python/ycm/base.py", line 28 Press ENTER or type command to continue Error detected while processing function youcompleteme#Enable: line 11: except ImportError as e: Press ENTER or type command to continue Error detected while processing function youcompleteme#Enable: line 11: ^ Press ENTER or type command to continue Error detected while processing function youcompleteme#Enable: line 11: SyntaxError: invalid syntax Press ENTER or type command to continue Error detected while processing function youcompleteme#Enable: line 13: Traceback (most recent call last): Press ENTER or type command to continue Error detected while processing function youcompleteme#Enable: line 13: File "<string>", line 0, in ? Press ENTER or type command to continue Error detected while processing function youcompleteme#Enable: line 13: NameError: name 'base' is not defined Press ENTER or type command to continue Error detected while processing function youcompleteme#Enable: line 13: E858: Eval did not return a valid python object Press ENTER or type command to continue YouCompleteMe unavailable: ycm_core too old, PLEASE RECOMPILE ycm_core
I'm guessing it's related. Does anyone have any advice on fixing some of this, so I can try this plugin? it sounds fantastic.
thanks in advance.