Setup the directory structure to handle both mac and linux, and stowing with only one command, well two, one for the OS specific dir as well.
This commit is contained in:
parent
5759f6a798
commit
bc87253453
65 changed files with 0 additions and 0 deletions
54
home/.config/nvim/lua/language_servers/clangd.lua
Normal file
54
home/.config/nvim/lua/language_servers/clangd.lua
Normal file
|
|
@ -0,0 +1,54 @@
|
|||
local function switch_between_header_and_source(bufnr)
|
||||
local util = require("lspconfig/util")
|
||||
bufnr = util.validate_bufnr(bufnr)
|
||||
local clangd_client = util.get_active_client_by_name(bufnr, "clangd")
|
||||
local params = { uri = vim.uri_from_bufnr(bufnr) }
|
||||
-- invert this with an early return
|
||||
if not clangd_client then
|
||||
print "method textDocument/switchSourceHeader is not supported by any servers active on the current buffer"
|
||||
return
|
||||
end
|
||||
|
||||
clangd_client.request("textDocument/switchSourceHeader", params, function(err, result)
|
||||
if err then
|
||||
error(tostring(err))
|
||||
end
|
||||
if not result then
|
||||
print("Corresponding file cannot be determined")
|
||||
return
|
||||
end
|
||||
vim.api.nvim_command("drop " .. vim.uri_to_fname(result))
|
||||
end, bufnr)
|
||||
end
|
||||
|
||||
local M = {
|
||||
cmd = {
|
||||
"clangd",
|
||||
"--background-index",
|
||||
"--clang-tidy",
|
||||
"--completion-style=bundled",
|
||||
-- "--cross-file-rename", // This has been deprecated
|
||||
"--rename-file-limit=0",
|
||||
"--header-insertion=iwyu",
|
||||
"--inlay-hints",
|
||||
"--compile-commands-dir=build/",
|
||||
},
|
||||
commands = {
|
||||
ClangdSwitchSourceHeader = {
|
||||
function()
|
||||
switch_between_header_and_source(0)
|
||||
end,
|
||||
description = "Switch between source/header",
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
function M.post_setup()
|
||||
require("utils").add_keymaps({
|
||||
n = {
|
||||
["<leader>ko"] = { cmd = ":ClangdSwitchSourceHeader<CR>" }
|
||||
},
|
||||
})
|
||||
end
|
||||
|
||||
return M
|
||||
Loading…
Add table
Add a link
Reference in a new issue