From a722790b06ff22d412006767512eacf340678871 Mon Sep 17 00:00:00 2001 From: meml0rz Date: Wed, 13 Nov 2024 00:39:17 +0100 Subject: [PATCH] kekl --- modules/nix/nvim/cmp.nix | 6 +- modules/nix/nvim/lsp.nix | 179 +++++++++++++++++++++++------------ modules/nix/nvim/lsp.nix.bak | 66 +++++++++++++ 3 files changed, 188 insertions(+), 63 deletions(-) create mode 100644 modules/nix/nvim/lsp.nix.bak diff --git a/modules/nix/nvim/cmp.nix b/modules/nix/nvim/cmp.nix index 7079d7a..618951e 100644 --- a/modules/nix/nvim/cmp.nix +++ b/modules/nix/nvim/cmp.nix @@ -26,8 +26,10 @@ in "" = "cmp.mapping.scroll_docs(4)"; "" = "cmp.mapping.complete()"; "" = "cmp.mapping.close()"; - "" = "cmp.mapping(cmp.mapping.select_next_item({behavior = cmp.SelectBehavior.Select}), {'i', 's'})"; - "" = "cmp.mapping(cmp.mapping.select_prev_item({behavior = cmp.SelectBehavior.Select}), {'i', 's'})"; + #"" = "cmp.mapping(cmp.mapping.select_next_item({behavior = cmp.SelectBehavior.Select}), {'i', 's'})"; + #"" = "cmp.mapping(cmp.mapping.select_prev_item({behavior = cmp.SelectBehavior.Select}), {'i', 's'})"; + "" = "cmp.mapping(cmp.mapping.select_prev_item(), {'i', 's'})"; + "" = "cmp.mapping(cmp.mapping.select_next_item(), {'i', 's'})"; "" = "cmp.mapping.confirm({ select = false, behavior = cmp.ConfirmBehavior.Replace })"; }; diff --git a/modules/nix/nvim/lsp.nix b/modules/nix/nvim/lsp.nix index 61519de..2f91a3a 100644 --- a/modules/nix/nvim/lsp.nix +++ b/modules/nix/nvim/lsp.nix @@ -1,66 +1,123 @@ -{ config, pkgs, nixvim, ... }: { - programs.nixvim.plugins = { - rustaceanvim = { - enable = true; - settings = { - server = { - cmd = [ - "rustup" - "run" - "nightly" - "rust-analyzer" - ]; - default_settings = { - rust-analyzer = { - check = { - command = "clippy"; - }; - inlayHints = { - lifetimeElisionHints = { - enable = "always"; - }; - }; - }; - }; - standalone = false; - }; + programs.nixvim.plugins = { + lsp-format = { + enable = true; + }; + lsp = { + enable = true; + inlayHints = true; + servers = { + html = { + enable = true; + }; + lua_ls = { + enable = true; + }; + # nil-ls = { + # enable = true; + # }; + nixd = { + enable = true; + extraOptions = { + nixos = { + expr = "(builtins.getFlake \"/etc/nixos\").nixosConfigurations.aurelionite.options"; }; + home_manager = { + expr = "(builtins.getFlake \"/etc/nixos\").homeConfigurations.aurelionite.options"; + }; + }; }; - lsp = { - enable = true; - servers = { - asm_lsp = { - enable = true; - autostart = true; - }; - clangd = { - enable = true; - autostart = true; - }; - gopls = { - enable = true; - autostart = true; - }; - lua_ls = { - enable = true; - autostart = true; - }; - nixd = { - enable = true; - autostart = true; - }; - pyright = { - enable = true; - autostart = true; - }; - rust_analyzer = { - enable = false; - autostart = true; - installCargo = true; - installRustc = true; - }; - }; + marksman = { + enable = true; }; - }; + pyright = { + enable = true; + }; + gopls = { + enable = true; + }; + terraformls = { + enable = true; + }; + yamlls = { + enable = true; + }; + }; + keymaps = { + silent = true; + lspBuf = { + gd = { + action = "definition"; + desc = "Goto Definition"; + }; + gr = { + action = "references"; + desc = "Goto References"; + }; + gD = { + action = "declaration"; + desc = "Goto Declaration"; + }; + gI = { + action = "implementation"; + desc = "Goto Implementation"; + }; + gT = { + action = "type_definition"; + desc = "Type Definition"; + }; + # Use LSP saga keybinding instead + # K = { + # action = "hover"; + # desc = "Hover"; + # }; + # "cw" = { + # action = "workspace_symbol"; + # desc = "Workspace Symbol"; + # }; + "cr" = { + action = "rename"; + desc = "Rename"; + }; + }; + # diagnostic = { + # "cd" = { + # action = "open_float"; + # desc = "Line Diagnostics"; + # }; + # "[d" = { + # action = "goto_next"; + # desc = "Next Diagnostic"; + # }; + # "]d" = { + # action = "goto_prev"; + # desc = "Previous Diagnostic"; + # }; + # }; + }; + }; + }; + extraConfigLua = '' + local _border = "rounded" + + vim.lsp.handlers["textDocument/hover"] = vim.lsp.with( + vim.lsp.handlers.hover, { + border = _border + } + ) + + vim.lsp.handlers["textDocument/signatureHelp"] = vim.lsp.with( + vim.lsp.handlers.signature_help, { + border = _border + } + ) + + vim.diagnostic.config{ + float={border=_border} + }; + + require('lspconfig.ui.windows').default_options = { + border = _border + } + ''; } diff --git a/modules/nix/nvim/lsp.nix.bak b/modules/nix/nvim/lsp.nix.bak new file mode 100644 index 0000000..61519de --- /dev/null +++ b/modules/nix/nvim/lsp.nix.bak @@ -0,0 +1,66 @@ +{ config, pkgs, nixvim, ... }: +{ + programs.nixvim.plugins = { + rustaceanvim = { + enable = true; + settings = { + server = { + cmd = [ + "rustup" + "run" + "nightly" + "rust-analyzer" + ]; + default_settings = { + rust-analyzer = { + check = { + command = "clippy"; + }; + inlayHints = { + lifetimeElisionHints = { + enable = "always"; + }; + }; + }; + }; + standalone = false; + }; + }; + }; + lsp = { + enable = true; + servers = { + asm_lsp = { + enable = true; + autostart = true; + }; + clangd = { + enable = true; + autostart = true; + }; + gopls = { + enable = true; + autostart = true; + }; + lua_ls = { + enable = true; + autostart = true; + }; + nixd = { + enable = true; + autostart = true; + }; + pyright = { + enable = true; + autostart = true; + }; + rust_analyzer = { + enable = false; + autostart = true; + installCargo = true; + installRustc = true; + }; + }; + }; + }; +}