From 0eea4c8dab647a65b2952c7381e5498ab8fa8d1e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?F=C3=A1bio=20Andr=C3=A9=20Damas?= Date: Thu, 27 Mar 2025 10:47:46 +0000 Subject: [PATCH] Improve LSP configs and change keybindings to align with default nvim 0.11 ones --- .editorconfig | 2 +- lazy-lock.json | 9 +- lsp/eslint.lua | 35 +- lsp/gopls.lua | 3 +- lsp/lemminx.lua | 3 +- lsp/lua_ls.lua | 17 +- lsp/pyright.lua | 2 + lsp/ruff.lua | 3 +- lsp/tailwindcss.lua | 37 +-- lsp/vtsls.lua | 3 +- lua/config/settings.lua | 2 - lua/plugins/blink.lua | 37 ++- lua/plugins/commander.lua | 306 +++++++++--------- lua/plugins/flash.nvim.lua | 5 +- lua/plugins/fzf-lua.lua | 24 +- lua/plugins/glance.lua | 3 +- lua/plugins/hurl.nvim.lua | 4 +- lua/plugins/key-analyzer.nvim.lua | 5 + lua/plugins/lsp-lens.nvim.lua | 5 + lua/plugins/lsp.lua | 14 +- lua/plugins/lspsaga.nvim.lua | 76 +++-- lua/plugins/mini.files.lua | 5 +- lua/plugins/mini.statusline.lua | 5 +- lua/plugins/namu.nvim.lua | 41 ++- lua/plugins/neo-tree.nvim.lua | 1 + lua/plugins/nvim-autopairs.lua | 1 + lua/plugins/output-panel.nvim.lua | 8 + lua/plugins/snacks.nvim.lua | 1 - lua/plugins/tokyonight.lua | 15 +- lua/plugins/treesitter.lua | 2 +- lua/plugins/undotree.lua | 18 ++ lua/plugins/vim-fugitive.lua | 4 +- lua/plugins/which-key.nvim.lua | 513 +++++++++++++++--------------- 33 files changed, 656 insertions(+), 553 deletions(-) create mode 100644 lua/plugins/key-analyzer.nvim.lua create mode 100644 lua/plugins/lsp-lens.nvim.lua create mode 100644 lua/plugins/output-panel.nvim.lua create mode 100644 lua/plugins/undotree.lua diff --git a/.editorconfig b/.editorconfig index 9df6296..f202205 100644 --- a/.editorconfig +++ b/.editorconfig @@ -8,5 +8,5 @@ trim_trailing_whitespace = true insert_final_newline = true [*.lua] -max_line_length = 120 +max_line_length = 80 align_array_table = false diff --git a/lazy-lock.json b/lazy-lock.json index e07a2a2..fba4224 100644 --- a/lazy-lock.json +++ b/lazy-lock.json @@ -6,23 +6,28 @@ "fzf-lua": { "branch": "main", "commit": "ac6a34ea39831ec71c14f72075facf377ea9a00d" }, "glance.nvim": { "branch": "master", "commit": "cb19b86349cbe634eec0ea768b9a27fdd6d24f34" }, "hurl.nvim": { "branch": "main", "commit": "bf00b4ee56dc8026dd7cd068236fb2c01bb1e307" }, + "key-analyzer.nvim": { "branch": "main", "commit": "72d301fb8843c19d8e69e16e0a0b42256edc25cc" }, "lazy.nvim": { "branch": "main", "commit": "6c3bda4aca61a13a9c63f1c1d1b16b9d3be90d7a" }, + "lsp-lens.nvim": { "branch": "main", "commit": "48bb1a7e271424c15f3d588d54adc9b7c319d977" }, "lspsaga.nvim": { "branch": "main", "commit": "778d56ff9b387dacd14ae648ed5604394b486f51" }, "mason.nvim": { "branch": "main", "commit": "fc98833b6da5de5a9c5b1446ac541577059555be" }, "mini.files": { "branch": "main", "commit": "01001e0cfc1e79f581d055ae3f70fbac96a2f378" }, "mini.statusline": { "branch": "main", "commit": "1b0edf76fe2af015f8c989385ff949f1db7aade2" }, "namu.nvim": { "branch": "main", "commit": "fc9632d7deb81c737577ecfa5879aa3bd1fc0433" }, "neo-tree.nvim": { "branch": "v3.x", "commit": "9b5d67119c46e3262ffe1508fe6d8540b79ad75d" }, + "none-ls-extras.nvim": { "branch": "main", "commit": "1214d729e3408470a7b7a428415a395e5389c13c" }, "none-ls.nvim": { "branch": "main", "commit": "a117163db44c256d53c3be8717f3e1a2a28e6299" }, "nui.nvim": { "branch": "main", "commit": "8d3bce9764e627b62b07424e0df77f680d47ffdb" }, "nvim-autopairs": { "branch": "master", "commit": "6522027785b305269fa17088395dfc0f456cedd2" }, - "nvim-treesitter": { "branch": "master", "commit": "85168f15808d89b0222313652b9d2777eda3cb08" }, + "nvim-treesitter": { "branch": "master", "commit": "da5825bf70cc2ea7eacd1e60c32c07baf19adeba" }, "nvim-web-devicons": { "branch": "master", "commit": "4c3a5848ee0b09ecdea73adcd2a689190aeb728c" }, + "output-panel.nvim": { "branch": "main", "commit": "9979f9988acb35fd8e699d8b1fbc7aa17c9d8148" }, "plenary.nvim": { "branch": "master", "commit": "857c5ac632080dba10aae49dba902ce3abf91b35" }, - "render-markdown.nvim": { "branch": "main", "commit": "84d413b0c432adaeaf3dcaac646638bd99d06aa6" }, + "render-markdown.nvim": { "branch": "main", "commit": "c91fa46fc8d79f5577beac70a459f30ec17a60c2" }, "snacks.nvim": { "branch": "main", "commit": "bc0630e43be5699bb94dadc302c0d21615421d93" }, "telescope.nvim": { "branch": "master", "commit": "a4ed82509cecc56df1c7138920a1aeaf246c0ac5" }, "tokyonight.nvim": { "branch": "main", "commit": "057ef5d260c1931f1dffd0f052c685dcd14100a3" }, + "undotree": { "branch": "master", "commit": "b951b87b46c34356d44aa71886aecf9dd7f5788a" }, "vim-fugitive": { "branch": "master", "commit": "4a745ea72fa93bb15dd077109afbb3d1809383f2" }, "which-key.nvim": { "branch": "main", "commit": "370ec46f710e058c9c1646273e6b225acf47cbed" } } diff --git a/lsp/eslint.lua b/lsp/eslint.lua index 2a73ce4..245935e 100644 --- a/lsp/eslint.lua +++ b/lsp/eslint.lua @@ -1,4 +1,37 @@ return { cmd = { "vscode-eslint-language-server", "--stdio" }, - filetypes = { "javascript", "javascriptreact", "javascript.jsx", "typescript", "typescriptreact", "typescript.tsx", "vue", "svelte", "astro" } + filetypes = { "javascript", "javascriptreact", "javascript.jsx", "typescript", "typescriptreact", "typescript.tsx", "vue", "svelte", "astro" }, + root_markers = { ".git" }, + settings = { + codeAction = { + disableRuleComment = { + enable = true, + location = "separateLine" + }, + showDocumentation = { + enable = true + } + }, + codeActionOnSave = { + enable = false, + mode = "all" + }, + experimental = { + useFlatConfig = false + }, + format = true, + nodePath = "", + onIgnoredFiles = "off", + problems = { + shortenToSingleLine = false + }, + quiet = false, + rulesCustomizations = {}, + run = "onType", + useESLintClass = false, + validate = "on", + workingDirectory = { + mode = "location" + } + } } diff --git a/lsp/gopls.lua b/lsp/gopls.lua index 39185f6..e7511c9 100644 --- a/lsp/gopls.lua +++ b/lsp/gopls.lua @@ -1,4 +1,5 @@ return { cmd = { "gopls" }, - filetypes = { "go", "gomod", "gowork", "gotmpl" } + filetypes = { "go", "gomod", "gowork", "gotmpl" }, + root_markers = { ".git" }, } diff --git a/lsp/lemminx.lua b/lsp/lemminx.lua index 1708328..01d0bc4 100644 --- a/lsp/lemminx.lua +++ b/lsp/lemminx.lua @@ -1,4 +1,5 @@ return { cmd = { "lemminx" }, - filetypes = { "xml", "xsd", "xsl", "xslt", "svg" } + filetypes = { "xml", "xsd", "xsl", "xslt", "svg" }, + root_markers = { ".git" }, } diff --git a/lsp/lua_ls.lua b/lsp/lua_ls.lua index d5ab2e5..b30d97a 100644 --- a/lsp/lua_ls.lua +++ b/lsp/lua_ls.lua @@ -1,4 +1,19 @@ return { cmd = { "lua-language-server" }, - filetypes = { "lua" } + filetypes = { "lua" }, + root_markers = { ".git" }, + + settings = { + Lua = { + runtime = { + version = 'LuaJIT', + }, + diagnostics = { + globals = { 'vim' }, + }, + telemetry = { + enable = false, + }, + }, + }, } diff --git a/lsp/pyright.lua b/lsp/pyright.lua index 0b2fc88..d0e8783 100644 --- a/lsp/pyright.lua +++ b/lsp/pyright.lua @@ -1,6 +1,8 @@ return { cmd = { "pyright-langserver", "--stdio" }, filetypes = { "python" }, + root_markers = { "pyproject.toml" }, + settings = { python = { analysis = { diff --git a/lsp/ruff.lua b/lsp/ruff.lua index 261a847..c1512f6 100644 --- a/lsp/ruff.lua +++ b/lsp/ruff.lua @@ -1,4 +1,5 @@ return { cmd = { "ruff", "server" }, - filetypes = { "python" } + filetypes = { "python" }, + root_markers = { "pyproject.toml" }, } diff --git a/lsp/tailwindcss.lua b/lsp/tailwindcss.lua index 1d4beee..02e9c7e 100644 --- a/lsp/tailwindcss.lua +++ b/lsp/tailwindcss.lua @@ -1,26 +1,27 @@ return { cmd = { "tailwindcss-language-server", "--stdio" }, filetypes = { "aspnetcorerazor", "astro", "astro-markdown", "blade", "clojure", "django-html", "htmldjango", "edge", "eelixir", "elixir", "ejs", "erb", "eruby", "gohtml", "gohtmltmpl", "haml", "handlebars", "hbs", "html", "htmlangular", "html-eex", "heex", "jade", "leaf", "liquid", "markdown", "mdx", "mustache", "njk", "nunjucks", "php", "razor", "slim", "twig", "css", "less", "postcss", "sass", "scss", "stylus", "sugarss", "javascript", "javascriptreact", "reason", "rescript", "typescript", "typescriptreact", "vue", "svelte", "templ" }, - settings = { - tailwindCSS = { - classAttributes = { "class", "className", "classList", "class:list", "ngClass", "pathClassName" }, - experimental = { - classRegex = { - { - "(?:clsx|cva|cx)\\(([^)(]*(?:\\([^)(]*(?:\\([^)(]*(?:\\([^)(]*\\)[^)(]*)*\\)[^)(]*)*\\)[^)(]*)*)\\)", - "'([^']*)'", - }, - { - "(?:clsx|cva|cx)\\(([^)(]*(?:\\([^)(]*(?:\\([^)(]*(?:\\([^)(]*\\)[^)(]*)*\\)[^)(]*)*\\)[^)(]*)*)\\)", - '"([^"]*)"', - }, - { - "(?:clsx|cva|cx)\\(([^)(]*(?:\\([^)(]*(?:\\([^)(]*(?:\\([^)(]*\\)[^)(]*)*\\)[^)(]*)*\\)[^)(]*)*)\\)", - "`([^`]*)`", - }, + root_markers = { ".git" }, + + settings = { + tailwindCSS = { + classAttributes = { "class", "className", "classList", "class:list", "ngClass", "pathClassName" }, + experimental = { + classRegex = { + { + "(?:clsx|cva|cx)\\(([^)(]*(?:\\([^)(]*(?:\\([^)(]*(?:\\([^)(]*\\)[^)(]*)*\\)[^)(]*)*\\)[^)(]*)*)\\)", + "'([^']*)'", + }, + { + "(?:clsx|cva|cx)\\(([^)(]*(?:\\([^)(]*(?:\\([^)(]*(?:\\([^)(]*\\)[^)(]*)*\\)[^)(]*)*\\)[^)(]*)*)\\)", + '"([^"]*)"', + }, + { + "(?:clsx|cva|cx)\\(([^)(]*(?:\\([^)(]*(?:\\([^)(]*(?:\\([^)(]*\\)[^)(]*)*\\)[^)(]*)*\\)[^)(]*)*)\\)", + "`([^`]*)`", }, }, }, }, - + }, } diff --git a/lsp/vtsls.lua b/lsp/vtsls.lua index 0f13ddb..786a0c6 100644 --- a/lsp/vtsls.lua +++ b/lsp/vtsls.lua @@ -1,4 +1,5 @@ return { cmd = { "vtsls", "--stdio" }, - filetypes = { "javascript", "javascriptreact", "javascript.jsx", "typescript", "typescriptreact", "typescript.tsx" } + filetypes = { "javascript", "javascriptreact", "javascript.jsx", "typescript", "typescriptreact", "typescript.tsx" }, + root_markers = { ".git" }, } diff --git a/lua/config/settings.lua b/lua/config/settings.lua index 874427f..a3acfb1 100644 --- a/lua/config/settings.lua +++ b/lua/config/settings.lua @@ -53,8 +53,6 @@ opt.syntax = "enable" vim.opt.swapfile = false vim.opt.backup = false -vim.opt.undodir = vim.fn.expand("~/.vim/undodir") -vim.opt.undofile = true if vim.fn.has("termguicolors") == 1 then opt.termguicolors = true diff --git a/lua/plugins/blink.lua b/lua/plugins/blink.lua index 5df40ba..0217b77 100644 --- a/lua/plugins/blink.lua +++ b/lua/plugins/blink.lua @@ -1,21 +1,20 @@ return { - { - 'saghen/blink.cmp', - dependencies = 'rafamadriz/friendly-snippets', - version = '*', - ---@module 'blink.cmp' - ---@type blink.cmp.Config - opts = { - keymap = { preset = 'default' }, - appearance = { - use_nvim_cmp_as_default = true, - nerd_font_variant = 'mono' - }, - signature = { enabled = true }, - completion = { - documentation = { auto_show = true, auto_show_delay_ms = 500 }, - }, - }, - opts_extend = { "sources.default" }, - } } + 'saghen/blink.cmp', + dependencies = 'rafamadriz/friendly-snippets', + version = '*', + ---@module 'blink.cmp' + ---@type blink.cmp.Config + opts = { + keymap = { preset = 'default' }, + appearance = { + use_nvim_cmp_as_default = true, + nerd_font_variant = 'mono' + }, + signature = { enabled = true }, + completion = { + documentation = { auto_show = true, auto_show_delay_ms = 500 }, + }, + }, + opts_extend = { "sources.default" }, +} diff --git a/lua/plugins/commander.lua b/lua/plugins/commander.lua index 3e5eaab..cdb8961 100644 --- a/lua/plugins/commander.lua +++ b/lua/plugins/commander.lua @@ -1,154 +1,162 @@ return { - { - "FeiyouG/commander.nvim", - dependencies = { "nvim-telescope/telescope.nvim" }, - init = function() - require("commander").setup({ - integration = { - telescope = { - enable = true, - theme = require("telescope.themes").commander, - }, - lazy = { - enable = true, - set_plugin_name_as_cat = true, - }, - }, - }) - require("commander").add({ - { - desc = "Find git files", - cmd = ":FzfLua git_files", - }, - { - cmd = ":FzfLua files", - desc = "Find files", - }, - { - cmd = ":FzfLua buffers", - desc = "Buffer list", - }, - { - cmd = ":FzfLua quickfix", - desc = "Quickfix", - }, - { - cmd = ":FzfLua quickfix_stack", - desc = "Quickfix History", - }, - { - cmd = ":FzfLua command_history", - desc = "Command History", - }, - { - cmd = ":FzfLua git_commits", - desc = "Git commits", - }, - { - cmd = ":FzfLua git_bcommits", - desc = "Git buffer commits", - }, - { - cmd = ":FzfLua git_branches", - desc = "Git branches", - }, - { - cmd = ":GV", - desc = "Git log", - }, - { - cmd = ":Git blame", - desc = "Git blame", - }, - { - cmd = ":DiffviewOpen", - desc = "Diff view", - }, - { - cmd = ":UndotreeToggle", - desc = "Undotree", - }, - { - cmd = ":EslintFixAll", - desc = "ESLint: autofix all problems", - }, - { - cmd = ":'<,'>sort", - desc = "Sort", - }, - { - cmd = ":Fidget history", - desc = "Error/notification history", - }, - { - cmd = ":lua Snacks.terminal.toggle()", - desc = "Terminal", - keys = { "n", "t" }, - set = false, - }, - { - cmd = ":GitConflicts", - desc = "Git conflicts to quickfix", - }, - { - cmd = ":LastCommitToQuickfix", - desc = "Last Commit To quickfix", - }, - { - cmd = ":ForkToQuickfix", - desc = "Branch commits to quickfix", - }, - { - cmd = ":Trouble diagnostics toggle focus=false filter.buf=0", - desc = "Diagnostic window (current buffer)", - }, - { - cmd = ":Trouble symbols toggle pinned=true results.win.relative=win results.win.position=right", - desc = "Symbols", - }, - { - cmd = ":PackageInfoShow", - desc = "Show package.json versions", - }, - { - cmd = ":PackageInfoHide", - desc = "Hide package.json versions", - }, - { - cmd = ":PackageInfoUpdate", - desc = "Update package.json dependency", - }, - { - cmd = ":CoAuthor", - desc = "Add Git CoAuthor", - }, - { - cmd = ":TailwindConcealToggle", - desc = "Toggle conceal tailwind classes", - }, - }) + "FeiyouG/commander.nvim", + dependencies = { "nvim-telescope/telescope.nvim" }, - vim.api.nvim_create_user_command("Commander", function(args) - require("commander").show() - end, { - desc = "Show commands", - nargs = "*", - }) - - vim.api.nvim_create_user_command("LastCommitToQuickfix", function(args) - require("utils.telescope").last_commit_to_quickfix() - end, { + init = function() + require("commander").setup({ + integration = { + telescope = { + enable = true, + theme = require("telescope.themes").commander, + }, + lazy = { + enable = true, + set_plugin_name_as_cat = true, + }, + }, + }) + require("commander").add({ + { + desc = "Find git files", + cmd = ":FzfLua git_files", + }, + { + cmd = ":FzfLua files", + desc = "Find files", + }, + { + cmd = ":FzfLua buffers", + desc = "Buffer list", + }, + { + cmd = ":FzfLua quickfix", + desc = "Quickfix", + }, + { + cmd = ":FzfLua quickfix_stack", + desc = "Quickfix History", + }, + { + cmd = ":FzfLua command_history", + desc = "Command History", + }, + { + cmd = ":FzfLua git_commits", + desc = "Git commits", + }, + { + cmd = ":FzfLua git_bcommits", + desc = "Git buffer commits", + }, + { + cmd = ":FzfLua git_branches", + desc = "Git branches", + }, + { + cmd = ":GV", + desc = "Git log", + }, + { + cmd = ":Git blame", + desc = "Git blame", + }, + { + cmd = ":DiffviewOpen", + desc = "Diff view", + }, + { + cmd = ":UndotreeToggle", + desc = "Undotree", + }, + { + cmd = ":EslintFixAll", + desc = "ESLint: autofix all problems", + }, + { + cmd = ":'<,'>sort", + desc = "Sort", + }, + { + cmd = ":lua Snacks.notifier.show_history()", + desc = "Error/notification history", + }, + { + cmd = ":lua Snacks.terminal.toggle()", + desc = "Terminal", + keys = { "n", "t" }, + set = false, + }, + { + cmd = ":GitConflicts", + desc = "Git conflicts to quickfix", + }, + { + cmd = ":LastCommitToQuickfix", desc = "Last Commit To quickfix", - nargs = "?", - }) + }, + { + cmd = ":ForkToQuickfix", + desc = "Branch commits to quickfix", + }, + { + cmd = ":Trouble diagnostics toggle focus=false filter.buf=0", + desc = "Diagnostic window (current buffer)", + }, + { + cmd = + ":Trouble symbols toggle pinned=true results.win.relative=win results.win.position=right", + desc = "Symbols", + }, + { + cmd = ":PackageInfoShow", + desc = "Show package.json versions", + }, + { + cmd = ":PackageInfoHide", + desc = "Hide package.json versions", + }, + { + cmd = ":PackageInfoUpdate", + desc = "Update package.json dependency", + }, + { + cmd = ":CoAuthor", + desc = "Add Git CoAuthor", + }, + { + cmd = ":TailwindConcealToggle", + desc = "Toggle conceal tailwind classes", + }, + { + cmd = ":OutputPanel", + desc = "Toggle LSP Output Panel" + }, + { + cmd = ":KeyAnalyzer", + desc = + "Show diagram of mapped keys under the first parameter key" + } + }) - vim.api.nvim_create_user_command("ForkToQuickfix", function(args) - require("utils.telescope").fork_to_quickfix(args.fargs[1]) - end, { - desc = "Branch changes to quickfix", - nargs = "?", - }) - end, - }, + vim.api.nvim_create_user_command("Commander", function(args) + require("commander").show() + end, { + desc = "Show commands", + nargs = "*", + }) + + vim.api.nvim_create_user_command("LastCommitToQuickfix", function(args) + require("utils.telescope").last_commit_to_quickfix() + end, { + desc = "Last Commit To quickfix", + nargs = "?", + }) + + vim.api.nvim_create_user_command("ForkToQuickfix", function(args) + require("utils.telescope").fork_to_quickfix(args.fargs[1]) + end, { + desc = "Branch changes to quickfix", + nargs = "?", + }) + end, } - diff --git a/lua/plugins/flash.nvim.lua b/lua/plugins/flash.nvim.lua index 2fd8b61..4b015db 100644 --- a/lua/plugins/flash.nvim.lua +++ b/lua/plugins/flash.nvim.lua @@ -1,5 +1,6 @@ -return {{ +return { "folke/flash.nvim", event = "VeryLazy", + opts = {}, -}} +} diff --git a/lua/plugins/fzf-lua.lua b/lua/plugins/fzf-lua.lua index f5333a0..4270a5c 100644 --- a/lua/plugins/fzf-lua.lua +++ b/lua/plugins/fzf-lua.lua @@ -1,14 +1,12 @@ return { - { - "ibhagwan/fzf-lua", - dependencies = { "nvim-tree/nvim-web-devicons" }, - config = function() - require("fzf-lua").setup({ - keymap = { - fzf = { - ["ctrl-q"] = "select-all+accept", - }, - }, - }) - end - } } + "ibhagwan/fzf-lua", + dependencies = { "nvim-tree/nvim-web-devicons" }, + + opts = { + keymap = { + fzf = { + ["ctrl-q"] = "select-all+accept", + }, + }, + } +} diff --git a/lua/plugins/glance.lua b/lua/plugins/glance.lua index c013189..1fca3ad 100644 --- a/lua/plugins/glance.lua +++ b/lua/plugins/glance.lua @@ -1,5 +1,6 @@ return { "dnlhc/glance.nvim", + config = function() local glance = require("glance") local actions = glance.actions @@ -14,7 +15,7 @@ return { }, mappings = { list = { - ["j"] = actions.next, -- Bring the cursor to the next item in the list + ["j"] = actions.next, -- Bring the cursor to the next item in the list ["k"] = actions.previous, -- Bring the cursor to the previous item in the list [""] = actions.next, [""] = actions.previous, diff --git a/lua/plugins/hurl.nvim.lua b/lua/plugins/hurl.nvim.lua index d363bc1..79ab2fa 100644 --- a/lua/plugins/hurl.nvim.lua +++ b/lua/plugins/hurl.nvim.lua @@ -31,6 +31,7 @@ return { }, }, ft = "hurl", + opts = { -- Show debugging info debug = false, @@ -73,7 +74,8 @@ return { email .. "\",\"password\":\"" .. password .. - "\",\"clientType\":\"CLIENT_TYPE_WEB\"}' " .. firebaseUrl .. "?key=" .. + "\",\"clientType\":\"CLIENT_TYPE_WEB\"}' " .. + firebaseUrl .. "?key=" .. firebaseKey) local rawdata = h:read("all") h:close() diff --git a/lua/plugins/key-analyzer.nvim.lua b/lua/plugins/key-analyzer.nvim.lua new file mode 100644 index 0000000..d152603 --- /dev/null +++ b/lua/plugins/key-analyzer.nvim.lua @@ -0,0 +1,5 @@ +return { + "meznaric/key-analyzer.nvim", + + opts = {} +} diff --git a/lua/plugins/lsp-lens.nvim.lua b/lua/plugins/lsp-lens.nvim.lua new file mode 100644 index 0000000..723341b --- /dev/null +++ b/lua/plugins/lsp-lens.nvim.lua @@ -0,0 +1,5 @@ +return { + 'VidocqH/lsp-lens.nvim', + + opts = {} +} diff --git a/lua/plugins/lsp.lua b/lua/plugins/lsp.lua index 50fc088..3c8e690 100644 --- a/lua/plugins/lsp.lua +++ b/lua/plugins/lsp.lua @@ -43,15 +43,19 @@ vim.api.nvim_create_autocmd('LspAttach', { }) vim.diagnostic.config({ - virtual_lines = true + virtual_lines = { + current_line = true + } }) return { { "williamboman/mason.nvim", + opts = { tools_to_install = { - "lua-language-server", "vtsls", "ruff", "mypy", "black", "pyright", "tailwindcss-language-server", + "lua-language-server", "vtsls", "ruff", "mypy", "black", + "pyright", "tailwindcss-language-server", "eslint-lsp", "lemminx", "gopls" } }, @@ -69,7 +73,9 @@ return { }, { "nvimtools/none-ls.nvim", - config = function(_, opts) + dependencies = { "nvimtools/none-ls-extras.nvim" }, + + config = function() local null_ls = require("null-ls") null_ls.setup({ on_attach = function(client, bufnr) @@ -81,6 +87,4 @@ return { }) end } - - } diff --git a/lua/plugins/lspsaga.nvim.lua b/lua/plugins/lspsaga.nvim.lua index 8791c9e..bf16b50 100644 --- a/lua/plugins/lspsaga.nvim.lua +++ b/lua/plugins/lspsaga.nvim.lua @@ -1,44 +1,42 @@ -return -{ +return { 'nvimdev/lspsaga.nvim', - config = function() - require('lspsaga').setup({ - symbol_in_winbar = { - enable = true, - hide_keyboard = true, - }, - lightbulb = { - enable = true, - enable_in_insert = true, - cache_code_action = true, - sign = true, - update_time = 150, - sign_priority = 20, - virtual_text = false, - }, - diagnostic = { - extend_relatedInformation = true, - }, - finder = { - keys = { - vsplit = "s", - split = "v", - toggle_or_open = "", - shuttle = "", - }, - }, - outline = { - keys = { - toggle_or_jump = "", - }, - }, - implement = { - enable = false, - }, - }) - end, dependencies = { 'nvim-treesitter/nvim-treesitter', 'nvim-tree/nvim-web-devicons', - } + }, + + opts = { + symbol_in_winbar = { + enable = true, + hide_keyboard = true, + }, + lightbulb = { + enable = true, + enable_in_insert = true, + cache_code_action = true, + sign = true, + update_time = 150, + sign_priority = 20, + virtual_text = false, + }, + diagnostic = { + extend_relatedInformation = true, + }, + finder = { + keys = { + vsplit = "s", + split = "v", + toggle_or_open = "", + shuttle = "", + }, + }, + outline = { + keys = { + toggle_or_jump = "", + }, + }, + implement = { + enable = false, + }, + }, } diff --git a/lua/plugins/mini.files.lua b/lua/plugins/mini.files.lua index f4f4124..d702986 100644 --- a/lua/plugins/mini.files.lua +++ b/lua/plugins/mini.files.lua @@ -1,3 +1,6 @@ return { - { 'echasnovski/mini.files', version = '*', opts = {} } + 'echasnovski/mini.files', + version = '*', + + opts = { options = { use_as_default_explorer = false } } } diff --git a/lua/plugins/mini.statusline.lua b/lua/plugins/mini.statusline.lua index a6417da..b77002c 100644 --- a/lua/plugins/mini.statusline.lua +++ b/lua/plugins/mini.statusline.lua @@ -1,3 +1,6 @@ return { - { 'echasnovski/mini.statusline', version = '*',opts = {} }, + 'echasnovski/mini.statusline', + version = '*', + + opts = {} } diff --git a/lua/plugins/namu.nvim.lua b/lua/plugins/namu.nvim.lua index 6c57596..86384a0 100644 --- a/lua/plugins/namu.nvim.lua +++ b/lua/plugins/namu.nvim.lua @@ -1,24 +1,21 @@ return { - { - "bassamsdata/namu.nvim", - config = function() - require("namu").setup({ - -- Enable the modules you want - namu_symbols = { - enable = true, - options = {}, -- here you can configure namu - }, - -- Optional: Enable other modules if needed - ui_select = { enable = false }, -- vim.ui.select() wrapper - colorscheme = { - enable = false, - options = { - -- NOTE: if you activate persist, then please remove any vim.cmd("colorscheme ...") in your config, no needed anymore - persist = true, -- very efficient mechanism to Remember selected colorscheme - write_shada = false, -- If you open multiple nvim instances, then probably you need to enable this - }, - }, - }) - end, - } + "bassamsdata/namu.nvim", + + opts = { + -- Enable the modules you want + namu_symbols = { + enable = true, + options = {}, -- here you can configure namu + }, + -- Optional: Enable other modules if needed + ui_select = { enable = false }, -- vim.ui.select() wrapper + colorscheme = { + enable = false, + options = { + -- NOTE: if you activate persist, then please remove any vim.cmd("colorscheme ...") in your config, no needed anymore + persist = true, -- very efficient mechanism to Remember selected colorscheme + write_shada = false, -- If you open multiple nvim instances, then probably you need to enable this + }, + }, + }, } diff --git a/lua/plugins/neo-tree.nvim.lua b/lua/plugins/neo-tree.nvim.lua index d57f988..6536687 100644 --- a/lua/plugins/neo-tree.nvim.lua +++ b/lua/plugins/neo-tree.nvim.lua @@ -6,6 +6,7 @@ return { "nvim-tree/nvim-web-devicons", "MunifTanjim/nui.nvim", }, + opts = { close_if_last_window = true, filesystem = { diff --git a/lua/plugins/nvim-autopairs.lua b/lua/plugins/nvim-autopairs.lua index 60861d6..3c8344a 100644 --- a/lua/plugins/nvim-autopairs.lua +++ b/lua/plugins/nvim-autopairs.lua @@ -2,6 +2,7 @@ return { { "windwp/nvim-autopairs", event = "InsertEnter", + opts = {}, } } diff --git a/lua/plugins/output-panel.nvim.lua b/lua/plugins/output-panel.nvim.lua new file mode 100644 index 0000000..4a6e42a --- /dev/null +++ b/lua/plugins/output-panel.nvim.lua @@ -0,0 +1,8 @@ +return { + "mhanberg/output-panel.nvim", + version = "*", + event = "VeryLazy", + + opts = {}, + cmd = { "OutputPanel" }, +} diff --git a/lua/plugins/snacks.nvim.lua b/lua/plugins/snacks.nvim.lua index 7961f6c..125535f 100644 --- a/lua/plugins/snacks.nvim.lua +++ b/lua/plugins/snacks.nvim.lua @@ -11,4 +11,3 @@ return { { bufdelete = { enabled = true }, }, } } - diff --git a/lua/plugins/tokyonight.lua b/lua/plugins/tokyonight.lua index 035fa6b..f4f2ad7 100644 --- a/lua/plugins/tokyonight.lua +++ b/lua/plugins/tokyonight.lua @@ -1,9 +1,10 @@ return { - "folke/tokyonight.nvim", - lazy = false, - priority = 1000, - init = function() -require("tokyonight").setup({transparent = true, dim_inactive = true, lualine_bold = true}) -vim.cmd("colo tokyonight-night") - end + "folke/tokyonight.nvim", + lazy = false, + priority = 1000, + + init = function() + require("tokyonight").setup({ transparent = true, dim_inactive = true, lualine_bold = true }) + vim.cmd("colo tokyonight-night") + end } diff --git a/lua/plugins/treesitter.lua b/lua/plugins/treesitter.lua index 0a94e85..c5b9373 100644 --- a/lua/plugins/treesitter.lua +++ b/lua/plugins/treesitter.lua @@ -1,6 +1,7 @@ return { 'nvim-treesitter/nvim-treesitter', run = ':TSUpdate', + config = function() local configs = require("nvim-treesitter.configs") @@ -29,4 +30,3 @@ return { }) end } - diff --git a/lua/plugins/undotree.lua b/lua/plugins/undotree.lua new file mode 100644 index 0000000..807b6b4 --- /dev/null +++ b/lua/plugins/undotree.lua @@ -0,0 +1,18 @@ +return { + "mbbill/undotree", + + config = function() + if vim.fn.has("persistent_undo") == 1 then + local target_path = vim.fn.expand("~/.undodir") + + -- Create the directory if it doesn't exist + if vim.fn.isdirectory(target_path) == 0 then + vim.fn.mkdir(target_path, "p", "0700") + end + + -- Set the undodir and enable undo file + vim.o.undodir = target_path + vim.o.undofile = true + end + end +} diff --git a/lua/plugins/vim-fugitive.lua b/lua/plugins/vim-fugitive.lua index 12cc19c..e1586a3 100644 --- a/lua/plugins/vim-fugitive.lua +++ b/lua/plugins/vim-fugitive.lua @@ -1 +1,3 @@ -return {{"tpope/vim-fugitive"}} +return { + "tpope/vim-fugitive" +} diff --git a/lua/plugins/which-key.nvim.lua b/lua/plugins/which-key.nvim.lua index 192dc31..e743f6f 100644 --- a/lua/plugins/which-key.nvim.lua +++ b/lua/plugins/which-key.nvim.lua @@ -1,301 +1,292 @@ return { - { - "folke/which-key.nvim", - init = function() - local wk = require("which-key") - wk.add({ - { "", ":m .+1==", desc = "Move line down" }, - { "", ":m .-2==", desc = "Move line up" }, - { - mode = "v", - { "", ":m '>+1gv=gv", desc = "Move line down" }, - { "", ":m '<-2gv=gv", desc = "Move line up" }, - }, - { - mode = "i", - { "", ":m .+1==gi", desc = "Move line down" }, - { "", ":m .-2==gi", desc = "Move line up" }, - }, + "folke/which-key.nvim", - { "", "Commander", desc = "Commander" }, + init = function() + local wk = require("which-key") + wk.add({ + { "", ":m .+1==", desc = "Move line down" }, + { "", ":m .-2==", desc = "Move line up" }, + { + mode = "v", + { "", ":m '>+1gv=gv", desc = "Move line down" }, + { "", ":m '<-2gv=gv", desc = "Move line up" }, + }, + { + mode = "i", + { "", ":m .+1==gi", desc = "Move line down" }, + { "", ":m .-2==gi", desc = "Move line up" }, + }, - { "", "FzfLua git_files", desc = "Find git files" }, + { "", "Commander", desc = "Commander" }, - { ",", group = "Search" }, - { ",p", "FzfLua files", desc = "Files files" }, - { ",b", "FzfLua buffers", desc = "Buffer List" }, - { ",q", "FzfLua quickfix", desc = "Quickfix" }, - { ",c", "FzfLua command_history", desc = "Quickfix" }, - { ",e", ":e **/*", desc = "Open with autocomplete" }, - { ",f", ":find **/*", desc = "Find with autocomplete" }, + { "", "FzfLua git_files", desc = "Find git files" }, - { "p", group = "Search" }, - { "pc", "FzfLua git_commits", desc = "Git commits" }, - { "pf", "FzfLua git_bcommits", desc = "Git file history" }, - { "pb", "FzfLua git_branches", desc = "Git branches" }, - { "ph", "FzfLua git_statuscr>", desc = "Git status" }, - { - "ps", - "FzfLua live_grep", - desc = "Project search" - }, + { ",", group = "Search" }, + { ",p", "FzfLua files", desc = "Files files" }, + { ",b", "FzfLua buffers", desc = "Buffer List" }, + { ",q", "FzfLua quickfix", desc = "Quickfix" }, + { ",c", "FzfLua command_history", desc = "Quickfix" }, + { ",e", ":e **/*", desc = "Open with autocomplete" }, + { ",f", ":find **/*", desc = "Find with autocomplete" }, - -- { - -- "ds", - -- function() - -- require("utils.telescope").search_dotfiles() - -- end, - -- desc = "Search dot files 🔭", - -- }, + { "p", group = "Search" }, + { "pc", "FzfLua git_commits", desc = "Git commits" }, + { "pf", "FzfLua git_bcommits", desc = "Git file history" }, + { "pb", "FzfLua git_branches", desc = "Git branches" }, + { "ph", "FzfLua git_statuscr>", desc = "Git status" }, + { + "ps", + "FzfLua live_grep", + desc = "Project search" + }, - { "K", "Lspsaga hover_doc", desc = "Show documentation" }, - { "", "Lspsaga hover_doc ++keep", desc = "Show documentation (keep)" }, - { "", "Lspsaga rename", desc = "Rename variable" }, - { "g", group = "Go to" }, - { "gd", ":Lspsaga goto_definition", desc = "Go to definition" }, - { - "gD", - function() - vim.lsp.buf.declaration() - end, - desc = "Go to declaration", - }, - { "gt", ":Lspsaga goto_type_definition", desc = "Go to type definition" }, - { "gh", ":Lspsaga finder", desc = "LSP Finder" }, - { "gH", ":Lspsaga finder ++normal", desc = "LSP Finder (keep)" }, - { "gj", ":Lspsaga diagnostic_jump_next", desc = "Next diagnostic message" }, - { "gk", ":Lspsaga diagnostic_jump_prev", desc = "Previous diagnostic message" }, + -- { + -- "ds", + -- function() + -- require("utils.telescope").search_dotfiles() + -- end, + -- desc = "Search dot files 🔭", + -- }, - { "a", group = "Local File Actions" }, - { "ac", "Lspsaga code_action", desc = "Code action" }, - { - "ag", - function() - vim.diagnostic.open_float(0, { scope = "line", focusable = false }) - end, - desc = "Show line diagnostics", - }, - { - "ad", - "Glance definitions", - desc = "Definitions", - }, - { - "ar", - "Glance references", - desc = "References", - }, - { - "ai", - "Glance implementations", - desc = "References", - }, - { - "at", - "Glance type_definitions", - desc = "Type definitions", - }, - { - "aI", - "Lspsaga incoming_calls", - desc = "Incoming calls", - }, - { - "aO", - "Lspsaga outgoing_calls", - desc = "Outgoing calls", - }, + { "K", "Lspsaga hover_doc", desc = "Show documentation" }, + { "", "Lspsaga hover_doc ++keep", desc = "Show documentation (keep)" }, + { "grn", "Lspsaga rename", desc = "Rename variable" }, + { "g", group = "Go to" }, + { "gd", ":Lspsaga goto_definition", desc = "Go to definition" }, + { + "gD", + function() + vim.lsp.buf.declaration() + end, + desc = "Go to declaration", + }, + { "gt", ":Lspsaga goto_type_definition", desc = "Go to type definition" }, + { "gh", ":Lspsaga finder", desc = "LSP Finder" }, + { "gH", ":Lspsaga finder ++normal", desc = "LSP Finder (keep)" }, + { "a", group = "Local File Actions" }, + { "gra", mode = { "n", "v" }, "Lspsaga code_action", desc = "Code action" }, + { + "ag", + function() + vim.diagnostic.open_float(0, + { scope = "line", focusable = false }) + end, + desc = "Show line diagnostics", + }, + { + "grd", + "Glance definitions", + desc = "Definitions", + }, + { + "grr", + "Glance references", + desc = "References", + }, + { + "gri", + "Glance implementations", + desc = "Implementations", + }, + { + "grt", + "Glance type_definitions", + desc = "Type definitions", + }, + { + "grI", + "Lspsaga incoming_calls", + desc = "Incoming calls", + }, + { + "grO", + "Lspsaga outgoing_calls", + desc = "Outgoing calls", + }, - { - "O", - "Lspsaga outline", - desc = "Toggle Outline", - icon = "󰷐", - }, + { + "gO", + "Lspsaga outline", + desc = "Toggle Outline", + icon = "󰷐", + }, - { - "g", - group = "Git", - }, - { - "gd", - "DiffviewOpen", - desc = "Diff view", - }, + { + "g", + group = "Git", + }, + { + "gd", + "DiffviewOpen", + desc = "Diff view", + }, - { - "»", - "]", - noremap = false, - }, - { - "«", - "[", - noremap = false, - }, - { "h", group = "git signs" }, + { + ">", + "]", + noremap = false, + }, + { + "<", + "[", + noremap = false, + }, + { "h", group = "git signs" }, + { + "hs", + function() + require("gitsigns").stage_hunk() + end, + desc = "Stage hunk", + }, + { + "hu", + function() + require("gitsigns").undo_stage_hunk() + end, + desc = "Undo stage hunk", + }, + { + "hv", + function() + require("gitsigns").preview_hunk() + end, + desc = "Preview hunk", + }, + { + "hb", + function() + require("gitsigns").blame_line() + end, + desc = "Blame line", + }, + { + "hR", + function() + require("gitsigns").reset_buffer() + end, + desc = "Reset buffer", + }, + { + "hr", + function() + require("gitsigns").reset_hunk() + end, + desc = "Reset hunk", + }, + { + "hS", + function() + require("gitsigns").stage_buffer() + end, + desc = "Stage buffer", + }, + { + "hU", + function() + require("gitsigns").reset_buffer_index() + end, + desc = "Reset buffer index", + }, + { + mode = "v", { "hs", function() - require("gitsigns").stage_hunk() + require("gitsigns").stage_hunk({ vim.fn.line("."), + vim.fn.line("v") }) end, desc = "Stage hunk", }, - { - "hu", - function() - require("gitsigns").undo_stage_hunk() - end, - desc = "Undo stage hunk", - }, - { - "hv", - function() - require("gitsigns").preview_hunk() - end, - desc = "Preview hunk", - }, - { - "hb", - function() - require("gitsigns").blame_line() - end, - desc = "Blame line", - }, - { - "hR", - function() - require("gitsigns").reset_buffer() - end, - desc = "Reset buffer", - }, { "hr", function() - require("gitsigns").reset_hunk() + require("gitsigns").reset_hunk({ vim.fn.line("."), + vim.fn.line("v") }) end, desc = "Reset hunk", }, + }, + + { + "]c", + function() + if vim.wo.diff then + vim.cmd.normal({ "]c", bang = true }) + else + vim.schedule(function() + require("gitsigns").nav_hunk("next") + end) + end + end, + desc = "Next hunk", + }, + { + "[c", + function() + if vim.wo.diff then + vim.cmd.normal({ "[c", bang = true }) + else + vim.schedule(function() + require("gitsigns").nav_hunk("prev") + end) + end + end, + desc = "Previous hunk", + }, + + { "u", "UndotreeToggle", desc = "Undotree", icon = "" }, + + { "c", group = "quickfix" }, + { "co", "copen", desc = "Open" }, + { "cc", "cclose", desc = "Close" }, + + { "c", group = "Location List" }, + { "co", "lopen", desc = "Open" }, + { "cc", "lclose", desc = "Close" }, + + { "", "Neotree toggle", desc = "Toggle neo-tree" }, + + { "t", "lua Snacks.terminal.toggle()", desc = "Toggle Terminal" }, + { mode = { "t" }, { "t", "lua Snacks.terminal.toggle()", desc = "Toggle Terminal" } }, + + { + mode = { "n", "x", "o" }, { - "hS", + "s", function() - require("gitsigns").stage_buffer() + require("flash").jump() end, - desc = "Stage buffer", + desc = "Flash ⚡", }, { - "hU", + "S", function() - require("gitsigns").reset_buffer_index() + require("flash").treesitter() end, - desc = "Reset buffer index", + desc = "Flash Treesitter ⚡", }, + }, + { + mode = { "o", "x" }, { - mode = "v", - { - "hs", - function() - require("gitsigns").stage_hunk({ vim.fn.line("."), vim.fn.line("v") }) - end, - desc = "Stage hunk", - }, - { - "hr", - function() - require("gitsigns").reset_hunk({ vim.fn.line("."), vim.fn.line("v") }) - end, - desc = "Reset hunk", - }, - }, - - { - "]c", + "R", function() - if vim.wo.diff then - vim.cmd.normal({ "]c", bang = true }) - else - vim.schedule(function() - require("gitsigns").nav_hunk("next") - end) - end + require("flash").treesitter_search() end, - desc = "Next hunk", + desc = "Flash Treesitter search ⚡", }, + }, + { + mode = "c", { - "[c", + "", function() - if vim.wo.diff then - vim.cmd.normal({ "[c", bang = true }) - else - vim.schedule(function() - require("gitsigns").nav_hunk("prev") - end) - end + require("flash").toggle() end, - desc = "Previous hunk", + desc = "Toggle Flash Search ⚡", }, - - { "u", "UndotreeToggle", desc = "Undotree", icon = "" }, - - { "c", group = "quickfix" }, - { "co", "copen", desc = "Open" }, - { "cf", "cfirst", desc = "First result" }, - { "cl", "clast", desc = "Last result" }, - { "cn", "cnext", desc = "Next result" }, - { "cp", "cprevious", desc = "Previous result" }, - { "cc", "cclose", desc = "Close" }, - - { "c", group = "Location List" }, - { "co", "lopen", desc = "Open" }, - { "cf", "lfirst", desc = "First result" }, - { "cl", "llast", desc = "Last result" }, - { "cn", "lnext", desc = "Next result" }, - { "cp", "lprevious", desc = "Previous result" }, - { "cc", "lclose", desc = "Close" }, - - { "", "Neotree toggle", desc = "Toggle neo-tree" }, - - { "t", "lua Snacks.terminal.toggle()", desc = "Toggle Terminal" }, - { mode = { "t" }, { "t", "lua Snacks.terminal.toggle()", desc = "Toggle Terminal" } }, - - { - mode = { "n", "x", "o" }, - { - "s", - function() - require("flash").jump() - end, - desc = "Flash ⚡", - }, - { - "S", - function() - require("flash").treesitter() - end, - desc = "Flash Treesitter ⚡", - }, - }, - { - mode = { "o", "x" }, - { - "R", - function() - require("flash").treesitter_search() - end, - desc = "Flash Treesitter search ⚡", - }, - }, - { - mode = "c", - { - "", - function() - require("flash").toggle() - end, - desc = "Toggle Flash Search ⚡", - }, - }, - }) - end, - } + }, + }) + end, }