From 458c2492668949d4632ac9f14f3c5add2cc9ad6c Mon Sep 17 00:00:00 2001 From: Daniel Weber Date: Sat, 21 Sep 2024 08:48:35 -0400 Subject: [PATCH] Adding the ability to switch between source and header files --- after/plugin/lsp.lua | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/after/plugin/lsp.lua b/after/plugin/lsp.lua index 84f5af8..0f725d9 100644 --- a/after/plugin/lsp.lua +++ b/after/plugin/lsp.lua @@ -45,6 +45,13 @@ vim.api.nvim_create_autocmd('LspAttach', { -- WARN: This is not Goto Definition, this is Goto Declaration. -- For example, in C this would take you to the header. map('gD', vim.lsp.buf.declaration, '[G]oto [D]eclaration') + + -- Add the ability to toggle between source and header files, but only for the + -- clangd clients + local client = vim.lsp.get_client_by_id(event.data.client_id) + if (client.name == "clangd") then + map('th', ":ClangdSwitchSourceHeader", '[T]oggle [H]eader' ) + end end })