10

I'm using vim on ubuntu 16.04 platform, I found the Youcompleteme plugin always automatically add some unnecessary header file.

A simple example like I use libtorch, the torch/torch.h header file contains all headers the package needed, and don't need specifying any other related header. Just like the pictures below:

enter image description here

The completion works well, but after I use space select the completion, the unwanted header torch/nn/module.h> was added automatically. enter image description here

I want to get a configure to disable automatically adding header files like this.

Any reply will be appreciated!

Wechar Yu
  • 237
  • 3
  • 12
  • 1
    And old question, but for someone else looking for this or other `youcompleteme`-related topics, the best places to ask are listed in the _Help, Advice, Support_ section of [YouCompleteMe](https://github.com/ycm-core/YouCompleteMe), which has a link to the [contacts](https://github.com/ycm-core/YouCompleteMe#contact). – Enlico Mar 21 '20 at 14:32

1 Answers1

9

I stumbled upon this problem when I switched from libclang based YCM to clangd based. The guys on the community chat helped to figure out the solution: you can add the following line into your ~/.vimrc file:

let g:ycm_clangd_args=['--header-insertion=never']

Read :help g:ycm_clangd_args and ./clangd --help-list for details on these options. It turns out there are plenty of cool configuration tweaks for clangd.

Oleg Andriyanov
  • 5,069
  • 1
  • 22
  • 36