From 46bab9f2ddacf1af47a4f4a7e4bd47329306a303 Mon Sep 17 00:00:00 2001 From: meml0rz Date: Wed, 13 Nov 2024 00:50:06 +0100 Subject: [PATCH] kekl --- modules/nix/nvim/cmp.nix.bak | 35 -------- modules/nix/nvim/default.nix | 1 + modules/nix/nvim/lsp.nix | 157 ++++++++++++++--------------------- modules/nix/nvim/lsp.nix.bak | 66 --------------- modules/nix/nvim/nonels.nix | 62 ++++++++++++++ 5 files changed, 127 insertions(+), 194 deletions(-) delete mode 100644 modules/nix/nvim/cmp.nix.bak delete mode 100644 modules/nix/nvim/lsp.nix.bak create mode 100644 modules/nix/nvim/nonels.nix diff --git a/modules/nix/nvim/cmp.nix.bak b/modules/nix/nvim/cmp.nix.bak deleted file mode 100644 index 1be390f..0000000 --- a/modules/nix/nvim/cmp.nix.bak +++ /dev/null @@ -1,35 +0,0 @@ -{ config, pkgs, nixvim, ...}: -{ - programs.nixvim.plugins = { - cmp-nvim-lsp.enable = true; - cmp-path.enable = true; - cmp-buffer.enable = true; - cmp-clippy.enable = true; - cmp = { - enable = true; - autoEnableSources = false; - cmdline = { - completion = { - autocomplete = "require('cmp.types').cmp.TriggerEvent.TextChanged"; - completeopt = [ "menu" "menuone" "noinsert" "noselect" ]; - }; - }; - settings = { - mapping = { - "" = "cmp.mapping.complete()"; - "" = "cmp.mapping.scroll_docs(-4)"; - "" = "cmp.mapping.close()"; - "" = "cmp.mapping.scroll_docs(4)"; - "" = "cmp.mapping.confirm({ select = false })"; - "" = "cmp.mapping(cmp.mapping.select_prev_item(), {'i', 's'})"; - "" = "cmp.mapping(cmp.mapping.select_next_item(), {'i', 's'})"; - }; - sources = [ - { name = "nvim_lsp"; keyword_length = 1; max_item_count = 5; } - { name = "path"; keyword_length = 1; max_item_count = 5; } - { name = "clippy"; keyword_length = 1; max_item_count = 5; } - ]; - }; - }; - }; -} diff --git a/modules/nix/nvim/default.nix b/modules/nix/nvim/default.nix index b60cc68..1cb8add 100644 --- a/modules/nix/nvim/default.nix +++ b/modules/nix/nvim/default.nix @@ -9,6 +9,7 @@ ./lualine.nix ./alpha.nix ./dev.nix + ./nonels.nix ]; programs.nixvim = { enable = true; diff --git a/modules/nix/nvim/lsp.nix b/modules/nix/nvim/lsp.nix index eaa44aa..9d0f647 100644 --- a/modules/nix/nvim/lsp.nix +++ b/modules/nix/nvim/lsp.nix @@ -1,100 +1,71 @@ { - programs.nixvim.plugins = { - lsp-format = { - enable = true; - }; - lsp = { - enable = true; - inlayHints = true; - servers = { - html = { - enable = true; + programs.nixvim.plugins = { + lsp-format = { + enable = true; }; - lua_ls = { - enable = true; - }; - # nil-ls = { - # enable = true; - # }; - nixd = { - enable = true; - extraOptions = { - nixos = { - expr = "(builtins.getFlake \"/etc/nixos\").nixosConfigurations.aurelionite.options"; + lsp = { + enable = true; + inlayHints = true; + servers = { + html = { + enable = true; + }; + lua_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"; + }; + }; + }; + marksman = { + enable = true; + }; + pyright = { + enable = true; + }; + gopls = { + enable = true; + }; + yamlls = { + enable = true; + }; }; - home_manager = { - expr = "(builtins.getFlake \"/etc/nixos\").homeConfigurations.aurelionite.options"; + 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"; + }; + "cr" = { + action = "rename"; + desc = "Rename"; + }; + }; }; - }; }; - 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"; - # }; - # }; - }; }; - }; } diff --git a/modules/nix/nvim/lsp.nix.bak b/modules/nix/nvim/lsp.nix.bak deleted file mode 100644 index 61519de..0000000 --- a/modules/nix/nvim/lsp.nix.bak +++ /dev/null @@ -1,66 +0,0 @@ -{ 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; - }; - }; - }; - }; -} diff --git a/modules/nix/nvim/nonels.nix b/modules/nix/nvim/nonels.nix new file mode 100644 index 0000000..32506be --- /dev/null +++ b/modules/nix/nvim/nonels.nix @@ -0,0 +1,62 @@ +{ pkgs, ... }: +{ + plugins.none-ls = { + enable = true; + enableLspFormat = true; + settings = { + updateInInsert = false; + }; + sources = { + code_actions = { + gitsigns.enable = true; + statix.enable = true; + }; + diagnostics = { + statix.enable = true; + yamllint.enable = true; + }; + formatting = { + nixfmt = { + enable = true; + package = pkgs.nixfmt-rfc-style; + }; + black = { + enable = true; + settings = '' + { + extra_args = { "--fast" }, + } + ''; + }; + prettier = { + enable = true; + disableTsServerFormatter = true; + settings = '' + { + extra_args = { "--no-semi" }, + } + ''; + }; + stylua.enable = true; + yamlfmt = { + enable = true; + }; + hclfmt.enable = true; + }; + }; + }; + keymaps = [ + { + mode = [ + "n" + "v" + ]; + key = "cf"; + action = "lua vim.lsp.buf.format()"; + options = { + silent = true; + desc = "Format"; + }; + } + ]; +}