
YouCompleteMe - A code-completion engine for Vim - albertzeyer
http://valloric.github.io/YouCompleteMe/
======
swombat
How the hell is that a "super-quick installation" for Mac OS?

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...

~~~
Spiritus
1\. brew install vim cmake

2\. git clone
[https://github.com/Valloric/YouCompleteMe.git](https://github.com/Valloric/YouCompleteMe.git)
~/.vim/bundle/YouCompleteMe

3\. cd ~/.vim/bundle/YouCompleteMe

4\. ./install.sh --clang-completer

~~~
Jgrubb
I just had to rename vim in /usr/bin so it'd pick up the /usr/local/bin
homebrewed version instead, but yeah, this.

~~~
adamcw
That likely means your PATH is out of order, if ordered correctly
/usr/local/bin should override /usr/bin. Can save you needing to do that in
the future.

~~~
Jgrubb
Hey, thanks!

------
no_gravity
This takes "super-quick installation" to a new level...

* 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?

~~~
jlgreco
YouCompleteMe has an unusually complex installation. These days most vim
plugins allow you to simply:

    
    
      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."_

~~~
umarrana
what!! no dude

------
city41
YouCompleteMe is included with subvim[0], which I have found to be a great
flavor of vim. I just forked subvim and tweaked it how I liked from there.
Which gets around the painful install of YCM.

[0] [https://github.com/fatih/subvim](https://github.com/fatih/subvim)

------
syncontrol
I'm the main YCM developer.

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).

~~~
klibertp
> you _have to_ compile the ycm_core

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 :)

~~~
swombat
Indeed, and if it's about saving on duplicating libraries, that's less
important to me than saving on installation time. I don't care if it loads up
20 megs of duplicated libraries because you had to hard-link them in. I have
loads of RAM, very little time to set things up.

~~~
mikaelj
Yet lots of time to comment on HackerNews... ;-)

~~~
swombat
Writing a comment on HN takes me 30s-2m tops. Going on a yak shaving
expedition can swallow up hours.

------
freshhawk
So I cloned the repo, ran install.sh and got prompted to run the git submodule
checkout for jedi the first time I opened a python file.

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!

~~~
syncontrol
> So I cloned the repo, ran install.sh and got prompted to run the git
> submodule checkout for jedi the first time I opened a python file.

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!

------
AYBABTME
I found that other solutions for Vim completion tend tomake Vim slowish when
they index a lot of data, for medium~large codebases.

How does your pluggin scale?

~~~
rjzzleep
it's "kinda" async. and it very much depends on the language of your choice.

------
meunier
I've been using this for Python development for a few months now and it's by
far the best completion solution I've found in vim and I've tried most. Jedi
by itself is great but the actual interface to it was always lacking and YCM's
fuzzy matching makes it breeze.

------
terhechte
Sadly, it is still not working too well with Objective-C, which is currently
my main language (1). Luckily, unofficial VIM plugins for XCode like XVim (2)
or VIEmu (3) are getting better and better, so at least I can use vim bindings
for objective-c now, too. Nevertheless, good clang support in Vim would still
be great, so that I could tap into the huge amount of vim plugins during objc
development.

[1]
[https://github.com/Valloric/YouCompleteMe/issues/84](https://github.com/Valloric/YouCompleteMe/issues/84)

[2] [https://github.com/JugglerShu/XVim](https://github.com/JugglerShu/XVim)

[3] [http://www.viemu.com/](http://www.viemu.com/)

~~~
skue
Thanks, that's good to know. I have been using XVim for a while now. It can be
quirky, but it's amazing what JugglerShu has been able to pull off.

Have you used both Xvim and ViEmu? How does ViEmu compare?

------
jasonkostempski
Hate the name. I can't help picturing Tom Cruise and Renee Zellweger's crying
faces.

------
steven5158
Had latest vim installed from source already on Mac with +python support.

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! :)

------
SteveDeFacto
Works pretty nice but is there anyway I can get it to display function
parameters as I type?

------
davidbanham
I've been using YCM for a few months now and I love it. It's a big part of my
coding experience now. It's a bit of a pain to get a supported vim version up
and running, but completely worth it.

------
jaroslavj
If you are a ruby or javascript developer, just use Supertab, because you will
waste more time installing it than getting any substantial benefits over
default vim completion.

~~~
VeejayRampay
How do you achieve completion in Ruby with vim? I'd be interested cause the
only things doing completion I've seen for vim so far are always extremely
limited (completion on stuff you have in your buffer).

~~~
jaroslavj

      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...](http://www.cuberick.com/2008/10/ruby-autocomplete-in-vim.html) and
some SO answers.

------
tmister
I could not install it in my work machine as the OS is windows. As a
replacement I use neocomplete.vim[1]. It is very fast, responsive, has fuzzy
auto-complete. But it requires vim version greater than 7.3.885 and vim
compiled with lua bindings. Still it is small annoyance compared to YCM
installation procedure.

[1][https://github.com/Shougo/neocomplete.vim](https://github.com/Shougo/neocomplete.vim)

~~~
hyperbling
neocomplete is also my preferred autocomplete plugin. it integrates very well
with all of shougo's other plugins, and it works on windows. YCM officially
does not support windows and it's not uncommon for it to be broken for a week
or two.

------
randy909
This is an absolutely fantastic plugin. The minor installation pain is paid
back easily after a few hours of use. Fast, fuzzy matching autocomplete
people!!

------
lsiebert
I love YCM.

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.

------
mmgutz
Could not get it to install on Debian. Depends on newer libs than found on
conservative Wheezy. Mac was easier but still somewhat arduous. It's necessary
complex to install because he's using C++ to get the speed boost. VimScript
was too slow.

Once you get it working. It's amazing with Go :)

------
cks
I highly recommend this plugin! I find it really snappy on my projects.

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).

~~~
McUsr
I haven't tried it on anything but rather small projects in C: 10-15 source
files/modules, but I prefer vim and ycm to XCode for coding. As a matter of
fact, all other code completion thingy's I use seem a bit crappy in
comparision, with the excempt of bbautocomplete.

Time to install the new beta of vim, and check out ycm! :)

------
binbrain
Easy to install actually. Worked pretty much out of the box for me. Does
anyone know how to change the autocompletion popup background color? A black
popup window on black background make things a little harder to read.

~~~
binbrain
Answered, Pmenu color

------
SmileyKeith
Can't wait until this is resolved.
[https://github.com/Valloric/YouCompleteMe/issues/84](https://github.com/Valloric/YouCompleteMe/issues/84)

------
djeikyb
I use this with Eclim to enhance java writing. The Vrapper plugin for Eclipse
is getting very good, but sometimes it's nice to work directly in vim.

~~~
arianvanp
I've never gotten eclim to fully work before. I don't do a lot of java
nowadays but I just got back into a project where parts of the codebase are in
java. So I might try it once again. What has your experience been so far?

------
general_failure
I think this thread is a perfect example of why cloud apps are all the rage
these days. The installation hassle is a big turn off.

------
anonymous
Just one question. Where do I give money?

------
Ironballs
What colour scheme is he using?

~~~
mynegation
Most probably author's custom scheme: [https://github.com/Valloric/vim-
valloric-colorscheme/blob/ma...](https://github.com/Valloric/vim-valloric-
colorscheme/blob/master/colors/valloric.vim)

------
RVijay007
Love the name!

~~~
zerooneinfinity
Haha, yea it's pretty great.

------
ras_hatak
So, after building vim from source, python from source, and cmake from source
(damn old repos...), I'm finally getting stuff to build. and I hit this:
Linking CXX static library libBoostParts.a [ 89%] Built target BoostParts
Scanning dependencies of target ycm_core [ 90%] [ 92%] Building CXX object
ycm/CMakeFiles/ycm_core.dir/LetterNode.cpp.o Building CXX object
ycm/CMakeFiles/ycm_core.dir/Utils.cpp.o [ 93%] Building CXX object
ycm/CMakeFiles/ycm_core.dir/ycm_core.cpp.o [ 93%] Building CXX object
ycm/CMakeFiles/ycm_core.dir/Candidate.cpp.o [ 94%] Building CXX object
ycm/CMakeFiles/ycm_core.dir/PythonSupport.cpp.o cc1plus: warnings being
treated as errors
/home/zdrillings/.vim/bundle/YouCompleteMe/cpp/BoostParts/boost/python/converter/pyobject_type.hpp:
In static member function ‘static bool
boost::python::converter::pyobject_type<Object, pytype>::check(PyObject _)
[with Object = boost::python::list, PyTypeObject_ pytype = (& PyList_Type)]’:
/home/zdrillings/.vim/bundle/YouCompleteMe/cpp/BoostParts/boost/python/converter/obj_mgr_arg_from_python.hpp:101:
instantiated from ‘bool
boost::python::converter::detail::object_manager_ref_check(const T&) [with T =
boost::python::list]’
/home/zdrillings/.vim/bundle/YouCompleteMe/cpp/BoostParts/boost/python/converter/obj_mgr_arg_from_python.hpp:109:
instantiated from ‘bool
boost::python::converter::object_manager_ref_arg_from_python<Ref>::convertible()
const [with Ref = const boost::python::list&]’
/home/zdrillings/.vim/bundle/YouCompleteMe/cpp/BoostParts/boost/preprocessor/iteration/detail/local.hpp:34:
instantiated from ‘PyObject* boost::python::detail::caller_arity<3u>::impl<F,
Policies, Sig>::operator()(PyObject _, PyObject_ ) [with F =
boost::python::list ( _)(const boost::python::list &, const std::string&,
const std::string&), Policies = boost::python::default_call_policies, Sig =
boost::mpl::vector4<boost::python::list, const boost::python::list&, const
std::string&, const std::string&>]’
/home/zdrillings/.vim/bundle/YouCompleteMe/cpp/BoostParts/boost/python/object/py_function.hpp:38:
instantiated from ‘PyObject_
boost::python::objects::caller_py_function_impl<Caller>::operator()(PyObject
_, PyObject_ ) [with Caller =
boost::python::detail::caller<boost::python::list ( _)(const
boost::python::list &, const std::string&, const std::string&),
boost::python::default_call_policies, boost::mpl::vector4<boost::python::list,
const boost::python::list&, const std::string&, const std::string&> >]’
/home/zdrillings/.vim/bundle/YouCompleteMe/cpp/ycm/ycm_core.cpp:186:
instantiated from here
/home/zdrillings/.vim/bundle/YouCompleteMe/cpp/BoostParts/boost/python/converter/pyobject_type.hpp:21:
warning: dereferencing type-punned pointer will break strict-aliasing rules
make[3]: ___[ycm /CMakeFiles/ycm_core.dir/ycm_core.cpp.o] Error 1 make[3]: __*
Waiting for unfinished jobs.... make[2]: __* [ycm
/CMakeFiles/ycm_core.dir/all] Error 2 make[1]: __* [ycm
/CMakeFiles/ycm_core.dir/rule] Error 2 make: __* [ycm_core] Error 2

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.

------
hawkharris
Great name

