title: namespace aware omnicomplete in vim
body: <p>I have been trying to find an answer to my trouble with no luck, so here is my question.</p>
  
  <p>Our C++ classes are defined in several namespaces. So, frequently, class members have a type that belongs to other namespace. For those cases, vim's omnicompletion feature does not work. STL members and local variables can be used with omnicompletion without trouble. The trouble seems be to when the variable type of a member has namespace scope identifier, regardless it is its own namespace or other one. <code>:ts tagname</code> command works always.</p>
  
  <p>Little dummy example:</p>
  
  <pre><code>namespace T { namespace N2 {
  class Lorry
  {
  public:
      Lorry(){}
      void printInfo(){
      }
  private:
      int speed;
  };
  
  }}
  
  namespace T { namespace N2 {
  class Truck
  {
      public:
          Truck();
          void printInfo();
      private:
          Lorry lorry;
          N2::Lorry lorry2; 
  };
  
  }}
  
  namespace T { namespace N2 {
  Truck::Truck(){}
  void Truck::printInfo(){
  lorry.printInfo();  // Omnicompletion works
  lorry2.            // Omnicompletion does not work. Pattern not found!
  
  }
  }}
  </code></pre>
  
  <p>I generate tags file using the following map:</p>
  
  <pre><code>map &lt;C-F12&gt; :!ctags -R --c++-kinds=+pl --fields=+iaS --extra=+q --language-force=C++ .&lt;CR&gt;
  </code></pre>
  
  <p>and some configuration from .vimrc:</p>
  
  <pre><code>let OmniCpp_MayCompleteDot = 1 " autocomplete with .
  let OmniCpp_MayCompleteArrow = 1 " autocomplete with -&gt;
  let OmniCpp_MayCompleteScope = 1 " autocomplete with ::
  let OmniCpp_SelectFirstItem = 2 " select first item (but don't insert)
  let OmniCpp_NamespaceSearch = 2 " search namespaces in this and included files
  let OmniCpp_ShowPrototypeInAbbr = 1 " show function prototype (i.e. parameters) in popup window
  let OmniCpp_LocalSearchDecl = 1 " don't require special style of function opening braces
  let OmniCpp_GlobalScopeSearch = 1
  let OmniCpp_ShowAccess = 1
  </code></pre>
  
  <p>Thanks in advance</p>