mirror of
https://github.com/harivansh-afk/nvim.git
synced 2026-04-15 09:01:16 +00:00
add auto tagging with gutentags
This commit is contained in:
parent
57407e8ef8
commit
d7236fcfbd
3 changed files with 161 additions and 34 deletions
|
|
@ -2,31 +2,31 @@
|
|||
"Comment.nvim": { "branch": "master", "commit": "e30b7f2008e52442154b66f7c519bfd2f1e32acb" },
|
||||
"arrow.nvim": { "branch": "master", "commit": "6e0f726f55f99332dd726a53effd6813786b6d49" },
|
||||
"blink-cmp-copilot": { "branch": "main", "commit": "439cff78780c033aa23cf061d7315314b347e3c1" },
|
||||
"blink-ripgrep.nvim": { "branch": "main", "commit": "f8d4dc5d826ddfa7539472f3fbbe72646788534f" },
|
||||
"blink-ripgrep.nvim": { "branch": "main", "commit": "8aa4393ad2d0e83b74de2798a26589826a5436ce" },
|
||||
"blink.cmp": { "branch": "main", "commit": "485c03400608cb6534bbf84da8c1c471fc4808c0" },
|
||||
"colorful-menu.nvim": { "branch": "master", "commit": "bc3e82609f2fcf7dad7ca87c20e65e51d5d9d87c" },
|
||||
"copilot.lua": { "branch": "master", "commit": "81d289a8ce5d4ee1dea9b1c8ee4ac376b2e27a5f" },
|
||||
"colorful-menu.nvim": { "branch": "master", "commit": "d5b97d247528be308b6b69d96b5950a30e470f3d" },
|
||||
"copilot.lua": { "branch": "master", "commit": "3123983d00ae6859f8bc987d14ebb524bb41b618" },
|
||||
"diffview.nvim": { "branch": "main", "commit": "4516612fe98ff56ae0415a259ff6361a89419b0a" },
|
||||
"flash.nvim": { "branch": "main", "commit": "3c942666f115e2811e959eabbdd361a025db8b63" },
|
||||
"flash.nvim": { "branch": "main", "commit": "3be9bf7e85550045ec576379a0c45aac144d0438" },
|
||||
"friendly-snippets": { "branch": "main", "commit": "572f5660cf05f8cd8834e096d7b4c921ba18e175" },
|
||||
"gitsigns.nvim": { "branch": "main", "commit": "6e3c66548035e50db7bd8e360a29aec6620c3641" },
|
||||
"lazy.nvim": { "branch": "main", "commit": "6c3bda4aca61a13a9c63f1c1d1b16b9d3be90d7a" },
|
||||
"lazygit.nvim": { "branch": "main", "commit": "2305deed25bc61b866d5d39189e9105a45cf1cfb" },
|
||||
"lualine.nvim": { "branch": "master", "commit": "b8c23159c0161f4b89196f74ee3a6d02cdc3a955" },
|
||||
"mason-lspconfig.nvim": { "branch": "main", "commit": "5e085efe67fccb13372d54331d849219662a7e93" },
|
||||
"mason.nvim": { "branch": "main", "commit": "7dc4facca9702f95353d5a1f87daf23d78e31c2a" },
|
||||
"neo-tree.nvim": { "branch": "v3.x", "commit": "f1deac7ecec88c28a250d890ba7bb35843e69cbd" },
|
||||
"neogit": { "branch": "master", "commit": "6617978288d58eb121754b5dd890e893d9a7e8d6" },
|
||||
"gitsigns.nvim": { "branch": "main", "commit": "20ad4419564d6e22b189f6738116b38871082332" },
|
||||
"lazy.nvim": { "branch": "main", "commit": "1ea3c4085785f460fb0e46d2fe1ee895f5f9e7c1" },
|
||||
"lualine.nvim": { "branch": "master", "commit": "3946f0122255bc377d14a59b27b609fb3ab25768" },
|
||||
"mason-lspconfig.nvim": { "branch": "main", "commit": "2304ff65ecc8cb2afc2484de3e2ed9a407edf0b9" },
|
||||
"mason.nvim": { "branch": "main", "commit": "ad7146aa61dcaeb54fa900144d768f040090bff0" },
|
||||
"neo-tree.nvim": { "branch": "v3.x", "commit": "8cdd6b1940f333c1dd085526a9c45b30fb2dbf50" },
|
||||
"neogit": { "branch": "master", "commit": "0f48491ae0046796841aaa97d439267982fe72db" },
|
||||
"nui.nvim": { "branch": "main", "commit": "de740991c12411b663994b2860f1a4fd0937c130" },
|
||||
"nvim-autopairs": { "branch": "master", "commit": "23320e75953ac82e559c610bec5a90d9c6dfa743" },
|
||||
"nvim-lspconfig": { "branch": "master", "commit": "c8b90ae5cbe21d547b342b05c9266dcb8ca0de8f" },
|
||||
"nvim-autopairs": { "branch": "master", "commit": "7a2c97cccd60abc559344042fefb1d5a85b3e33b" },
|
||||
"nvim-lspconfig": { "branch": "master", "commit": "52a893217b2c12e215c6851bd8813b43204416cd" },
|
||||
"nvim-treesitter": { "branch": "master", "commit": "42fc28ba918343ebfd5565147a42a26580579482" },
|
||||
"nvim-web-devicons": { "branch": "master", "commit": "6e51ca170563330e063720449c21f43e27ca0bc1" },
|
||||
"nvim-web-devicons": { "branch": "master", "commit": "b8221e42cf7287c4dcde81f232f58d7b947c210d" },
|
||||
"plenary.nvim": { "branch": "master", "commit": "b9fd5226c2f76c951fc8ed5923d85e4de065e509" },
|
||||
"solarized.nvim": { "branch": "main", "commit": "c0dfe1cbfabd93b546baf5f1408f5df7e02e2050" },
|
||||
"telescope.nvim": { "branch": "master", "commit": "d90956833d7c27e73c621a61f20b29fdb7122709" },
|
||||
"tokyonight": { "branch": "main", "commit": "057ef5d260c1931f1dffd0f052c685dcd14100a3" },
|
||||
"tokyonight": { "branch": "main", "commit": "fd6c11a32ca79ca610fd54aadb513b5a6fce9858" },
|
||||
"vesper": { "branch": "main", "commit": "1717b1ad657c94bec3fc2bdebb0c55452d9fe46d" },
|
||||
"vim-fugitive": { "branch": "master", "commit": "61b51c09b7c9ce04e821f6cf76ea4f6f903e3cf4" },
|
||||
"which-key.nvim": { "branch": "main", "commit": "370ec46f710e058c9c1646273e6b225acf47cbed" }
|
||||
"vim-gutentags": { "branch": "master", "commit": "aa47c5e29c37c52176c44e61c780032dfacef3dd" },
|
||||
"which-key.nvim": { "branch": "main", "commit": "b4177e3eaf15fe5eb8357ebac2286d488be1ed00" }
|
||||
}
|
||||
|
|
|
|||
95
lua/plugins/gutentags.lua
Normal file
95
lua/plugins/gutentags.lua
Normal file
|
|
@ -0,0 +1,95 @@
|
|||
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,
|
||||
},
|
||||
}
|
||||
|
|
@ -8,7 +8,19 @@ return {
|
|||
config = function()
|
||||
require("mason").setup()
|
||||
require("mason-lspconfig").setup({
|
||||
ensure_installed = { "lua_ls", "pyright", "tsserver" },
|
||||
ensure_installed = {
|
||||
"lua_ls", -- Lua
|
||||
"pyright", -- Python
|
||||
"ts_ls", -- TypeScript/JavaScript (tsserver renamed)
|
||||
"rust_analyzer", -- Rust
|
||||
"gopls", -- Go
|
||||
"clangd", -- C/C++
|
||||
"bashls", -- Bash
|
||||
"jsonls", -- JSON
|
||||
"yamlls", -- YAML
|
||||
"html", -- HTML
|
||||
"cssls", -- CSS
|
||||
},
|
||||
automatic_installation = true,
|
||||
})
|
||||
|
||||
|
|
@ -22,6 +34,7 @@ return {
|
|||
local opts = { buffer = ev.buf }
|
||||
vim.keymap.set("n", "gD", vim.lsp.buf.declaration, opts)
|
||||
vim.keymap.set("n", "gd", vim.lsp.buf.definition, opts)
|
||||
vim.keymap.set("n", "<C-]>", vim.lsp.buf.definition, opts) -- Ctrl+] for go to definition
|
||||
vim.keymap.set("n", "K", vim.lsp.buf.hover, opts)
|
||||
vim.keymap.set("n", "gi", vim.lsp.buf.implementation, opts)
|
||||
vim.keymap.set("n", "<leader>rn", vim.lsp.buf.rename, opts)
|
||||
|
|
@ -33,24 +46,43 @@ return {
|
|||
end,
|
||||
})
|
||||
|
||||
-- Setup language servers
|
||||
lspconfig.lua_ls.setup({
|
||||
capabilities = capabilities,
|
||||
settings = {
|
||||
Lua = {
|
||||
diagnostics = {
|
||||
globals = { "vim" },
|
||||
-- Auto-setup all installed servers
|
||||
require("mason-lspconfig").setup_handlers({
|
||||
-- Default handler for all servers
|
||||
function(server_name)
|
||||
lspconfig[server_name].setup({
|
||||
capabilities = capabilities,
|
||||
})
|
||||
end,
|
||||
|
||||
-- Custom configuration for specific servers
|
||||
["lua_ls"] = function()
|
||||
lspconfig.lua_ls.setup({
|
||||
capabilities = capabilities,
|
||||
settings = {
|
||||
Lua = {
|
||||
diagnostics = {
|
||||
globals = { "vim" },
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
})
|
||||
})
|
||||
end,
|
||||
|
||||
lspconfig.pyright.setup({
|
||||
capabilities = capabilities,
|
||||
})
|
||||
|
||||
lspconfig.tsserver.setup({
|
||||
capabilities = capabilities,
|
||||
["pyright"] = function()
|
||||
lspconfig.pyright.setup({
|
||||
capabilities = capabilities,
|
||||
settings = {
|
||||
python = {
|
||||
analysis = {
|
||||
typeCheckingMode = "basic",
|
||||
autoSearchPaths = true,
|
||||
useLibraryCodeForTypes = true,
|
||||
},
|
||||
},
|
||||
},
|
||||
})
|
||||
end,
|
||||
})
|
||||
end,
|
||||
},
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue