From 7c0c670e297d3c4536a2549b246cfe1247fe2f3c Mon Sep 17 00:00:00 2001 From: aleidk Date: Fri, 22 Nov 2024 16:54:43 -0300 Subject: [PATCH] neovim plugin cleanup --- config/nvim/lazy-lock.json | 12 +- .../nvim/lua/aleidk/plugins-core/lualine.lua | 33 +- .../lua/aleidk/plugins-core/telescope.lua | 8 +- .../lua/aleidk/plugins-ide/color-picker.lua | 1 - .../nvim/lua/aleidk/plugins-ide/formatter.lua | 17 +- config/nvim/lua/aleidk/plugins-ide/git.lua | 62 --- .../{ts-node-action.lua => init.lua} | 10 +- .../nvim/lua/aleidk/plugins-ide/linters.lua | 8 +- config/nvim/lua/aleidk/plugins-ide/lsp.lua | 405 ++++++++---------- config/nvim/lua/aleidk/plugins-ide/mason.lua | 8 - .../lua/aleidk/plugins-ide/remote-sshfs.lua | 1 + .../lua/aleidk/plugins-ide/task-runner.lua | 22 +- .../nvim/lua/aleidk/plugins-ide/trouble.lua | 84 +++- 13 files changed, 311 insertions(+), 360 deletions(-) rename config/nvim/lua/aleidk/plugins-ide/{ts-node-action.lua => init.lua} (62%) delete mode 100644 config/nvim/lua/aleidk/plugins-ide/mason.lua diff --git a/config/nvim/lazy-lock.json b/config/nvim/lazy-lock.json index 08b5f87..7171664 100644 --- a/config/nvim/lazy-lock.json +++ b/config/nvim/lazy-lock.json @@ -16,27 +16,24 @@ "copilot-cmp": { "branch": "master", "commit": "b6e5286b3d74b04256d0a7e3bd2908eabec34b44" }, "copilot-lualine": { "branch": "main", "commit": "f40450c3e138766026327e7807877ea860618258" }, "copilot.lua": { "branch": "master", "commit": "f8d8d872bb319f640d5177dad5fbf01f7a16d7d0" }, - "diffview.nvim": { "branch": "main", "commit": "4516612fe98ff56ae0415a259ff6361a89419b0a" }, "dressing.nvim": { "branch": "master", "commit": "fc78a3ca96f4db9f8893bb7e2fd9823e0780451b" }, "friendly-snippets": { "branch": "main", "commit": "45a1b96e46efe5fce8af325d4bed45feb9d29d0f" }, "gitsigns.nvim": { "branch": "main", "commit": "e9c4187c3774a46df2d086a66cf3a7e6bea4c432" }, "grapple.nvim": { "branch": "main", "commit": "b41ddfc1c39f87f3d1799b99c2f0f1daa524c5f7" }, "indent-blankline.nvim": { "branch": "master", "commit": "7871a88056f7144defca9c931e311a3134c5d509" }, "lazy.nvim": { "branch": "main", "commit": "56ead98e05bb37a4ec28930a54d836d033cf00f2" }, - "lazygit.nvim": { "branch": "main", "commit": "dc56df433bfbf107fee0139e187eb9750878fa84" }, + "lazydev.nvim": { "branch": "main", "commit": "d5800897d9180cea800023f2429bce0a94ed6064" }, "lualine.nvim": { "branch": "master", "commit": "6a40b530539d2209f7dc0492f3681c8c126647ad" }, + "luvit-meta": { "branch": "main", "commit": "57d464c4acb5c2e66bd4145060f5dc9e96a7bbb7" }, "mason-lspconfig.nvim": { "branch": "main", "commit": "37a336b653f8594df75c827ed589f1c91d91ff6c" }, "mason.nvim": { "branch": "main", "commit": "f96a31855fa8aea55599cea412fe611b85a874ed" }, "mini.clue": { "branch": "main", "commit": "08f792869781b4bfdfcaa55eb905b9635c0a243f" }, "mini.comment": { "branch": "main", "commit": "c8406379987c321ecdef9f53e1ca741a55002104" }, "mini.surround": { "branch": "main", "commit": "3cb5b509ad34f2402df4b977be607a614c8c7524" }, - "neodev.nvim": { "branch": "main", "commit": "46aa467dca16cf3dfe27098042402066d2ae242d" }, "neogen": { "branch": "main", "commit": "0daffcec249bf42275e322361fe55b89a05ff278" }, - "neogit": { "branch": "master", "commit": "a20031fb5d7d12148764764059243135085e5c9b" }, "noice.nvim": { "branch": "main", "commit": "6263b6696811f0b11c88d8d2371134b1cc1762fc" }, "nui.nvim": { "branch": "main", "commit": "61574ce6e60c815b0a0c4b5655b8486ba58089a1" }, "nvim-autopairs": { "branch": "master", "commit": "78a4507bb9ffc9b00f11ae0ac48243d00cb9194d" }, - "nvim-bqf": { "branch": "main", "commit": "1b24dc6050c34e8cd377b6b4cd6abe40509e0187" }, "nvim-cmp": { "branch": "main", "commit": "a110e12d0b58eefcf5b771f533fc2cf3050680ac" }, "nvim-lint": { "branch": "master", "commit": "efc6fc83f0772283e064c53a8f9fb5645bde0bc0" }, "nvim-lspconfig": { "branch": "master", "commit": "216deb2d1b5fbf24398919228208649bbf5cbadf" }, @@ -53,7 +50,7 @@ "render-markdown": { "branch": "main", "commit": "123048b428eb85618780fcef9ea9f4d68b5d2508" }, "smart-splits.nvim": { "branch": "master", "commit": "95833675cd92538bf9cded1d2d58d1fc271c5428" }, "telescope-fzf-native.nvim": { "branch": "main", "commit": "cf48d4dfce44e0b9a2e19a008d6ec6ea6f01a83b" }, - "telescope.nvim": { "branch": "master", "commit": "a0bbec21143c7bc5f8bb02e0005fa0b982edc026" }, + "telescope.nvim": { "branch": "0.1.x", "commit": "a0bbec21143c7bc5f8bb02e0005fa0b982edc026" }, "todo-comments.nvim": { "branch": "main", "commit": "d61567557e2ff5c548c74e96b2d9f8d33e5fcb34" }, "treesj": { "branch": "main", "commit": "6e8bd008bacd5ad001c3953017c1dca20709e915" }, "trouble.nvim": { "branch": "main", "commit": "03c1fbf518bef683422a3be9643c3da190903488" }, @@ -65,6 +62,5 @@ "vim-dadbod-ui": { "branch": "master", "commit": "f74a31e8c6c5a9dccc63450a09d5cd64a9294330" }, "vim-illuminate": { "branch": "master", "commit": "5eeb7951fc630682c322e88a9bbdae5c224ff0aa" }, "vim-sleuth": { "branch": "master", "commit": "1cc4557420f215d02c4d2645a748a816c220e99b" }, - "yazi.nvim": { "branch": "main", "commit": "faa03e9acb894533b91c811d0dafd816b995088f" }, - "zk-nvim": { "branch": "main", "commit": "dbf4eeab55b08856c9d6b6722dbff39630bb35eb" } + "yazi.nvim": { "branch": "main", "commit": "faa03e9acb894533b91c811d0dafd816b995088f" } } diff --git a/config/nvim/lua/aleidk/plugins-core/lualine.lua b/config/nvim/lua/aleidk/plugins-core/lualine.lua index 391e50f..83aaede 100644 --- a/config/nvim/lua/aleidk/plugins-core/lualine.lua +++ b/config/nvim/lua/aleidk/plugins-core/lualine.lua @@ -66,6 +66,18 @@ return { end end + local trouble = require("trouble") + local symbols = trouble.statusline({ + mode = "lsp_document_symbols", + groups = {}, + title = false, + filter = { range = true }, + format = "{kind_icon}{symbol.name:Normal}", + -- The following line is needed to fix the background color + -- Set it to the lualine section you want to use + hl_group = "lualine_c_normal", + }) + return { options = { theme = "catppuccin", @@ -115,18 +127,12 @@ return { }, }, { codecompanion_status }, - { "aerial" }, { - "overseer", + symbols.get, + cond = symbols.has, }, { - -- Macro recording status - function() - return require("noice").api.status.mode.get() - end, - cond = function() - return package.loaded["noice"] and require("noice").api.status.mode.has() - end, + "overseer", }, }, lualine_x = { @@ -137,6 +143,15 @@ return { }, }, lualine_y = { + { + -- Macro recording status + function() + return require("noice").api.status.mode.get() + end, + cond = function() + return package.loaded["noice"] and require("noice").api.status.mode.has() + end, + }, { "searchcount" }, { "location" }, { diff --git a/config/nvim/lua/aleidk/plugins-core/telescope.lua b/config/nvim/lua/aleidk/plugins-core/telescope.lua index 48441dc..ad89cf6 100644 --- a/config/nvim/lua/aleidk/plugins-core/telescope.lua +++ b/config/nvim/lua/aleidk/plugins-core/telescope.lua @@ -35,12 +35,8 @@ return { [""] = actions.close, [""] = actions.send_to_qflist + actions.open_qflist, [""] = actions.send_selected_to_qflist + actions.open_qflist, - [""] = function(...) - return require("trouble.providers.telescope").open_with_trouble(...) - end, - [""] = function(...) - return require("trouble.providers.telescope").open_selected_with_trouble(...) - end, + [""] = require("trouble.sources.telescope").open, + [""] = require("trouble.sources.telescope").open, }, }, }, diff --git a/config/nvim/lua/aleidk/plugins-ide/color-picker.lua b/config/nvim/lua/aleidk/plugins-ide/color-picker.lua index 221ed52..626f66f 100644 --- a/config/nvim/lua/aleidk/plugins-ide/color-picker.lua +++ b/config/nvim/lua/aleidk/plugins-ide/color-picker.lua @@ -2,7 +2,6 @@ return { { -- Color Picker "uga-rosa/ccc.nvim", - event = "VeryLazy", opts = { auto_enable = true, lsp = true, diff --git a/config/nvim/lua/aleidk/plugins-ide/formatter.lua b/config/nvim/lua/aleidk/plugins-ide/formatter.lua index 2da9aec..2cab30d 100644 --- a/config/nvim/lua/aleidk/plugins-ide/formatter.lua +++ b/config/nvim/lua/aleidk/plugins-ide/formatter.lua @@ -1,6 +1,7 @@ return { "stevearc/conform.nvim", - event = "VeryLazy", + event = { "BufWritePre" }, + cmd = { "ConformInfo" }, opts = { -- log_level = vim.log.levels.DEBUG, @@ -13,13 +14,13 @@ return { -- have other formatters configured. ["_"] = { "trim_whitespace" }, blade = { "blade-formatter" }, - css = { "prettierd", "prettier" }, + css = { "biome" }, go = { "gofumpt", "goimports_reviser", "golines" }, html = { "djlint", "prettierd", stop_after_first = true }, - javascript = { "prettierd", "prettier", stop_after_first = true }, - javascriptreact = { "prettierd", "prettier", stop_after_first = true }, - json = { "prettierd", "prettier", stop_after_first = true }, - jsonc = { "prettierd", "prettier", stop_after_first = true }, + javascript = { "biome" }, + javascriptreact = { "biome" }, + json = { "biome" }, + jsonc = { "biome" }, lua = { "stylua" }, markdown = { "markdownlint" }, nim = { "nimpretty" }, @@ -27,8 +28,8 @@ return { python = { "ruff_format", "ruff_organize_imports" }, scss = { "prettierd", "prettier", stop_after_first = true }, sh = { "shfmt" }, - typescript = { "prettierd", "prettier", stop_after_first = true }, - typescriptreact = { "prettierd", "prettier", stop_after_first = true }, + typescript = { "biome" }, + typescriptreact = { "biome" }, xml = { "lemminx" }, zsh = { "shfmt" } }, diff --git a/config/nvim/lua/aleidk/plugins-ide/git.lua b/config/nvim/lua/aleidk/plugins-ide/git.lua index a248abf..4cc6a38 100644 --- a/config/nvim/lua/aleidk/plugins-ide/git.lua +++ b/config/nvim/lua/aleidk/plugins-ide/git.lua @@ -32,66 +32,4 @@ return { end, }, }, - { - "kdheepak/lazygit.nvim", - event = "VeryLazy", - dependencies = { - "nvim-lua/plenary.nvim", - }, - keys = { - { "gG", ":LazyGit", desc = "Lazygit" }, - }, - }, - { - "NeogitOrg/neogit", - dependencies = { - "nvim-lua/plenary.nvim", -- required - "nvim-telescope/telescope.nvim", -- optional - "sindrets/diffview.nvim", -- optional - }, - config = true, - opts = { - disable_line_numbers = false, - console_timeout = 8000, - graph_style = "unicode", - kind = "tab", - ignored_settings = { - "NeogitPushPopup--force", - "NeogitPullPopup--rebase", - "NeogitCommitPopup--allow-empty", - "NeogitCommitPopup--reuse-message", - "NeogitRevertPopup--no-edit", - }, - }, - keys = { - { - "gg", - function() - require("neogit").open() - end, - desc = "Neogit", - }, - { - "gc", - function() - require("neogit").open({ "commit" }) - end, - desc = "Commit", - }, - { - "gp", - function() - require("neogit").open({ "pull" }) - end, - desc = "Pull", - }, - { - "gP", - function() - require("neogit").open({ "push" }) - end, - desc = "Push", - }, - }, - }, } diff --git a/config/nvim/lua/aleidk/plugins-ide/ts-node-action.lua b/config/nvim/lua/aleidk/plugins-ide/init.lua similarity index 62% rename from config/nvim/lua/aleidk/plugins-ide/ts-node-action.lua rename to config/nvim/lua/aleidk/plugins-ide/init.lua index 1dc970d..286bfc6 100644 --- a/config/nvim/lua/aleidk/plugins-ide/ts-node-action.lua +++ b/config/nvim/lua/aleidk/plugins-ide/init.lua @@ -2,12 +2,10 @@ return { { "ckolkey/ts-node-action", dependencies = { "nvim-treesitter" }, - event = "VeryLazy", - config = function() - require("ts-node-action").setup({}) - - vim.keymap.set({ "n" }, "lA", require("ts-node-action").node_action, { desc = "Node Action" }) - end, + opts = {}, + keys = { + { "ls", function() require("ts-node-action").node_action() end, desc = "Node Action" } + } }, { "Wansmer/treesj", diff --git a/config/nvim/lua/aleidk/plugins-ide/linters.lua b/config/nvim/lua/aleidk/plugins-ide/linters.lua index 4ab5fdb..424f370 100644 --- a/config/nvim/lua/aleidk/plugins-ide/linters.lua +++ b/config/nvim/lua/aleidk/plugins-ide/linters.lua @@ -8,10 +8,10 @@ return { lint.linters.gitlint.args = { "--contrib", "contrib-title-conventional-commits", "--msg-filename", "-" } lint.linters_by_ft = { - javascript = { "eslint_d" }, - typescript = { "eslint_d" }, - javascriptreact = { "eslint_d" }, - typescriptreact = { "eslint_d" }, + javascript = { "biomejs" }, + typescript = { "biomejs" }, + javascriptreact = { "biomejs" }, + typescriptreact = { "biomejs" }, -- astro = { "eslint_d" }, python = { "ruff" }, sh = { "shellcheck" }, diff --git a/config/nvim/lua/aleidk/plugins-ide/lsp.lua b/config/nvim/lua/aleidk/plugins-ide/lsp.lua index 553b256..2565d96 100644 --- a/config/nvim/lua/aleidk/plugins-ide/lsp.lua +++ b/config/nvim/lua/aleidk/plugins-ide/lsp.lua @@ -1,253 +1,214 @@ -return { { - -- LSP Configuration & Plugins - "neovim/nvim-lspconfig", - event = { "BufReadPost", "BufNewFile", "BufWritePre" }, - dependencies = { - -- Automatically install LSPs to stdpath for neovim - { "williamboman/mason.nvim" }, - "williamboman/mason-lspconfig.nvim", - -- Additional lua configuration, makes nvim stuff amazing! - { "folke/neodev.nvim", opts = {} }, +return { + -- LSP Plugins + { + -- `lazydev` configures Lua LSP for your Neovim config, runtime and plugins + -- used for completion, annotations and signatures of Neovim apis + 'folke/lazydev.nvim', + ft = 'lua', + opts = { + library = { + -- Load luvit types when the `vim.uv` word is found + { path = 'luvit-meta/library', words = { 'vim%.uv' } }, + }, + }, }, + { "Bilal2453/luvit-meta", lazy = true }, -- optional `vim.uv` typings + { + -- LSP Configuration & Plugins + "neovim/nvim-lspconfig", + event = { "BufReadPost", "BufNewFile", "BufWritePre" }, + dependencies = { + -- Automatically install LSPs to stdpath for neovim + { "williamboman/mason.nvim", config = true }, + "williamboman/mason-lspconfig.nvim", + }, - config = function() - -- LSP settings. - local on_attach = function(_, bufnr) - local nmap = function(keys, func, desc) - if desc then - desc = "LSP: " .. desc + config = function() + -- LSP settings. + local on_attach = function(_, bufnr) + local nmap = function(keys, func, desc) + if desc then + desc = "LSP: " .. desc + end + + vim.keymap.set("n", keys, func, { buffer = bufnr, desc = desc }) end - vim.keymap.set("n", keys, func, { buffer = bufnr, desc = desc }) + nmap("lr", vim.lsp.buf.rename, "Rename") + -- stylua: ignore + vim.keymap.set({ "n", "x", "v" }, "la", vim.lsp.buf.code_action, { buffer = bufnr, desc = "Code Action" }) + nmap("ld", vim.lsp.buf.type_definition, "Go to type definition") + nmap("lf", function() + vim.lsp.buf.format() + end, "Format") + + nmap("gd", vim.lsp.buf.definition, "Go to definition") + nmap("gr", require("telescope.builtin").lsp_references, "Goto References") + nmap("gI", vim.lsp.buf.implementation, "Go to Implementation") + + -- See `:help K` for why this keymap + nmap("K", vim.lsp.buf.hover, "Hover Documentation") + -- nmap("", vim.lsp.buf.signature_help, "Signature Documentation") + + -- Lesser used LSP functionality + nmap("gD", vim.lsp.buf.declaration, "Goto Declaration") + + nmap("lj", vim.diagnostic.goto_next, "Go to next diagnostic") + nmap("lk", vim.diagnostic.goto_prev, "Go to prev diagnostic") + nmap("lK", function() + -- execute twice to enter the float inmediatly + vim.diagnostic.open_float() + vim.diagnostic.open_float() + end, "Hover current diagnostic") + + -- Create a command `:Format` local to the LSP buffer + vim.api.nvim_buf_create_user_command(bufnr, "Format", function(_) + vim.lsp.buf.format() + end, { desc = "Format current buffer with LSP" }) end - nmap("lr", vim.lsp.buf.rename, "Rename") - -- stylua: ignore - vim.keymap.set({ "n", "x", "v" }, "la", vim.lsp.buf.code_action, { buffer = bufnr, desc = "Code Action" }) - nmap("ld", vim.lsp.buf.type_definition, "Go to type definition") - nmap("lf", function() - vim.lsp.buf.format() - end, "Format") - - nmap("gd", vim.lsp.buf.definition, "Go to definition") - nmap("gr", require("telescope.builtin").lsp_references, "Goto References") - nmap("gI", vim.lsp.buf.implementation, "Go to Implementation") - - -- See `:help K` for why this keymap - nmap("K", vim.lsp.buf.hover, "Hover Documentation") - -- nmap("", vim.lsp.buf.signature_help, "Signature Documentation") - - -- Lesser used LSP functionality - nmap("gD", vim.lsp.buf.declaration, "Goto Declaration") - - nmap("lj", vim.diagnostic.goto_next, "Go to next diagnostic") - nmap("lk", vim.diagnostic.goto_prev, "Go to prev diagnostic") - nmap("lK", function() - -- execute twice to enter the float inmediatly - vim.diagnostic.open_float() - vim.diagnostic.open_float() - end, "Hover current diagnostic") - - -- Create a command `:Format` local to the LSP buffer - vim.api.nvim_buf_create_user_command(bufnr, "Format", function(_) - vim.lsp.buf.format() - end, { desc = "Format current buffer with LSP" }) - end - - -- Enable the following language servers - -- To see options and cofigurations: https://github.com/neovim/nvim-lspconfig/blob/master/doc/server_configurations.md - local servers = { - astro = {}, - bashls = {}, - cssls = {}, - dockerls = {}, - emmet_ls = { - filetypes = { - "astro", - "css", - "eruby", - "html", - "htmldjango", - "javascriptreact", - "less", - "pug", - "sass", - "scss", - "svelte", - "typescriptreact", - "vue", - "htmlangular", - "php", - "blade" + -- Enable the following language servers + -- To see options and cofigurations: https://github.com/neovim/nvim-lspconfig/blob/master/doc/server_configurations.md + local servers = { + astro = {}, + bashls = {}, + cssls = {}, + dockerls = {}, + emmet_ls = { + filetypes = { + "astro", + "css", + "eruby", + "html", + "htmldjango", + "javascriptreact", + "less", + "pug", + "sass", + "scss", + "svelte", + "typescriptreact", + "vue", + "htmlangular", + "php", + "blade" + }, }, - }, - html = {}, - ["nil_ls"] = {}, - marksman = {}, - pyright = {}, - phpactor = {}, - gopls = { - settings = { - gopls = { - completeUnimported = true, - usePlaceholders = true, - analyses = { - unusedparams = true, + html = {}, + marksman = {}, + pyright = {}, + phpactor = {}, + gopls = { + settings = { + gopls = { + completeUnimported = true, + usePlaceholders = true, + analyses = { + unusedparams = true, + }, }, }, }, - }, - ruff = {}, - rust_analyzer = { - settings = { - ["rust-analyzer"] = { - imports = { - granularity = { - group = "module", + ruff = {}, + rust_analyzer = { + settings = { + ["rust-analyzer"] = { + imports = { + granularity = { + group = "module", + }, + prefix = "self", }, - prefix = "self", - }, - cargo = { - buildScripts = { + cargo = { + buildScripts = { + enable = true, + }, + }, + procMacro = { enable = true, }, }, - procMacro = { - enable = true, - }, }, }, - }, - sqlls = {}, - yamlls = {}, - tsserver = { - init_options = { - preferences = { - disableSuggestions = true, - }, - }, - }, - lua_ls = { - settings = { - Lua = { - runtime = { - -- Tell the language server which version of Lua you're using - -- (most likely LuaJIT in the case of Neovim) - version = "LuaJIT", - }, - -- Make the server aware of Neovim runtime files - workspace = { - checkThirdParty = false, - library = { - vim.env.VIMRUNTIME, - -- "${3rd}/luv/library" - -- "${3rd}/busted/library", + sqlls = {}, + yamlls = {}, + lua_ls = { + settings = { + Lua = { + completion = { + callSnippet = 'Replace', }, + diagnostics = { disable = { 'missing-fields' } }, }, }, }, - }, - } + } - -- nvim-cmp supports additional completion capabilities, so broadcast that to servers - local capabilities = vim.lsp.protocol.make_client_capabilities() - capabilities = require("cmp_nvim_lsp").default_capabilities(capabilities) + -- nvim-cmp supports additional completion capabilities, so broadcast that to servers + local capabilities = vim.lsp.protocol.make_client_capabilities() + capabilities = require("cmp_nvim_lsp").default_capabilities(capabilities) - -- Ensure the servers above are installed - local mason_lspconfig = require("mason-lspconfig") + -- Ensure the servers above are installed + local mason_lspconfig = require("mason-lspconfig") - mason_lspconfig.setup({ - ensure_installed = vim.tbl_keys(servers), - -- automatic_installation = { exclude = { "astro", "phpactor", "rust_analyzer", "sqlls" } }, - automatic_installation = false, - }) + mason_lspconfig.setup({ + ensure_installed = vim.tbl_keys(servers), + automatic_installation = false, + }) - mason_lspconfig.setup_handlers({ - function(server_name) - local _border = "single" + mason_lspconfig.setup_handlers({ + function(server_name) + local _border = "single" - local default_config = { - capabilities = capabilities, - on_attach = on_attach, - handlers = { - ["textDocument/signatureHelp"] = vim.lsp.with(vim.lsp.handlers.signature_help, { - border = _border, - }), - ["textDocument/hover"] = vim.lsp.with(vim.lsp.handlers.hover, { - border = _border, - max_width = 200, - max_height = 200, - focus = true, - }), - }, - } + local default_config = { + capabilities = capabilities, + on_attach = on_attach, + handlers = { + ["textDocument/signatureHelp"] = vim.lsp.with(vim.lsp.handlers.signature_help, { + border = _border, + }), + ["textDocument/hover"] = vim.lsp.with(vim.lsp.handlers.hover, { + border = _border, + max_width = 200, + max_height = 200, + focus = true, + }), + }, + } - require("lspconfig")[server_name].setup( - vim.tbl_deep_extend("force", default_config, servers[server_name] or {}) - ) - end, - }) - - vim.diagnostic.config({ - update_in_insert = false, - underline = true, - float = { - source = true - }, - virtual_text = { - severity = vim.diagnostic.severity.ERROR, - source = true, - spacing = -1, - prefix = nil, - format = function(diagnostic) - -- show small error code instead of whole error that probably won't fit in the screen - -- to see the whole error use other keybindings - return tostring(diagnostic.code) + require("lspconfig")[server_name].setup( + vim.tbl_deep_extend("force", default_config, servers[server_name] or {}) + ) end, - virt_text_hide = true - }, - severity_sort = true, - }) + }) - -- Customize gutter icons - local signs = require("aleidk.constants").icons.diagnostics - for type, icon in pairs(signs) do - local hl = "DiagnosticSign" .. type - vim.fn.sign_define(hl, { text = icon, texthl = hl, numhl = hl }) - end - end, -}, - - { - 'stevearc/aerial.nvim', - -- Optional dependencies - dependencies = { - "nvim-treesitter/nvim-treesitter", - "nvim-tree/nvim-web-devicons" - }, - opts = { - close_on_select = false, - show_guides = true, - autojump = true, - highlight_on_hover = true, - layout = { - default_direction = "float", - }, - float = { - relative = "editor", - }, - nav = { - preview = true, - keymaps = { - ["q"] = "actions.close", + vim.diagnostic.config({ + update_in_insert = false, + underline = true, + float = { + source = true }, - }, - }, + virtual_text = { + severity = vim.diagnostic.severity.ERROR, + source = true, + spacing = -1, + prefix = nil, + format = function(diagnostic) + -- show small error code instead of whole error that probably won't fit in the screen + -- to see the whole error use other keybindings + return tostring(diagnostic.code) + end, + virt_text_hide = true + }, + severity_sort = true, + }) - keys = { - { "ll", function() require("aerial").toggle() end, desc = "Open syntax tree" }, - { "lL", function() require("aerial").nav_toggle() end, desc = "Open syntax tree navigation" }, - { "fl", "Telescope aerial", desc = "Find in syntax tree" }, - } - } + -- Customize gutter icons + local signs = require("aleidk.constants").icons.diagnostics + for type, icon in pairs(signs) do + local hl = "DiagnosticSign" .. type + vim.fn.sign_define(hl, { text = icon, texthl = hl, numhl = hl }) + end + end, + }, } diff --git a/config/nvim/lua/aleidk/plugins-ide/mason.lua b/config/nvim/lua/aleidk/plugins-ide/mason.lua deleted file mode 100644 index 181d119..0000000 --- a/config/nvim/lua/aleidk/plugins-ide/mason.lua +++ /dev/null @@ -1,8 +0,0 @@ -return { - "williamboman/mason.nvim", - cmd = "Mason", - build = ":MasonUpdate", - opts = { - ensure_installed = {}, - }, -} diff --git a/config/nvim/lua/aleidk/plugins-ide/remote-sshfs.lua b/config/nvim/lua/aleidk/plugins-ide/remote-sshfs.lua index d4975cb..f62134c 100644 --- a/config/nvim/lua/aleidk/plugins-ide/remote-sshfs.lua +++ b/config/nvim/lua/aleidk/plugins-ide/remote-sshfs.lua @@ -1,6 +1,7 @@ return { "nosduco/remote-sshfs.nvim", dependencies = { "nvim-telescope/telescope.nvim" }, + cmd = { "RemoteSSHFSConnec" }, config = function() require("remote-sshfs").setup({}) require("telescope").load_extension("remote-sshfs") diff --git a/config/nvim/lua/aleidk/plugins-ide/task-runner.lua b/config/nvim/lua/aleidk/plugins-ide/task-runner.lua index 97b9d26..3af9f6d 100644 --- a/config/nvim/lua/aleidk/plugins-ide/task-runner.lua +++ b/config/nvim/lua/aleidk/plugins-ide/task-runner.lua @@ -19,13 +19,11 @@ local scroll_to_end = function(winid) winid = winid or 0 local bufnr = vim.api.nvim_win_get_buf(winid) local lnum = vim.api.nvim_buf_line_count(bufnr) - local last_line = vim.api.nvim_buf_get_lines(bufnr, -2, -1, true)[1] -- Hack: terminal buffers add a bunch of empty lines at the end. We need to ignore them so that -- we don't end up scrolling off the end of the useful output. local not_much_output = lnum < vim.o.lines + 6 if vim.bo[bufnr].buftype == "terminal" and not_much_output then lnum = term_get_effective_line_count(bufnr) - last_line = vim.api.nvim_buf_get_lines(bufnr, lnum - 1, lnum, true)[1] end local scrolloff = vim.api.nvim_get_option_value("scrolloff", { scope = "local", win = winid }) vim.api.nvim_set_option_value("scrolloff", 0, { scope = "local", win = winid }) @@ -57,22 +55,22 @@ end return { "stevearc/overseer.nvim", keys = { - { "pO", "OverseerQuickAction hsplit", desc = "Open task in a hsplit" }, + { "pO", "OverseerQuickAction hsplit", desc = "Open task in a hsplit" }, { "pQ", "OverseerQuickAction close winOverseerQuickAction dispose", desc = "Close and dispose task's windows", }, - { "pW", "OverseerQuickAction unwatch", desc = "Unwatch task" }, + { "pW", "OverseerQuickAction unwatch", desc = "Unwatch task" }, { "pf", "OverseerQuickAction open float", desc = "Open task in a float window" }, - { "pl", "OverseerLoadBundle", desc = "Load tasks" }, - { "pm", "OverseerTaskAction", desc = "Manage task" }, - { "po", "OverseerQuickAction vsplit", desc = "Open task in a vsplit" }, - { "pp", "OverseerRun", desc = "Run task" }, - { "pq", "OverseerQuickAction close win", desc = "Close task's windows" }, - { "ps", "OverseerSaveBundle", desc = "Save tasks" }, - { "pt", "OverseerToggle", desc = "Toggle tasks list" }, - { "pw", "OverseerQuickAction watch", desc = "Watch task" }, + { "pl", "OverseerLoadBundle", desc = "Load tasks" }, + { "pm", "OverseerTaskAction", desc = "Manage task" }, + { "po", "OverseerQuickAction vsplit", desc = "Open task in a vsplit" }, + { "pp", "OverseerRun", desc = "Run task" }, + { "pq", "OverseerQuickAction close win", desc = "Close task's windows" }, + { "ps", "OverseerSaveBundle", desc = "Save tasks" }, + { "pt", "OverseerToggle", desc = "Toggle tasks list" }, + { "pw", "OverseerQuickAction watch", desc = "Watch task" }, }, opts = { actions = { diff --git a/config/nvim/lua/aleidk/plugins-ide/trouble.lua b/config/nvim/lua/aleidk/plugins-ide/trouble.lua index 86b58a9..8b31a1c 100644 --- a/config/nvim/lua/aleidk/plugins-ide/trouble.lua +++ b/config/nvim/lua/aleidk/plugins-ide/trouble.lua @@ -1,24 +1,80 @@ return { "folke/trouble.nvim", dependencies = { "nvim-tree/nvim-web-devicons" }, - cmd = { "TroubleToggle", "Trouble" }, + cmd = { "Trouble" }, keys = { - { "fq", "TroubleToggle", desc = "Toggle trouble" }, - { "fd", "TroubleToggle workspace_diagnostics", desc = "Find diagnostics" }, { "fD", - "TroubleToggle document_diagnostics", - desc = "Find diagnostics in workspace", + "Trouble diagnostics open", + desc = "Find diagnostics (Trouble)", + }, + { + "fd", + "Trouble diagnostics open filter.buf=0", + desc = "Find buffer diagnostics (Trouble)", + }, + { + "ll", + "Trouble symbols open", + desc = "Symbols (Trouble)", + }, + { + "li", + "Trouble lsp open", + desc = "LSP info of node (Trouble)", + }, + { + "fq", + "Trouble qflist open", + desc = "Quickfix List (Trouble)", }, }, - config = function() - require("trouble").setup({ - mode = "document_diagnostics", - action_keys = { - open_split = "s", - open_vsplit = "v", - open_tab = "t", + opts = function() + ---@type trouble.Window.opts + local win_opts = { + -- size = { width = 30, height = 0.5 }, + minimal = true, + border = "rounded", + position = "bottom", + } + + ---@type trouble.Config + return { + focus = false, + + ---@type trouble.Window.opts + preview = { + type = "split", + relative = "win", + position = "top", }, - }) - end, + + ---@type table + keys = { + [""] = "jump_close", + ["<2-leftmouse>"] = "jump_close", + [""] = "jump_split_close", + [""] = "jump_vsplit_close", + ["v"] = "jump_split_close", + ["s"] = "jump_vsplit_close", + [""] = "cancel", -- hack to fool myself into thinking I move to the avobe window + }, + win = win_opts, + ---@type table + modes = { + symbols = { + focus = true, + win = win_opts + }, + lsp_references = { + focus = true, + win = win_opts + }, + lsp = { + focus = true, + win = win_opts + }, + } + } + end }