title: Configure .ccls file for Vim
body: <p>I have no idea what I am doing. I decided to use Vim as my only editor, I'm trying to set up autocompletion and syntax checking.</p>
  <p>So I need to configure a <code>.ccls</code> file in the root of my project (and I don't want to generate a <code>compile_commands.json</code> file so please don't tell me about it). But there is no detailed documentation whatsoever on <code>.ccls</code> because all it does is use compiler flags, which of course I don't know; I have started not too long ago in C++ and I don't know any CMake, I was used to just run my code from the IDE!</p>
  <p>I know that the default code to put in my <code>.ccls</code> is the path to my includes, which I do put (which are 5 paths that I get using <code>clang++ -E -x c++ - -v &lt; /dev/null</code>) and I'm on mac btw. I put these, I get autocompletion, but my source breaks with errors telling things like iostream and every other header does not exist in <code>/usr/local/include</code> even though I provided 4 other paths (it really doesn't exit in <code>/usr/local/include</code> I don't know where iostream and those others are) and that I can't <code>cout &lt;&lt; &quot;Hello, World!&quot; &lt;&lt; endl</code> for example because ostream and <code>char[]</code> are incompatible and things like that. BTW even if I use <code>compile_commands.json</code> I still get errors it only fixes my header paths.</p>
  <p>Can someone just explain how to use <code>.ccls</code>? No links, just plain explanation. Or at least a default configuration to get me going.</p>
  <p>P.S Do I also need to provide paths to my project's header files?</p>
  <p>This is my <code>.ccls</code>:</p>
  <pre><code>clang++
  %cxx -std=c++17
  %cxx -stdlib=libc++
  %hxx --include=Global.h
  %cxx -I/usr/local/include
  %cxx -I/Library/Developer/CommandLineTools/usr/bin/../include/c++/v1
  %cxx -I/Library/Developer/CommandLineTools/usr/lib/clang/12.0.0/include
  %cxx -I/Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk/usr/include
  %cxx -I/Library/Developer/CommandLineTools/usr/include
  </code></pre>