diff options
author | crupest <crupest@outlook.com> | 2023-10-03 20:56:33 +0800 |
---|---|---|
committer | crupest <crupest@outlook.com> | 2023-10-03 21:19:01 +0800 |
commit | eb11cc2ecae59971fe709fb8a7d0b4e2cdb24d93 (patch) | |
tree | 4da439b81ba1a45ef72c1bdd3e69133dbf0037e8 | |
parent | a220a0329bf57b1594f9d0e228e8729e85fbe1e1 (diff) | |
download | crupest-eb11cc2ecae59971fe709fb8a7d0b4e2cdb24d93.tar.gz crupest-eb11cc2ecae59971fe709fb8a7d0b4e2cdb24d93.tar.bz2 crupest-eb11cc2ecae59971fe709fb8a7d0b4e2cdb24d93.zip |
Update nvim configs. Detect brew clangd.
-rw-r--r-- | configs/nvim/lua/crupest/nvim/lsp/c.lua | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/configs/nvim/lua/crupest/nvim/lsp/c.lua b/configs/nvim/lua/crupest/nvim/lsp/c.lua index aa96f49..28edae0 100644 --- a/configs/nvim/lua/crupest/nvim/lsp/c.lua +++ b/configs/nvim/lua/crupest/nvim/lsp/c.lua @@ -1,9 +1,19 @@ local lspconfig = require("lspconfig") local capabilities = require("cmp_nvim_lsp").default_capabilities() +local get_exe = require("crupest.system.find").get_exe + +local brew_clangd_path = "/usr/local/opt/llvm/bin/clangd" local function setup_lsp_c() + local clangd = "clangd" + + if get_exe(brew_clangd_path) then + clangd = brew_clangd_path + end + -- setup lsp clangd lspconfig.clangd.setup { + cmd = { clangd }, capabilities = capabilities, on_attach = function(_, bufnr) vim.keymap.set('n', '<space>s', "<cmd>ClangdSwitchSourceHeader<cr>", { |