When I searched for this I saw an answer on Reddit which did not work.
I created the ~/.config/clangd/config.yaml file and using clangd's documentation I found out I needed to put:
Completion:
HeaderInsertion: Never
Back in Vim, #include statements are still being thrown in willy-nilly. This is incredibly annoying because its inserting C++ libraries when I am using C, and its throwing around unnecessary duplicate includes when I already have a header with all the common includes used throughout the project.
Does anyone use clangd as an LSP in Vim? How do I configure it properly? Where am I supposed to put the config?
Edit: I think my clangd is outdated, as its version 11. I got it through vim-lsp. If I install a newer version into my $PATH will it work with Vim?
Edit2: I solved my own problem. For anyone in the future who is having this issue, the configuration to prevent header insertion is available in clangd-21 or newer. You can simply install the newer clangd using your package manager, on Fedora its dnf install clang-tools-extra. The vim-lsp plugin will automatically use it if its in your system path, which your package manager will handle for you.