YouCompleteMe, a Fast, As-You-Type, Fuzzy-Search Code Completion Engine for Vim
val.markovic.io
val.markovic.io
1. Install the Vundle plugin manager for Vim.
2. Add the line "Bundle 'Valloric/YouCompleteMe'" (without the double quotes) to your ~/.vimrc file.
3. Open Vim and run ":BundleInstall" without the quotes.
4. Install cmake if it's not already installed. In a temporary directory, run "cmake -G 'Unix Makefiles' . ~/.vim/bundle/YouCompleteMe/cpp" (without the quotes) to generate a Makefile and then run "make ycm_core" to build.
5. Open a file in Vim and start typing.
So for terminal Vim'ers:
1. copy the mvim script from MacVim to /usr/local/bin (or wherever)
2. ln -s /usr/local/bin/mvim vim (assuming you've ditched your old vim symlink)
Linking directly to the MacVim binary causes these sorts of issues[0].
Vim from Homebrew doesn't work though, something is wrong with the way Homebrew configures/builds Vim (don't know what though).
You can certainly build a Vim from source for Mac and have that work well with YCM, the only question is why would someone go through the trouble of doing so when MacVim does it for you.
Even if you prefer using Vim in the console and don't like the GUI, MacVim.app has a normal Vim binary inside it that you can call.
Ah okay - the README gave me a very different impression. Either way using the packaged MacVim binary via the mvim script is preferable, for reasons you've elaborated on.
> why would someone go through the trouble of doing so when MacVim does it for you.
Commandline lovers love trouble, are often not found browsing .dmg offerings?
* brew install vim
* alias vim="/usr/local/Cellar/vim/7.3.632/bin/vim"
* :BundleInstall 'Valloric/YouCompleteMe'
* Make the ycm_build directory:
cd ~
mkdir ycm_build
cd ycm_build
* brew install cmake* Run cmake from the ycm_build dir:
cmake -G "Unix Makefiles" . ~/.vim/bundle/YouCompleteMe/cpp
* make ycm_coreAnd boom, YouCompleteMe is running for me.
Works amazing. Always had a problem with having to press a button to autocomplete. The cognitive reflection of "okay, I want help completing this word" usually defeats the speed improvement for me.
alias vim='/path/to/mvim -v' $ vim filename vim
anyway in git: you must give it the full path.https://github.com/search?q=%27editor+%3D%27++extension%3A.g...
What I usually do is maintain a set of symlinks in ~/bin/ (which is in my PATH) if they are not already in my PATH (or if I want them to override something else in my PATH, like HEAD builds of various things on occasion), and only use aliases to set default arguments (`ls --color=auto` for example).
error: There was a problem with the editor 'vi'
The full path must be used to get rid of it.Interesting idea, I can see how people in .net who want to look up a little-used Windows API might like to use it being automatic, but the annoyance of the feature outweighs any benefit for my environment.
vi + console + syntax highlighting = my preference. Mind remains uninterrupted, focused, instantly aware of syntax errors, code structure. :)
http://emacswiki.org/emacs/HippieExpand
Yeah, I went there.
I have pathogen installed, which does basically the same thing as Vundle.
Just clone the git repo to your ~/.vim/bundle directory and continue compiling as instructed.
cd ~/.vim/bundle
git clone https://github.com/Valloric/YouCompleteMe.git
cd YouCompleteMe
mkdir ycmbuild
cd ycmbuild
# Do this only if you don't have cmake installed
brew update
brew install cmake
cmake -G "Unix Makefiles" . ~/.vim/bundle/YouCompleteMe/cpp/
make ycm_core
<Restart vim>
Of course, you know that vim does not have remote Java debugging out of the box and that the Java community has long focused on IDEs, so this is not exactly a random benchmark you mention :)
vim is better for a more modular approach which is valuable when you will often need to change platforms, languages, tweak for a new workflow, etc. Know a good remote debugger? Sure, just use that...
(that said, I still wrote a vim plugin to display the php manual function declaration in the status bar when you have your cursor nead the name of a vim function... but just because there is no 'real' IDE for php though)
I recommend vsvim. It is open source and free where viemu costs $99.
http://visualstudiogallery.msdn.microsoft.com/59ca71b3-a4a3-...
What makes you think they're mutually exclusive? For years I've ran Emacs and IntelliJ IDEA both configured to "synch files on change (on disk)" so that I could be synched between Emacs and IDEA. Both were (and still are) always open simultaneously.
Now in Eclipse you can use eclim which either turns Eclipse in server-mode or which allos to use vim as the text editor right in the middle of Eclipse.
There's also emacs-eclim: it's not as advanced but it has the merit to show that there's hope and light at the end of the tunnel.
Thing is: anyone efficient enough with vim/Emacs shall never find the "text editor" part of any idea to come anywhere close to vim/Emacs.
I need to remotely debug code? One shortcut and I'm under IntelliJ IDEA.
I need to efficiently edit files containting text, like source code files, one shortcut and I'm under Emacs...
I hope one day people writing IDEs will realize that no-one has ever written an IDE with a "text editor" that could match vim/Emacs and hence decide, from the start, to make the text editor pluggable.
Edit: Compared to other Vim plugins the installation is a pain in the ass, but it really is as quick as it claims, even on my whoa-fully underpowered eeepc.
One suggestion: when I use SuperTab the name of the file that the suggestion is coming from appears to the right of the suggestion. That would be rather nice to have in this as well, if possible. Otherwise this is perfect, I think I'm finally done with SuperTab.
Edit 2 (sorry): This seems to be ignoring words that are in comments, and not completing anything when editing a comment. Is this toggle-able behavior?
`vim src/**/*.go`
quite nicely.If this plugin works as well as advertised, I'll be extremely happy.
It's almost just as bad over here. I've got maybe 20 lines to try and get this working in my .emacsrc. It's like layers of fossils; first I have a few commented lines fighting through the hippie-expand era, then a few more from the CEDET age, and gobs and gobs of elisp to try and cobble together auto-complete into completion, but even now it doesn't always work right for most of my languages. Maybe I'm just doing it wrong.
One thing that does work excellently is ido for opening files. If you're a vim developer, you should really rip off ido.
Almost all the tools (shells, editors, sql clients) I use; either have (or I made to have) tab completion. This has been true to various degrees for 20years. Tab key to complete is utterly ingrained in my muscle memory.
And, the constantly on, constantly changing completions "suggestions" are utterly distracting.
Would like to see the "engine" plugged into standard vim completion (omnicomplete).
People who think vim completion is poor need to checkout supertab, jedi-vim, and language specific plugins such as python_calltips.
There's been a few requests for keeping the semantic completion engine but turning off the identifier-based engine (this is the "always-on" part) so the feature will be implemented some time soon.
Or maybe someone tried it in Java?
I would really like to have better support for Java in vim(just editing and code completion, I don't debugger in vim). Do you know some useful plugins for this? I tried several (I don't remember the names) and I'm back to old omnicomplete that's in vim.
I'm curious to find out how much effort it would take to extend this to other compiled languages. I don't know enough about javac or GCJ to say.
Fortunately I haven't had to do any Java recently.
This obviously looks better from a cross language point of view, but I wonder also how well the indexing works?
If you do need a console-only vim on arch, it's probably best to build it by hand as you did, since the PKGBUILD in abs for the vim/gvim/vim-runtime set of packages doesn't lend itself well to custom builds.
[0] https://github.com/Rip-Rip/clang_complete/blob/master/doc/cl...
Or maybe howdoi-based completion http://news.ycombinator.com/item?id=5027021
There has been lots of work on intelligent code completion in the SE community. It doesn't seem to be very effective yet, however.
I am too used to IDEs only using prefix, which is often useless to me (I remember the 2nd word but that is it, time to google).
EDIT: I find the idea of a helper window really neat (display documentation, argument names and types, etc.), too bad the vim API isn't there yet.
YCM will feed information to the 'preview' window by default (you just need to have 'preview' in Vim's 'completeopt' option). See the docs.
The website doesn't offer a good explanation. From the docs:
SuperTab I have limited experience with,
but from I understand, it does a half-decent
job at #4, much like neocomplcache.YCM does not seem to integrate with snippets like NeoComplCache does, right? Do you plan to do that in the future? Are there reasons to switch from NeoComplCache if you don't program in languages for which a semantic engine is available?
Thank you for building this, awesome work!
I'll try it, but I'm not hopeful :(
Why does YCM demand such a recent version of Vim? ~
During YCM's development several show-stopper bugs where 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).
Yes, yes, there are hundreds of plugins that offer more powerful stuff.. but I miss so much Command-T.
Couldn't you just populate quickfix instead?
Does anyone know how to get similar level completion in Sublime Text?
#define hypot _hypot
from pyconfig.h (in my python include folder) got me to another hurdle function 'PyObject* boost::python::converter::do_return_to_python(char)' definition is marked dllimport
I have no idea what that means (never touched C++ in my life)Note that shift-tab won't work in the console because the console won't pass that key combo to vim. Again, this can be remapped.