From f2f2b2a98a7aeaadfc4103d5fe725d149e27a43b Mon Sep 17 00:00:00 2001 From: Bruno BELANYI Date: Wed, 2 Mar 2022 20:25:42 +0100 Subject: [PATCH] home: vim: prefer 'clangd' to 'clang-format' Only use `clang-format` if `clangd` is not available, as its formatting is otherwise built into the LSP server. --- home/vim/plugin/settings/null-ls.vim | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/home/vim/plugin/settings/null-ls.vim b/home/vim/plugin/settings/null-ls.vim index c241935..e00fa62 100644 --- a/home/vim/plugin/settings/null-ls.vim +++ b/home/vim/plugin/settings/null-ls.vim @@ -9,8 +9,10 @@ null_ls.setup({ -- C, C++ null_ls.register({ null_ls.builtins.formatting.clang_format.with({ - -- Only used if available - condition = utils.is_executable_condition("clang-format"), + -- Only used if available, but prefer clangd formatting if available + condition = function() + return utils.is_executable("clang-format") and not utils.is_executable("clangd") + end, }), })