Add CLAUDE.md and improve clangd configuration

- Add CLAUDE.md with nvim configuration guidance for future Claude instances
- Rename clangd.lua to clangd_helper.lua for better organization
- Document modular structure, LSP setup, and common commands
- Include information about kickstart.nvim fork and conflict-minimizing design

🤖 Generated with Claude Code (claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
dlond 2025-07-26 17:20:57 +12:00
parent 551ee11550
commit 91514ba589
3 changed files with 111 additions and 29 deletions

View file

@ -1,36 +1,57 @@
-- ~/dlond/nvim/lua/custom/plugins/lsp.lua
-- LSP configuration, assuming LSP servers are installed via Nix/Home Manager
local lspconfig = require 'lspconfig'
local capabilities = require('blink.cmp').get_lsp_capabilities()
return {
{
'neovim/nvim-lspconfig',
-- only load when editing these filetypes (optional)
ft = { 'python', 'lua', 'nix', 'rust', 'go' },
opts = function()
local lspconfig = require 'lspconfig'
local capabilities = require('blink.cmp').get_lsp_capabilities()
local servers = {
pyright = {
settings = {
python = {
analysis = {
autoSearchPaths = true,
diagnosticMode = 'openFilesOnly',
useLibraryCodeForTypes = true,
typeCheckingMode = 'basic',
local servers = {
pyright = {
settings = {
python = {
analysis = {
autoSearchPaths = true,
diagnosticMode = 'openFilesOnly',
useLibraryCodeForTypes = true,
typeCheckingMode = 'basic',
},
},
},
positionEncoding = 'utf-8',
},
},
positionEncoding = 'utf-8',
},
},
nixd = {},
ruff = {},
texlab = {},
cmake = {
cmd = { 'cmake-language-server' },
filetypes = { 'cmake' },
root_dir = require('lspconfig.util').root_pattern('CMakeLists.txt', '.git'),
nixd = {},
ruff = {},
texlab = {},
cmake = {
cmd = { 'cmake-language-server' },
filetypes = { 'cmake' },
root_dir = require('lspconfig.util').root_pattern('CMakeLists.txt', '.git'),
},
clangd = (function()
local cmd = { 'clangd', '--background-index' }
return {
cmd = cmd,
filetypes = { 'c', 'cpp', 'objc', 'objcpp', 'cuda' },
root_dir = lspconfig.util.root_pattern('compile_commands.json', '.git'),
single_file_support = true,
-- on_attach = function(client, bufnr)
-- local util = require(custom.plugins.lsp.clangd_helper)
-- util.notify_compile_commands(bufnr)
-- util.start_compile_commands_watcher(client, bufnr)
-- end,
}
end)(),
}
for name, config in pairs(servers) do
config.capabilities = vim.tbl_deep_extend('force', {}, capabilities, config.capabilities or {})
lspconfig[name].setup(config)
end
end,
},
}
for server_name, server in pairs(servers) do
server.capabilities = vim.tbl_deep_extend('force', {}, capabilities, server.capabilities or {})
lspconfig[server_name].setup(server)
end
return {}