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
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.
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.
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.)
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.
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 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).
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.
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.
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)."
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.
> 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?
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.
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. :)
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
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.
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"
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).
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?
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.
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.
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.
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.
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).
118 comments
[ 3.1 ms ] story [ 134 ms ] threadEdit: 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?
[1] https://bitbucket.org/ns9tks/vim-autocomplpop/
https://github.com/eikenberry/acp
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.
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.
Couldn't you just populate quickfix instead?
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.
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.
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].
[0] https://github.com/altercation/solarized/issues/60
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:
* brew install cmake* Run cmake from the ycm_build dir:
* 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.
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).
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. :)
Does anyone know how to get similar level completion in Sublime Text?
This obviously looks better from a cross language point of view, but I wonder also how well the indexing works?
http://emacswiki.org/emacs/HippieExpand
Yeah, I went there.
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!
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.
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.
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).
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>