The LSP makes me feel extremely under siege, especially since seemingly every LSP server insists on throwing hundreds of totally useless style warnings.
I would really like the diagnostics to be toggle-able, defaulting to OFF, but for the LSP server to start running in the background when I start neovim whether I use the diagnostics or not.
The current API doesn’t seem to provide particularly great ways of doing this… I can probably hobble something together with the documented functions, but it won’t be pretty… and in my early experiments with this I have utterly failed to get neovim to start with diagnostics off.
autocmd BufEnter * lua vim.lsp.diagnostic.disable() will probably do what you want. You can map a key to lua vim.lsp.diagnostic.enable()
Note, there is no turning diagnostics on or off, only turning the display of diagnostics on/off. Most servers send diagnostics regardless of if we report the diagnostic capability. You should also look into configuring your language server to remove style warnings you do not want.
vim.diagnostic.disable() will disable diagnostics globally. Likewise, enable() enables them globally. Pass a buffer number as the first argument to either function to disable/enable diagnostics only for the given buffer (0 means “current buffer”).
All of this (and more) is mentioned in the docs. :h vim.diagnostic