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.
It doesn't really depend on MacVim, that's just a binary distribution of Vim for Macs that is proven to work.
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.
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.
> It doesn't really depend on MacVim, that's just a binary distribution of Vim for Macs that is proven to work.
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?
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).
Urk. After using this awhile I don't like the context spam and have disabled 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. :)
Thanks, I was wondering what where the plugins for emacs for autocomplete. How does HippieExpand compare to autocomplete.el? I'll try to test HippieExpand today!
IIRC hippie-expand requires users to press a keyboard shortcut (like omni-complete in vim). This plugin seems to always present a completion menu (updated after every keypress).
I want to see developers who are experts in IDea, emacs, vim, etc. face off to code a variety of projects in several languages/frameworks side by side in each editor/IDE so we talk about the empirical differences. vim is a lot faster for many things, but I wonder how well it compares when you need to debug Java remotely (in a container on another server), for example.
If all you will do is write Java, and things like integrating remote debugging into your text editor are critical, and you don't care about vim's way of working, then you can find better options for that, definitely. IDEA is a great, well-polished specialist tool. You don't need a shootout to see this clearly.
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...
The vim editor is awesome, but all this 'bolt on a bunch of stuff to make vim more like an IDE' is misguided imo. If you use Java, use eclim for a vim-like experience in Eclipse; if you use Visual Studio, use viemu.
(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 haven't used it but is PhpStorm no 'real' IDE for PHP? There's a vim plugin for various JetBrains products too (including PhpStorm) and it works well with IDEA.
"I want to see developers who are experts in IDea, emacs, vim, etc. face off..."
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.
Brilliant. My only concern is that the completion suggestions could cover text on other lines that I might be looking at, but I suppose this will serve to encourage me to stay out of insert mode unless necessary.
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?
autocomplop[1] is easier to install, but not as sophisticated. I just installed it to see if I like the idea of having completions pop up automatically.
I forked autocomplpop a while back to fix a couple issues and make it easier to add new language support. Never noticed a speed issue. I always preferred acp vs the others due to its simplicity.
Aye. I remember having problems with autocomplop though when I had a rather large amounts of text open at once; YouCompleteMe seems like an improvement in that regard though. Handled
Haven't had a chance to try this yet, but I can definitely say that this was a serious sore spot for vim. AutoComplPop is great (and is what I use), but it lacks Fuzzy Search which is very important to me. I tried installing NeoComplCache, but even after spending a lot of time on it, couldn't get it working properly - plus, it slowed down vim, by a LOT. I'm talking, opening a buffer took a visible amount of time.
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.
I second that, NeoComplCache is just too slow, I had issues where it simply hung vim for 2-3 seconds every time I tried to complete something, completely negating any speedup I might get from completing.
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.
It's a pity that it doesn't support Java, it's more or less also a C family language (if one puts Objective-C and C++ in same bucket as pure C).
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.
Yes, quoting from the article: "All of the above works with any programming language because of the identifier-based completion engine. It collects all of the identifiers in the current file and other files you visit and searches them when you type (identifiers are put into per-filetype groups)."
I ran into a couple of issues while building vim with python support (which I haven't needed until now). I have arch linux and python3 was symlinked to /usr/bin/python, the build script cached this and once I fixed the symlink to point to /usr/bin/python2 it was still giving an error. I manually fixed the check in the build script, compiled, but then the plugin didn't recognize +python/dyn so I had to rebuild without python3 support. It seems to be working now and I'm compiling ycm_core. Also, if you're going to be building vim anyway, --enable-rubyinterp and check out the command-t plugin.
On Arch the 'gvim' package also includes a more featureful console vim, including python (2, not 3) support built-in. The downside is that the dependencies for gvim include GTK and a good chunk of X11.
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.
Having both python2 and python3 enabled in your Vim can lead to nasty results. I remember Vim used to crash if you source a python2 file into it (thus starting the python2 interpreter) and a python3 file some time later (thus also starting the python3 interpreter). They didn't seem to like existing in the same process.
One thing I miss form clang_complete is its snippet support for functions [0]. With clang_complete you could set it up so when you autocompleted a function, it would generate a temporary snippet in your favourite snippet engine (ultisnips, snipmate, etc) so you could jump between the parameters of the function.
aside: What about context sensitive/markov completion, backed by say github/google code? And if the prediction was certain enough, offer multi-line completions. This would be helpful in languages/situations that need boilerplate for common tasks, that you'd usually google-paste.
One of the projects I dream about doing is to use github/google/... code as a corpus to feed into a deep neural network, which could then perhaps do what you are talking about. However, more work needs to be done on how to represent the code and train the models.
There has been lots of work on intelligent code completion in the SE community. It doesn't seem to be very effective yet, however.
One can also take types into account for completion. There is a Scala Eclipse IDE plugin that does it: http://lara.epfl.ch/w/insynth (it's a research project).
For those have a project with an existing .clang_complete file (used to pass options to the compiler with the clang_complete Vim plugin), this gist [1] will allow you to reuse that file with YouCompleteMe. Better I suppose would be a patch to detect a .clang_complete file in YCM directly...
You can still get such a helper window, just not in a convenient place. Vim's 'preview' window is there to show such information (docs, arg names and types), but it pops up at the top of the screen instead of right next to the completion window.
YCM will feed information to the 'preview' window by default (you just need to have 'preview' in Vim's 'completeopt' option). See the docs.
A question for syncontrol if you are not tired answering comments yet :)
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?
I like the concept and awesome for the fellow to release it... however in the past the following have seriously messed up any attempts of mine to get sensible autocompletion in vim: working in cygwin, projects > 2mil lines of code, and varying types of build infrastructures.
I like it quite a bit, and I think it's a bit better than the other options (a few of which I've tried). My only question remaining is why can't the others be updated and improved? Maybe someone with a bit more knowledge of the "culture and history" can explain. Great piece of software, though!
vim plugins are really easy to dash off and can emerge naturally from scratching one's own itches. So they tend to be developed by individuals more often than teams and there is unfortunately some tendency to make a new project rather than co-opting existing ones, particularly when it is performance sensitive as in this case - it may be simpler to just write one designed for performance than to try to retrofit better performance onto a design which isn't well cut out for it.
You can, just follow these simple, but detailed instructions for Ubuntu users for upgrading vim:
https://github.com/Valloric/YouCompleteMe/wiki/Building-Vim-...
To not mess with system-installed vim: remove --prefix option and VIMRUNTIMEDIR, then build and install with sudo make install, which will put the files in /usr/local.
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).
Does anyone know of something similar but for all text on an OS? I.e. I find my self repeatedly typing in the same strings in a variety of applications (browser, editor, etc) - would love for an autocomplete app that is OS wide and learns from what I type.
What I want is an OS-level autocorrect like vim's abbreviations. I'm getting used to not having to care about making typos because they get fixed automatically.
This looks great. Non-semantic completions (for languages not covered by libclang) are very useful as well. I'm an emacs person and dabbrev-expand saves me a lot of typing in any mode.
That's still a window that's not right next to the completion menu. If I wanted to use a separate window far away from the menu, I'd use the 'preview' window that was designed for this (and YCM does use it, because there's nothing else on the table).
Have you checked the "balloon help" functionality? This was intended for use with mouse and windows for things like tooltips, but I think it may be general enough to expand for use you're looking for. My memory isn't so great but I fooled around with it a couple years ago; if you haven't checked it out you may want to. See ':h balloon'
I just looked back into use of the Vim 'balloon' feature. I think the ballooneval and balloonexpr would do the job fine, the only fly in the ointment is that the help window is tied to the mouse cursor position in two ways. First, the window can be triggered to appear only if the mouse cursor is on a character in the Vim window, not if it's in blank area (e.g., to right of text) or not in the Vim window at all. Second, the help window is always positioned with upper left corner at mouse cursor position. I don't think Vimscript offers any way to position the mouse cursor programmatically, which is what it would take to make Vim's balloons work for desired sort of help display. Perhaps Python could be used to position the mouse; might not be so bad given that Python is required for YCM already. Would require being able to map Vim text cursor position to global desktop xy grid (':winpos' might help) and move mouse cursor to it. . . (Or alternatively hack the Vim source to allow alternative coordinates (e.g., text cursor position) for display of balloon window.)
This is ready more or less built in to sublime 3. I saw the video on this and thought "oh neat, I've been doing that for a few days now in sublime text 3"
I haven't tried, but I've done everything possible to keep both the code and the build system cross-platform. I've written OSS cross-platform C++ code using Boost before (with CMake as the build system) and had it working on Windows, Mac, Linux and FreeBSD without modification. I've applied the same principles here, just haven't tested it on Windows or written docs on how to get it working there. But it's doable, certainly.
I'm having some issues compiling it on windows at the moment, specifically when compiling BoostParts. Saying "::hypot has not been declared". I'll update if I get it to compile
ESC will do it. But you shouldn't really need to. You just continue typing and the menu goes away and pops back as needed. It does its best to be unobtrusive.
If your going to use Snipmate, you may want to remap the completion selection key from TAB to something else (if you want to use TAB for Snipmate). See the docs for details.
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.