Live data from Hacker News

YouCompleteMe, a Fast, As-You-Type, Fuzzy-Search Code Completion Engine for Vim

val.markovic.io

101–110 of 119 posts

Re: YouCompleteMe, a Fast, As-You-Type, Fuzzy-Search Code Completion Engine for Vim

#102
post #25

Earlier quoted context omitted.

It depends on MacVim on OS X. 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

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…

homebrew-built vim worked fine for me. I followed the manual steps.

Re: YouCompleteMe, a Fast, As-You-Type, Fuzzy-Search Code Completion Engine for Vim

#103
post #101

Wow and it didn't cost $70? :)

I juuuust switched from gVim to Sublime Text. Luckily I havent bought licsense yet :)

If you're any good with substitutions and regex in VIM you'll probably switch right back.

Re: YouCompleteMe, a Fast, As-You-Type, Fuzzy-Search Code Completion Engine for Vim

#104
post #25

Earlier quoted context omitted.

It depends on MacVim on OS X. 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

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…

Vim from Homebrew + YouCompleteMe works for me.

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

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

Re: YouCompleteMe, a Fast, As-You-Type, Fuzzy-Search Code Completion Engine for Vim

#105
What are the advantages of using YCM (and its complicated install) vs something like supertab if you're not a C/C#/Objective-C programmer?

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.

Re: YouCompleteMe, a Fast, As-You-Type, Fuzzy-Search Code Completion Engine for Vim

#106
post #25
post #22

How to install (at least on Linux): 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 Makef…

It depends on MacVim on OS X. 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

I do not use home brew or ports so is there any reason that this would not work with the default vim that ships with macos?

Re: YouCompleteMe, a Fast, As-You-Type, Fuzzy-Search Code Completion Engine for Vim

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

[0] https://github.com/Rip-Rip/clang_complete/blob/master/doc/cl...

Re: YouCompleteMe, a Fast, As-You-Type, Fuzzy-Search Code Completion Engine for Vim

#108
post #51

Earlier quoted context omitted.

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

Re: YouCompleteMe, a Fast, As-You-Type, Fuzzy-Search Code Completion Engine for Vim

#109
post #22

How to install (at least on Linux): 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 Makef…

Just wrote up Gentoo install at http://pastebin.ca/2311021

Re: YouCompleteMe, a Fast, As-You-Type, Fuzzy-Search Code Completion Engine for Vim

#110

Just a note, you don't need Vundle to install this. 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.

Instructions for an OS/X install with Brew, Macvim and Pathogen:

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

Post reply on HN