Quick Recipe to Enable clang_complete on Vim

It’s been a long time since my friend Thiago wisely taunted me to start using clang on vim scripts (and on everywhere else too). I finally made some time to take a look on it, mostly because of this excellent rant on the subject.

The core of the problem is that OmniCppComplete isn’t a compiler and you can’t expect something that isn’t a compiler to fully understand code. — Guy Rutenberg

So, here comes my quick recipe to get it running on vim7.3+ with python support. I assume you already have your vim setup under revision control and use pathogen to group multiple bundles (these requirements are so lame that I refuse to spend any time to justify them ;-) ).

  1. install clang and partners
  2. remove omnicppcomplete bundle as in this answer
  3. create new bundle
  4. fine tune clang_complete settings
  5. profits ;-)

Done! C/C++ code completion at the tip of your fingers.

Just as disclaimer, there are still some rough edges on the clang_complete script, e.g.

  1. the preview window is not informative at all (better to disable with :set completeopt-=preview)
  2. you need to manually reload source files after updating .clang_complete files (just a problem on initial setups)

However, these do not spoil the overall experience at all. The next step will be to install Ubuntu 12.04 for libclang-dev usage (much faster than using clang command).

Tags: ,

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code class="" title="" data-url=""> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> <pre class="" title="" data-url=""> <span class="" title="" data-url="">