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:
The completion works well, but after I use space select the completion, the unwanted header torch/nn/module.h>
was added automatically.
I want to get a configure to disable automatically adding header files like this.
Any reply will be appreciated!
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.