From 92b9ac12334ee5ad6af5187d04083eb77133571f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Moritz=20B=C3=B6hme?= Date: Fri, 11 Aug 2023 17:38:26 +0200 Subject: [PATCH] feat(nvim): simplify lsp config --- flake.lock | 68 ------------------- flake.nix | 12 ---- modules/programs/nvim/plugins/default.nix | 7 -- .../programs/nvim/plugins/nvim-lspconfig.lua | 45 ++++++------ overlays/vimPlugins.nix | 22 ------ 5 files changed, 22 insertions(+), 132 deletions(-) diff --git a/flake.lock b/flake.lock index 14e7bc4..b24bece 100644 --- a/flake.lock +++ b/flake.lock @@ -55,38 +55,6 @@ "type": "github" } }, - "cmp-async-path": { - "flake": false, - "locked": { - "lastModified": 1673896803, - "narHash": "sha256-dgAiVbdMiKjiKWk+dJf/Zz8T20+D4OalGH5dTzYi5aM=", - "owner": "FelipeLema", - "repo": "cmp-async-path", - "rev": "d8229a93d7b71f22c66ca35ac9e6c6cd850ec61d", - "type": "github" - }, - "original": { - "owner": "FelipeLema", - "repo": "cmp-async-path", - "type": "github" - } - }, - "copilot-lua": { - "flake": false, - "locked": { - "lastModified": 1688190439, - "narHash": "sha256-lD9FdbKKZ6d/BjIfqp0Ust2hqSYNLpCFWxuaKUO9qLs=", - "owner": "zbirenbaum", - "repo": "copilot.lua", - "rev": "e48bd7020a98be217d85c006a298656294fd6210", - "type": "github" - }, - "original": { - "owner": "zbirenbaum", - "repo": "copilot.lua", - "type": "github" - } - }, "darwin": { "inputs": { "nixpkgs": [ @@ -470,22 +438,6 @@ "type": "github" } }, - "leap-spooky-nvim": { - "flake": false, - "locked": { - "lastModified": 1687792124, - "narHash": "sha256-EPqbsG7KFHdnbW430+BSrPeOoVy99KtIC8OpFbV1ycw=", - "owner": "ggandor", - "repo": "leap-spooky.nvim", - "rev": "e003f2aa376190148f2e7731a60c89239335013c", - "type": "github" - }, - "original": { - "owner": "ggandor", - "repo": "leap-spooky.nvim", - "type": "github" - } - }, "lowdown-src": { "flake": false, "locked": { @@ -502,22 +454,6 @@ "type": "github" } }, - "lspsaga-nvim": { - "flake": false, - "locked": { - "lastModified": 1689849495, - "narHash": "sha256-tD3UxJUtYoxUMTFF4gfKChVfI5SxZQ2C12WRF73Ahc4=", - "owner": "glepnir", - "repo": "lspsaga.nvim", - "rev": "0c20101ac826961a7052c4ad9d5f7f791b4adab1", - "type": "github" - }, - "original": { - "owner": "glepnir", - "repo": "lspsaga.nvim", - "type": "github" - } - }, "master": { "locked": { "lastModified": 1689880801, @@ -848,15 +784,11 @@ "agenix": "agenix", "arkenfox-userjs": "arkenfox-userjs", "asus-touchpad-numpad-driver": "asus-touchpad-numpad-driver", - "cmp-async-path": "cmp-async-path", - "copilot-lua": "copilot-lua", "flake-utils": "flake-utils", "home-manager": "home-manager_2", "hypr-contrib": "hypr-contrib", "hyprland": "hyprland", "hyprpaper": "hyprpaper", - "leap-spooky-nvim": "leap-spooky-nvim", - "lspsaga-nvim": "lspsaga-nvim", "master": "master", "neovim-nightly-overlay": "neovim-nightly-overlay", "nil": "nil", diff --git a/flake.nix b/flake.nix index 42191c8..724cd7c 100644 --- a/flake.nix +++ b/flake.nix @@ -35,24 +35,12 @@ # Neovim neovim-nightly-overlay.url = "github:nix-community/neovim-nightly-overlay"; - cmp-async-path.url = "github:FelipeLema/cmp-async-path"; - cmp-async-path.flake = false; - - copilot-lua.flake = false; - copilot-lua.url = "github:zbirenbaum/copilot.lua"; - - lspsaga-nvim.flake = false; - lspsaga-nvim.url = "github:glepnir/lspsaga.nvim"; - nvim-treesitter-textsubjects.flake = false; nvim-treesitter-textsubjects.url = "github:RRethy/nvim-treesitter-textsubjects"; smartcolumn-nvim.flake = false; smartcolumn-nvim.url = "github:m4xshen/smartcolumn.nvim"; - leap-spooky-nvim.flake = false; - leap-spooky-nvim.url = "github:ggandor/leap-spooky.nvim"; - telekasten-nvim.flake = false; telekasten-nvim.url = "github:renerocksai/telekasten.nvim"; diff --git a/modules/programs/nvim/plugins/default.nix b/modules/programs/nvim/plugins/default.nix index c6372f2..d8ab853 100644 --- a/modules/programs/nvim/plugins/default.nix +++ b/modules/programs/nvim/plugins/default.nix @@ -132,13 +132,6 @@ with builtins; { plugin = which-key-nvim; } { plugin = lspkind-nvim; } { plugin = lsp_lines-nvim; } - { - plugin = lspsaga-nvim-original; - dependencies = [ - { plugin = nvim-web-devicons; } - { plugin = nvim-treesitter.withAllGrammars; } - ]; - } { plugin = nvim-ufo; dependencies = [ diff --git a/modules/programs/nvim/plugins/nvim-lspconfig.lua b/modules/programs/nvim/plugins/nvim-lspconfig.lua index 35cce24..12f12db 100644 --- a/modules/programs/nvim/plugins/nvim-lspconfig.lua +++ b/modules/programs/nvim/plugins/nvim-lspconfig.lua @@ -53,51 +53,50 @@ capabilities.textDocument.foldingRange = { } require("ufo").setup() -require("lspsaga").setup({ - symbol_in_winbar = { - enable = false, - }, - lightbulb = { - enable = false, - enable_in_insert = false, - }, -}) - local lspconfig = require("lspconfig") local on_attach_def = function(_, bufnr) require("which-key").register({ - K = { "Lspsaga hover_doc ++quiet", "show info" }, + K = { vim.lsp.buf.hover, "Hover" }, [""] = { l = { - d = { "Lspsaga show_cursor_diagnostics", "open diagnostic window" }, - c = { "Lspsaga code_action", "code action" }, - r = { "Lspsaga rename", "rename" }, - i = { "Lspsaga hover_doc ++keep", "show info (sticky)" }, + d = { vim.diagnostic.open_float, "Open diagnostic window" }, + c = { vim.lsp.buf.code_action, "Code action" }, + r = { vim.lsp.buf.rename, "Rename" }, f = { function() vim.lsp.buf.format({ async = true }) end, - "format (lsp)", + "Format (lsp)", mode = { "n", "v" }, }, }, t = { - l = { lsp_lines.toggle, "lsp lines" }, + l = { lsp_lines.toggle, "Lsp lines" }, }, }, g = { - d = { "Lspsaga peek_definition", "Goto definition" }, - t = { "Lspsaga peek_type_definition", "Goto type defininition" }, - h = { "Lspsaga lsp_finder", "Lsp finder" }, - r = { "Telescope lsp_references", "Goto reference" }, + d = { + function() + require("telescope.builtin").lsp_definitions({ reuse_win = true }) + end, + "Goto definition", + }, + t = { + function() + require("telescope.builtin").lsp_type_definitions({ reuse_win = true }) + end, + "Goto type defininition", + }, + r = { "Telescope lsp_references", "Goto references" }, D = { vim.lsp.buf.declaration, "Goto declaration" }, I = { "Telescope lsp_implementations", "Goto implementation" }, + K = { vim.lsp.buf.signature_help, "Signature help" }, }, ["["] = { - d = { "Lspsaga diagnostic_jump_prev", "Previous diagnostic" }, + d = { vim.diagnostic.goto_prev, "Previous diagnostic" }, }, ["]"] = { - d = { "Lspsaga diagnostic_jump_next", "Next diagnostic" }, + d = { vim.diagnostic.goto_next, "Next diagnostic" }, }, }, { buffer = bufnr, silent = true }) end diff --git a/overlays/vimPlugins.nix b/overlays/vimPlugins.nix index 0b8727b..5daec2e 100644 --- a/overlays/vimPlugins.nix +++ b/overlays/vimPlugins.nix @@ -16,28 +16,6 @@ with lib.my; src = inputs.smartcolumn-nvim; }; - copilot-lua = prev.vimPlugins.copilot-lua.overrideAttrs (_: { - version = mkVersionInput inputs.copilot-lua; - src = inputs.copilot-lua; - }); - - lspsaga-nvim-original = prev.vimPlugins.lspsaga-nvim-original.overrideAttrs (_: { - version = mkVersionInput inputs.lspsaga-nvim; - src = inputs.lspsaga-nvim; - }); - - cmp-async-path = prev.vimPlugins.cmp-path.overrideAttrs (_: { - pname = "cmp-async-path"; - version = mkVersionInput inputs.cmp-async-path; - src = inputs.cmp-async-path; - }); - - leap-spooky-nvim = prev.vimUtils.buildVimPluginFrom2Nix { - pname = "leap-spooky-nvim"; - version = mkVersionInput inputs.leap-spooky-nvim; - src = inputs.leap-spooky-nvim; - }; - telekasten-nvim = prev.vimUtils.buildVimPluginFrom2Nix { pname = "telekasten-nvim"; version = mkVersionInput inputs.telekasten-nvim;