The 2024 Wheel Reinvention Jam is in 16 days. September 23-29, 2024. More info

YouCompleteMe - Vim Completion Engine

YouCompleteMe was mentioned on one of our chats, and I am quite satisfied with it. It's certainly nicer than auto-completing with <Ctrl> + N. If you're a Vim user, this code-completion engine obsoletes many plugins such as neocomplcache, clang_complete, and supertab.



P.S. Thanks to our new user, DragoonX6, who brought it to our attention.

Edited by Abner Coimbre on
In addition to that, YouCompleteMe supports custom configuration via python and supports the loading of compilation_database.json to load the appropriate compile flags for each file.

It does have some issues on Windows due to the NTFS filesystem, which incidentally also happens with other IDEs using libclang for code completion. The issue being that libclang keeps the file compilation_database.json open and thus your build might fail because it is in use. The workaround to is to run ":YcmRestartServer" before you build, or write some python code to deal with this issue.
Because of an issue with libclang, saving implementation headers (headers included at the end of another header) will end up in vim telling you it's write protected, simply use ":YcmRestartServer" and save.

Edit: A good starting point for your YCM python configuration is the .ycm_extra_conf.py from YCM itself: https://github.com/Valloric/ycmd/...dabda5/cpp/ycm/.ycm_extra_conf.py

Edited by DragoonX6 on
Can confirm. I've used it, and it works pretty well when configured right.
I think the hardest part of using it is figuring what to do with the .ycm_extra_conf.py

Once you've got that worked out, then you will be good.

Of course, you need to make sure you have a vim install compiled with python, and the initial compile takes awhile downloding a clang version, but this is only once.

If you're on Linux then it just works in my experience.
DragoonX6
In addition to that, YouCompleteMe supports custom configuration via python and supports the loading of compilation_database.json to load the appropriate compile flags for each file.

It does have some issues on Windows due to the NTFS filesystem, which incidentally also happens with other IDEs using libclang for code completion. The issue being that libclang keeps the file compilation_database.json open and thus your build might fail because it is in use. The workaround to is to run ":YcmRestartServer" before you build, or write some python code to deal with this issue.
Because of an issue with libclang, saving implementation headers (headers included at the end of another header) will end up in vim telling you it's write protected, simply use ":YcmRestartServer" and save.

Edit: A good starting point for your YCM python configuration is the .ycm_extra_conf.py from YCM itself: https://github.com/Valloric/ycmd/...dabda5/cpp/ycm/.ycm_extra_conf.py


This is good to know. I've been having a lot of trouble with this for the last few months. Thank you for the information!

Edited by Timothy Wright on
abnercoimbre
YouCompleteMe was mentioned on one of our chats, and I am quite satisfied with it. It's certainly nicer than auto-completing with <Ctrl> + N. If you're a Vim user, this code-completion engine obsoletes many plugins such as neocomplcache, clang_complete, and supertab.



P.S. Thanks to our new user, DragoonX6, who brought it to our attention.


I was thinking of doing a handmade vim series of videos. Do you think anyone would be interested? I know "some" people prefer Emacs but that's just crazy talk.
abnercoimbre
YouCompleteMe was mentioned on one of our chats, and I am quite satisfied with it. It's certainly nicer than auto-completing with <Ctrl> + N.


What does it offer above <C+n>
I'd love to see a handmade vim series :)
CaptainKraft
abnercoimbre
YouCompleteMe was mentioned on one of our chats, and I am quite satisfied with it. It's certainly nicer than auto-completing with <Ctrl> + N.


What does it offer above <C+n>


Intelligent C++ code completion via libclang. libclang parses your code as you go, and thus fully understands your types.
So you will never have to guess what functions, types, and variables are available to you in a namespace or class.
I would be interested in VIM videos.
MandleBro
I would be interested in VIM videos.


That's two for a series. One more and I think it may have to happen.

Note: I spent about 4 hours yesterday fighting with Ycm because I upgraded and Clang 4.0 is broken. *sigh
I'd be interested in filling the gaps in my vim-knowledge, but I'm not convinced that a video series is the format that I'd most like to do that in.

Off the top of my head I can think of two kinds of educational Vim videos that I'd watch: Videos that inform the viewer about some capability that the editor/a plugin has that they probably didn't know about and videos that provide the viewer with information that lets them solve a problem they know about, but cannot solve themselves.

I can picture the first kind of video being useful provided they are not too long (or at least that it is possible to watch a short segment of it to get most of the essential information, where "short" is something like 2-3 minutes). The reason for the shortness is that I'm not really compelled to be a vim-ninja for the sake of being a vim-ninja. I don't want to watch a 30 minute video about a solution to a problem that I probably don't have (and have to wait until 5 minutes in before I even find out what said problem *is*). This leads me to believe that this sort of information is better shared in text or some other form, where it is easy to skip around to whatever part(s) are useful/informative to you. Also I suspect this sort of thing often doesn't require a lot of information, for example "You can delete every line matching a pattern with :g/<pattern>/d" is one I discovered the other day.

The second kind of video is obviously useful, I recall trying to setup Ycm myself a year or two ago and having a really hard time of it. A video on how to do this would have been useful (and may well already exist, I don't think I checked). One thing about videos of this nature is that there is a huge variety of possible things people might want to know, and chances are that only a small fraction of all the people that might watch your videos are experiencing that particular problem. At this very moment I experience problems that vary massively just in the complexity of the problem, all the way from "How do I scroll one line up/down?" (I know there's a key to do this, but can never remember what it is) to "Why does Syntastic not appear to detect/be able to use any OmniSharp checkers". For smaller problems there's google, for larger problems...I guess there's VimL? (Which I personally have little interest in learning).

So I'm....cautiously interested. What sort of things would you cover?
My current list of topic ideas:

Installation On Windows
-----------------------
Setting the path
Locations of files
_vimrc and vimfiles

Vimtutor
------------
What is it
Demonstration
Do it for a week

Using Help
-----------
Why help is important
Opening Help
Navigating Help

Other Stuff
--------------
Vimrc
Color schemes
Changing temp and backup file locations
Mapping key bindings
What is the leader key anyway
Edit and Source the vimrc
Adding in Windows.rc for better cut-n-paste
Really Helpful key bindings
Tabs and Windows
Vim as a language
Horizontal and Vertical selection
Syntax
Ctags
Installing Plugins
NerdTree
Ctrlp
delimitMate
NerdCommenter
Vim-autotag
YouCompleteMe
vim-easymotion

I also would like to improve my vim knowledge. And I think text is a better way as pointed out by D3zmodos. A plain text file that you can have locally and open it in vim for quick access.
I guess this makes sense the more I think about it. It's hard to do a video because it's all typing which doesn't translate to a video.

Maybe a combination of files, written tutorial, and videos for hard things like Ycm installation.

Hmmm...