Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Code completion for C++ in Vim is actually superior. I'll outline the steps you have to take in order to make it work. However, I won't go into much detail here (such as building huge open-source code base, cloning a repository, installing plugins for Vim, etc.) because otherwise it would be worth writing a large tutorial for novices. So, assuming that you are well-aware and well-prepared software developer, there you go a fluent guide:</p> <ol> <li><p>Get and install <a href="https://github.com/Rip-Rip/clang_complete" rel="nofollow noreferrer">clang_complete</a> (plugin for Vim);</p></li> <li><p>Get and install <a href="https://github.com/Shougo/neocomplcache" rel="nofollow noreferrer">neocomplcache</a> (plugin for Vim);</p></li> <li><p>If you are on Unix, then you are lucky because you probably have <a href="http://llvm.org/" rel="nofollow noreferrer">LLVM</a> and <a href="http://clang.llvm.org/" rel="nofollow noreferrer">Clang</a> either installed on your system already or you have to use package manager and install them with a single command. If so, then you can immediately jump to the last step (#7).</p> <p>If you are on Windows, then you are less lucky, but that's actually better from the practical point of view - you'll have a great experience of building huge stuff on your own and getting things to work no matter what. :)</p> <p>So, if you're on Windows (and using Qt Creator as I can see), then you might have MinGW already installed on your system. If that's not the case, then I strongly suggest that you to install a bleeding-edge <a href="http://mingw-w64.sourceforge.net/" rel="nofollow noreferrer">MinGW-w64</a>. Fortunately, you don't have to compile it yourself as <a href="https://stackoverflow.com/users/256138/rubenvb">rubenvb</a> has kindly built MinGW-w64 toolchain in both variants: <a href="http://sourceforge.net/projects/mingw-w64/files/Toolchains%20targetting%20Win64/Personal%20Builds/rubenvb/gcc-4.7-release/" rel="nofollow noreferrer">targeting 64-bit Windows (aka x64)</a> and <a href="http://sourceforge.net/projects/mingw-w64/files/Toolchains%20targetting%20Win32/Personal%20Builds/rubenvb/gcc-4.7-release/" rel="nofollow noreferrer">targeting 32-bit Windows (aka x86)</a>. Just download one depending on your OS. <strong>NOTE</strong>: These links are pointing to the latest (at the time of writing this answer) stable builds of MinGW-w64, i.e. based on GCC 4.7.2. <strong>IMPORTANT</strong>: Make sure that MinGW-w64 is in the <code>%PATH%</code> environment variable.</p></li> <li><p>Another piece of software needed is <a href="http://cmake.org/cmake/resources/software.html" rel="nofollow noreferrer">CMake</a> (a popular build system). Again, if you are on Unix it might be installed already. If you are on Windows, then just download and install it. <strong>IMPORTANT</strong>: Make sure that CMake is in the <code>%PATH%</code> environment variable.</p></li> <li><p>The last thing we'll need is <a href="http://www.python.org/download/" rel="nofollow noreferrer">Python</a>. Once again, if you are on Unix, then it is already installed on your system. Otherwise, you know what to do already. :) Officially, there are 2 versions of Python: 2.7.3 and 3.x.x - you should definitely download and install both. Python is an essential piece of software on any developer's machine. <strong>IMPORTANT</strong>: Make sure that Python 2.7.3 (not 3.x.x!) is in the <code>%PATH%</code> environment variable.</p></li> <li><p>Now that we have MinGW-w64, CMake, Python installed, we are ready to build LLVM and Clang. To ease the pain go to my <a href="https://bitbucket.org/Haroogan/out-of-source-builders" rel="nofollow noreferrer">Out-of-Source Builders</a> project and scroll down to <strong>Guide: Build 64-bit LLVM and Clang for Windows (64-bit) Using MinGW-w64</strong>. If you are on 32-bit Windows, don't pay attention to <strong>64-bit</strong> (it does not matter) in the title, just follow the instructions there. Wait for about an hour until LLVM and Clang are built.</p></li> <li><p>We are almost done, all that is left is to configure Vim properly. Here I'll simply provide my configuration which would most likely satisfy your needs.</p></li> </ol> <p>Configure <code>neocomplcache</code>:</p> <hr> <pre><code>let g:neocomplcache_enable_at_startup = 1 let g:neocomplcache_enable_smart_case = 1 let g:neocomplcache_enable_camel_case_completion = 1 let g:neocomplcache_enable_underbar_completion = 1 let g:neocomplcache_min_syntax_length = 2 if !exists('g:neocomplcache_force_omni_patterns') let g:neocomplcache_force_omni_patterns = {} endif let g:neocomplcache_force_overwrite_completefunc = 1 let g:neocomplcache_force_omni_patterns.c = '[^.[:digit:] *\t]\%(\.\|-&gt;\)' let g:neocomplcache_force_omni_patterns.cpp = '[^.[:digit:] *\t]\%(\.\|-&gt;\)' \ . '\|\h\w*::' let g:neocomplcache_force_omni_patterns.objc = '[^.[:digit:] *\t]\%(\.\|-&gt;\)' \ . '\|\h\w*::' let g:neocomplcache_force_omni_patterns.objcpp = '[^.[:digit:] *\t]\%(\.\|-&gt;\)' \ . '\|\h\w*::' inoremap &lt;expr&gt; &lt;Tab&gt; pumvisible() ? "\&lt;C-n&gt;" : "\&lt;Tab&gt;" inoremap &lt;expr&gt; &lt;S-Tab&gt; pumvisible() ? "\&lt;C-p&gt;" : "\&lt;S-Tab&gt;" </code></pre> <p>Configure <code>clang_complete</code>:</p> <hr> <pre><code>let g:clang_use_library = 1 let g:clang_auto_select = 0 let g:clang_complete_auto = 0 let g:clang_complete_copen = 1 let g:clang_complete_macros = 1 let g:clang_complete_patters = 1 let g:clang_library_path = 'D:/Toolchains/x64/LLVM/3.3/bin' let g:clang_auto_user_options = 'path, .clang_complete' </code></pre> <p>For more information on both of these plugins use Vim's help documentation: <code>:h clang_complete</code> and <code>:h neocomplcache</code>. There are lots of options to tweak, especially in <code>neocomplcache</code>. From my point of view both plugins are <strong>must have</strong> for any C++ developer who uses Vim.</p> <p><strong>NOTE</strong>: If you don't know how to complete some of the steps listed here, you would have to either ask additional questions here on StackOverflow or look elsewhere for the reason described in the beginning of this answer.</p> <p>I hope this helps and you would favor Vim more for your development efforts from now. :)</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload