mirror of
https://github.com/harivansh-afk/nvim.git
synced 2026-04-15 07:04:47 +00:00
gutentags -> lsp
This commit is contained in:
parent
6e8e6e28dc
commit
6da7199231
4 changed files with 53 additions and 160 deletions
|
|
@ -1,95 +0,0 @@
|
|||
return {
|
||||
{
|
||||
"ludovicchabant/vim-gutentags",
|
||||
event = "VeryLazy",
|
||||
config = function()
|
||||
-- Store tags in a cache directory to keep project clean
|
||||
vim.g.gutentags_cache_dir = vim.fn.expand("~/.cache/nvim/ctags")
|
||||
|
||||
-- Enable both ctags and LSP to work together
|
||||
vim.g.gutentags_modules = { "ctags" }
|
||||
|
||||
-- Configure ctags generation
|
||||
vim.g.gutentags_ctags_extra_args = {
|
||||
"--tag-relative=yes",
|
||||
"--fields=+ailmnS",
|
||||
"--languages=Python,JavaScript,TypeScript,Go,Rust,C,C++,Lua",
|
||||
"--python-kinds=-i", -- Exclude imports
|
||||
}
|
||||
|
||||
-- Don't generate tags for these directories
|
||||
vim.g.gutentags_ctags_exclude = {
|
||||
"*.git",
|
||||
"*.svg",
|
||||
"*.hg",
|
||||
"*/tests/*",
|
||||
"build",
|
||||
"dist",
|
||||
"*sites/*/files/*",
|
||||
"bin",
|
||||
"node_modules",
|
||||
"bower_components",
|
||||
"cache",
|
||||
"compiled",
|
||||
"docs",
|
||||
"example",
|
||||
"bundle",
|
||||
"vendor",
|
||||
"*.md",
|
||||
"*-lock.json",
|
||||
"*.lock",
|
||||
"*bundle*.js",
|
||||
"*build*.js",
|
||||
".*rc*",
|
||||
"*.json",
|
||||
"*.min.*",
|
||||
"*.map",
|
||||
"*.bak",
|
||||
"*.zip",
|
||||
"*.pyc",
|
||||
"*.class",
|
||||
"*.sln",
|
||||
"*.Master",
|
||||
"*.csproj",
|
||||
"*.tmp",
|
||||
"*.csproj.user",
|
||||
"*.cache",
|
||||
"*.pdb",
|
||||
"tags*",
|
||||
"cscope.*",
|
||||
"*.css",
|
||||
"*.less",
|
||||
"*.scss",
|
||||
"*.exe",
|
||||
"*.dll",
|
||||
"*.mp3",
|
||||
"*.ogg",
|
||||
"*.flac",
|
||||
"*.swp",
|
||||
"*.swo",
|
||||
"*.bmp",
|
||||
"*.gif",
|
||||
"*.ico",
|
||||
"*.jpg",
|
||||
"*.png",
|
||||
"*.rar",
|
||||
"*.zip",
|
||||
"*.tar",
|
||||
"*.tar.gz",
|
||||
"*.tar.xz",
|
||||
"*.tar.bz2",
|
||||
"*.pdf",
|
||||
"*.doc",
|
||||
"*.docx",
|
||||
"*.ppt",
|
||||
"*.pptx",
|
||||
"__pycache__",
|
||||
".venv",
|
||||
"venv",
|
||||
}
|
||||
|
||||
-- Create cache directory if it doesn't exist
|
||||
vim.fn.mkdir(vim.fn.expand("~/.cache/nvim/ctags"), "p")
|
||||
end,
|
||||
},
|
||||
}
|
||||
|
|
@ -1,66 +1,21 @@
|
|||
return {
|
||||
{ "neovim/nvim-lspconfig", lazy = false },
|
||||
{ "williamboman/mason.nvim", lazy = false, opts = {} },
|
||||
{
|
||||
"neovim/nvim-lspconfig",
|
||||
dependencies = {
|
||||
"williamboman/mason.nvim",
|
||||
"williamboman/mason-lspconfig.nvim",
|
||||
"williamboman/mason-lspconfig.nvim",
|
||||
lazy = false,
|
||||
opts = {
|
||||
ensure_installed = {
|
||||
"lua_ls",
|
||||
"pyright",
|
||||
"rust_analyzer",
|
||||
"gopls",
|
||||
"clangd",
|
||||
"bashls",
|
||||
"jsonls",
|
||||
"html",
|
||||
"cssls",
|
||||
},
|
||||
},
|
||||
config = function()
|
||||
local lsp_config = require("config.lsp")
|
||||
|
||||
-- Set up Mason for auto-installation
|
||||
require("mason").setup()
|
||||
require("mason-lspconfig").setup({
|
||||
ensure_installed = {
|
||||
"lua_ls",
|
||||
"pyright",
|
||||
"ts_ls",
|
||||
"rust_analyzer",
|
||||
"gopls",
|
||||
"clangd",
|
||||
"bashls",
|
||||
"jsonls",
|
||||
"html",
|
||||
"cssls",
|
||||
},
|
||||
automatic_installation = true,
|
||||
})
|
||||
|
||||
local lspconfig = require("lspconfig")
|
||||
local capabilities = lsp_config.capabilities()
|
||||
|
||||
-- LspAttach autocmd for keymaps
|
||||
vim.api.nvim_create_autocmd("LspAttach", {
|
||||
group = vim.api.nvim_create_augroup("UserLspConfig", {}),
|
||||
callback = function(ev)
|
||||
local client = vim.lsp.get_client_by_id(ev.data.client_id)
|
||||
if client then
|
||||
lsp_config.on_attach(client, ev.buf)
|
||||
end
|
||||
end,
|
||||
})
|
||||
|
||||
-- Helper to load per-server config from lua/lsp/ if it exists
|
||||
local function get_server_config(server_name)
|
||||
local ok, server_config = pcall(require, "lsp." .. server_name)
|
||||
if ok then
|
||||
return server_config
|
||||
end
|
||||
return {}
|
||||
end
|
||||
|
||||
-- Auto-setup all installed servers
|
||||
require("mason-lspconfig").setup_handlers({
|
||||
-- Default handler for all servers
|
||||
function(server_name)
|
||||
local server_config = get_server_config(server_name)
|
||||
local config = vim.tbl_deep_extend("force", {
|
||||
capabilities = capabilities,
|
||||
}, server_config)
|
||||
|
||||
lspconfig[server_name].setup(config)
|
||||
end,
|
||||
})
|
||||
end,
|
||||
},
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue