From f1890f15be686b63368619a7f35f53ec5bc66a6c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Moritz=20B=C3=B6hme?= Date: Sat, 31 Aug 2024 10:14:44 +0200 Subject: [PATCH 1/9] feat: use nixvim --- flake.lock | 240 +++++++++++++++++++++-- flake.nix | 11 +- modules/programs/nvim/default.nix | 306 +++++++++++++++++++++++++++--- modules/programs/nvim/options.lua | 1 + 4 files changed, 517 insertions(+), 41 deletions(-) diff --git a/flake.lock b/flake.lock index c65f9c3..3391298 100644 --- a/flake.lock +++ b/flake.lock @@ -228,6 +228,20 @@ } }, "flake-compat_4": { + "locked": { + "lastModified": 1696426674, + "narHash": "sha256-kvjfFW7WAETZlt09AgDn1MrtKzP7t90Vf7vypd3OL1U=", + "rev": "0f9255e01c2351cc7d116c072cb317785dd33b33", + "revCount": 57, + "type": "tarball", + "url": "https://api.flakehub.com/f/pinned/edolstra/flake-compat/1.0.1/018afb31-abd1-7bff-a5e4-cff7e18efb7a/source.tar.gz" + }, + "original": { + "type": "tarball", + "url": "https://flakehub.com/f/edolstra/flake-compat/1.tar.gz" + } + }, + "flake-compat_5": { "flake": false, "locked": { "lastModified": 1696426674, @@ -342,6 +356,24 @@ "type": "github" } }, + "flake-utils_2": { + "inputs": { + "systems": "systems_4" + }, + "locked": { + "lastModified": 1710146030, + "narHash": "sha256-SZ5L6eA7HJ/nmkzGG7/ISclqe6oZdOZTNoesiInkXPQ=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "b1d9ab70662946ef0850d488da1c9019f3a9752a", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + }, "gen-nvim": { "flake": false, "locked": { @@ -416,6 +448,36 @@ "type": "github" } }, + "git-hooks_2": { + "inputs": { + "flake-compat": [ + "nixvim", + "flake-compat" + ], + "gitignore": "gitignore_2", + "nixpkgs": [ + "nixvim", + "nixpkgs" + ], + "nixpkgs-stable": [ + "nixvim", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1724857454, + "narHash": "sha256-Qyl9Q4QMTLZnnBb/8OuQ9LSkzWjBU1T5l5zIzTxkkhk=", + "owner": "cachix", + "repo": "git-hooks.nix", + "rev": "4509ca64f1084e73bc7a721b20c669a8d4c5ebe6", + "type": "github" + }, + "original": { + "owner": "cachix", + "repo": "git-hooks.nix", + "type": "github" + } + }, "gitignore": { "inputs": { "nixpkgs": [ @@ -439,6 +501,28 @@ } }, "gitignore_2": { + "inputs": { + "nixpkgs": [ + "nixvim", + "git-hooks", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1709087332, + "narHash": "sha256-HG2cCnktfHsKV0s4XW83gU3F57gaTljL9KNSuG6bnQs=", + "owner": "hercules-ci", + "repo": "gitignore.nix", + "rev": "637db329424fd7e46cf4185293b9cc8c88c95394", + "type": "github" + }, + "original": { + "owner": "hercules-ci", + "repo": "gitignore.nix", + "type": "github" + } + }, + "gitignore_3": { "inputs": { "nixpkgs": [ "pre-commit-hooks", @@ -843,6 +927,27 @@ "type": "github" } }, + "nix-darwin": { + "inputs": { + "nixpkgs": [ + "nixvim", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1724561770, + "narHash": "sha256-zv8C9RNa86CIpyHwPIVO/k+5TfM8ZbjGwOOpTe1grls=", + "owner": "lnl7", + "repo": "nix-darwin", + "rev": "ac5694a0b855a981e81b4d9f14052e3ff46ca39e", + "type": "github" + }, + "original": { + "owner": "lnl7", + "repo": "nix-darwin", + "type": "github" + } + }, "nix-index-database": { "inputs": { "nixpkgs": [ @@ -998,6 +1103,22 @@ "type": "github" } }, + "nixpkgs_10": { + "locked": { + "lastModified": 1692934111, + "narHash": "sha256-9EEE59v/esKNMR5zKbLRV9NoRPYvERw5jHQOnfr47bk=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "1e44a037bbf4fcaba041436e65e87be88f3f495b", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixpkgs-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, "nixpkgs_2": { "locked": { "lastModified": 1723603349, @@ -1095,6 +1216,22 @@ } }, "nixpkgs_8": { + "locked": { + "lastModified": 1724819573, + "narHash": "sha256-GnR7/ibgIH1vhoy8cYdmXE6iyZqKqFxQSVkFgosBh6w=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "71e91c409d1e654808b2621f28a327acfdad8dc2", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixos-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "nixpkgs_9": { "locked": { "lastModified": 1719082008, "narHash": "sha256-jHJSUH619zBQ6WdC21fFAlDxHErKVDJ5fpN0Hgx4sjs=", @@ -1110,19 +1247,35 @@ "type": "github" } }, - "nixpkgs_9": { + "nixvim": { + "inputs": { + "devshell": [ + "devshell" + ], + "flake-compat": "flake-compat_4", + "flake-parts": [ + "flake-parts" + ], + "git-hooks": "git-hooks_2", + "home-manager": [ + "home-manager" + ], + "nix-darwin": "nix-darwin", + "nixpkgs": "nixpkgs_8", + "nuschtosSearch": "nuschtosSearch", + "treefmt-nix": "treefmt-nix" + }, "locked": { - "lastModified": 1692934111, - "narHash": "sha256-9EEE59v/esKNMR5zKbLRV9NoRPYvERw5jHQOnfr47bk=", - "owner": "NixOS", - "repo": "nixpkgs", - "rev": "1e44a037bbf4fcaba041436e65e87be88f3f495b", + "lastModified": 1724968633, + "narHash": "sha256-eb2NCdLwfXL1MuTAkoDncSl2lCJwyylV5/NM1Ws2P/U=", + "owner": "nix-community", + "repo": "nixvim", + "rev": "2704133fe3ca616b22ed6685cc67180456eb4160", "type": "github" }, "original": { - "owner": "NixOS", - "ref": "nixpkgs-unstable", - "repo": "nixpkgs", + "owner": "nix-community", + "repo": "nixvim", "type": "github" } }, @@ -1157,6 +1310,28 @@ "type": "github" } }, + "nuschtosSearch": { + "inputs": { + "flake-utils": "flake-utils_2", + "nixpkgs": [ + "nixvim", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1724584782, + "narHash": "sha256-7FfHv7b1jwMPSu9SPY9hdxStk8E6EeSwzqdvV69U4BM=", + "owner": "NuschtOS", + "repo": "search", + "rev": "5a08d691de30b6fc28d58ce71a5e420f2694e087", + "type": "github" + }, + "original": { + "owner": "NuschtOS", + "repo": "search", + "type": "github" + } + }, "nvim-lspconfig": { "flake": false, "locked": { @@ -1175,9 +1350,9 @@ }, "pre-commit-hooks": { "inputs": { - "flake-compat": "flake-compat_4", - "gitignore": "gitignore_2", - "nixpkgs": "nixpkgs_8", + "flake-compat": "flake-compat_5", + "gitignore": "gitignore_3", + "nixpkgs": "nixpkgs_9", "nixpkgs-stable": "nixpkgs-stable" }, "locked": { @@ -1237,6 +1412,7 @@ "nix-monitored": "nix-monitored", "nix-super": "nix-super", "nixpkgs": "nixpkgs_7", + "nixvim": "nixvim", "none-ls-shellcheck-nvim": "none-ls-shellcheck-nvim", "nur": "nur", "nvim-lspconfig": "nvim-lspconfig", @@ -1340,6 +1516,21 @@ "type": "github" } }, + "systems_5": { + "locked": { + "lastModified": 1681028828, + "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", + "owner": "nix-systems", + "repo": "default", + "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", + "type": "github" + }, + "original": { + "owner": "nix-systems", + "repo": "default", + "type": "github" + } + }, "telekasten-nvim": { "flake": false, "locked": { @@ -1359,7 +1550,7 @@ "timers": { "inputs": { "naersk": "naersk", - "nixpkgs": "nixpkgs_9", + "nixpkgs": "nixpkgs_10", "utils": "utils" }, "locked": { @@ -1376,9 +1567,30 @@ "url": "https://gitea.moritzboeh.me/moritz/timers.git" } }, + "treefmt-nix": { + "inputs": { + "nixpkgs": [ + "nixvim", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1724833132, + "narHash": "sha256-F4djBvyNRAXGusJiNYInqR6zIMI3rvlp6WiKwsRISos=", + "owner": "numtide", + "repo": "treefmt-nix", + "rev": "3ffd842a5f50f435d3e603312eefa4790db46af5", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "treefmt-nix", + "type": "github" + } + }, "utils": { "inputs": { - "systems": "systems_4" + "systems": "systems_5" }, "locked": { "lastModified": 1692799911, diff --git a/flake.nix b/flake.nix index 9a5bdc5..132bec5 100644 --- a/flake.nix +++ b/flake.nix @@ -48,6 +48,11 @@ cmp-vimtex.flake = false; cmp-vimtex.url = "github:micangl/cmp-vimtex"; + nixvim.url = "github:nix-community/nixvim"; + nixvim.inputs.devshell.follows = "devshell"; + nixvim.inputs.flake-parts.follows = "flake-parts"; + nixvim.inputs.home-manager.follows = "home-manager"; + # river river.url = "git+https://github.com/riverwm/river?submodules=1"; river.flake = false; @@ -116,6 +121,7 @@ packages = with pkgs; [ stylua sumneko-lua-language-server + nixpkgs-fmt ]; }; @@ -153,7 +159,10 @@ useGlobalPkgs = true; useUserPackages = true; extraSpecialArgs = { inherit inputs self; }; - sharedModules = [ inputs.nix-lazy-nvim.homeManagerModules.default ]; + sharedModules = [ + inputs.nix-lazy-nvim.homeManagerModules.default + inputs.nixvim.homeManagerModules.nixvim + ]; }; } inputs.agenix.nixosModules.age diff --git a/modules/programs/nvim/default.nix b/modules/programs/nvim/default.nix index 8efae0a..f358ba5 100644 --- a/modules/programs/nvim/default.nix +++ b/modules/programs/nvim/default.nix @@ -21,36 +21,290 @@ in xdotool # for vimtex ]; - programs.neovim = { + # programs.neovim = { + # enable = true; + # package = inputs.neovim-nightly-overlay.packages.${pkgs.system}.default; + # vimAlias = true; + # vimdiffAlias = true; + # withNodeJs = true; + # withPython3 = true; + # extraPackages = with pkgs; + # [ + # alejandra + # checkmake + # codespell + # deadnix + # dotenv-linter + # fish + # jq + # nil + # nixd + # nixpkgs-fmt + # nodePackages.bash-language-server + # python3Packages.python-lsp-server + # shellcheck + # shfmt + # stable.yamlfix + # statix + # taplo + # yamllint + # ]; + # extraLuaConfig = readFile ./options.lua; + # lazy.enable = true; + # }; + + programs.nixvim = { enable = true; package = inputs.neovim-nightly-overlay.packages.${pkgs.system}.default; vimAlias = true; - vimdiffAlias = true; - withNodeJs = true; - withPython3 = true; - extraPackages = with pkgs; - [ - alejandra - checkmake - codespell - deadnix - dotenv-linter - fish - jq - nil - nixd - nixpkgs-fmt - nodePackages.bash-language-server - python3Packages.python-lsp-server - shellcheck - shfmt - stable.yamlfix - statix - taplo - yamllint + + colorschemes.catppuccin.enable = true; + colorschemes.catppuccin.settings.flavour = "macchiato"; + + plugins.lualine.enable = true; + + plugins.cmp.autoEnableSources = true; + plugins.cmp.enable = true; + plugins.cmp.settings.sources = [ + { priority = 1; name = "async_path"; } + { priority = 1; name = "buffer"; } + { priority = 2; name = "nvim_lsp"; } + { priority = 3; name = "nvim_lsp_signature_help"; } + { priority = 4; name = "luasnip"; } + { priority = 4; name = "vimtex"; } + ]; + plugins.cmp.settings.mapping = { + __raw = '' + cmp.mapping.preset.insert({ + [''] = cmp.mapping.scroll_docs(-4), + [''] = cmp.mapping.scroll_docs(4), + [''] = cmp.mapping.complete(), + [''] = cmp.mapping.abort(), + [''] = cmp.mapping.confirm({ select = true }), + [""] = cmp.mapping(function(fallback) + if cmp.visible() then + cmp.select_next_item({ behavior = cmp.SelectBehavior.Select }) + elseif require("luasnip").locally_jumpable(1) then + require("luasnip").jump(1) + else + fallback() + end + end, { "i", "s" }), + [""] = cmp.mapping(function(fallback) + if cmp.visible() then + cmp.select_prev_item({ behavior = cmp.SelectBehavior.Select }) + elseif require("luasnip").locally_jumpable(-1) then + require("luasnip").jump(-1) + else + fallback() + end + end, { "i", "s" }), + [""] = cmp.mapping(function(fallback) + if require("luasnip").choice_active() then + require("luasnip").change_choice(1) + elseif require("luasnip").locally_jumpable(1) then + require("luasnip").jump(1) + else + fallback() + end + end, { "i", "s" }), + [""] = cmp.mapping(function(fallback) + if require("luasnip").choice_active() then + require("luasnip").change_choice(-1) + elseif require("luasnip").locally_jumpable(-1) then + require("luasnip").jump(-1) + else + fallback() + end + end, { "i", "s" }), + }) + ''; + }; + + plugins.luasnip.enable = true; + plugins.luasnip.settings = { + history = true; + update_events = "TextChanged,TextChangedI"; + delete_check_events = "TextChanged"; + ext_opts.__raw = ''{ + [require("luasnip.util.types").choiceNode] = { + active = { + virt_text = { { "<--", "Error" } }, + }, + }, + }''; + ft_func.__raw = ''require("luasnip.extras.filetype_functions").from_pos_or_filetype''; + }; + + plugins.lsp.enable = true; + plugins.lsp.inlayHints = true; + plugins.lsp.servers.nil-ls.enable = true; + plugins.lsp.servers.nixd.enable = true; + plugins.lsp.servers.nixd.extraOptions.settings.nixd = { + nixpkgs = { + expr = "import { }"; + }; + options = { + nixos = { + expr = ''(builtins.getFlake ("git+file://" + toString ./.)).nixosConfigurations.nixos-desktop.options''; + }; + "flake-parts" = { + expr = ''(builtins.getFlake ("git+file://" + toString ./.)).debug.options''; + }; + "flake-parts2" = { + expr = ''(builtins.getFlake ("git+file://" + toString ./.)).currentSystem.options''; + }; + }; + }; + plugins.lspsaga = { + enable = true; + codeAction.keys.quit = ""; + lightbulb.virtualText = false; + }; + keymapsOnEvents = { + LspAttach = [ + { + key = "cc"; + action = "Lspsaga code_action"; + options.desc = "Code Action"; + options.buffer = true; + } + { + key = "gd"; + action = "Lspsaga goto_definition"; + options.desc = "Goto Definition"; + options.buffer = true; + } + { + key = "cr"; + action = "Lspsaga rename"; + options.desc = "Rename"; + options.buffer = true; + } + { + key = "K"; + action = "Lspsaga hover_doc"; + options.desc = "Hover"; + options.buffer = true; + } ]; - extraLuaConfig = readFile ./options.lua; - lazy.enable = true; + }; + + plugins.nvim-ufo.enable = true; + + plugins.treesitter = { + enable = true; + folding = true; + nixvimInjections = true; + settings.indent.enable = true; + settings.highlight.enable = true; + }; + + plugins.which-key.enable = true; + plugins.lastplace.enable = true; + plugins.comment.enable = true; + plugins.ts-context-commentstring.enable = true; + + plugins.vimtex = { + enable = true; + settings.view_method = "zathura"; + }; + + plugins.todo-comments.enable = true; + plugins.todo-comments.keymaps.todoTelescope.key = "fc"; + + plugins.conform-nvim.enable = true; + plugins.conform-nvim.settings.formatters_by_ft = { + "*" = [ "codespell" "trim_whitespace" ]; + elixir = [ "mix" ]; + gleam = [ "gleam" ]; + go = [ "gofmt" ]; + json = [ "jq" ]; + lua = [ "stylua" ]; + nix = [ [ "nixpkgs_fmt" "alejandra" ] ]; + python = [ [ "ruff_fix" "isort" ] [ "ruff_format" "black" ] ]; + rust = [ "rustfmt" ]; + sh = [ "shfmt" ]; + tex = [ "latexindent" ]; + toml = [ "taplo" ]; + yaml = [ "yamlfix" ]; + }; + + keymaps = [ + { key = ""; action = "noh"; options.desc = "Escape and clear hlsearch"; mode = [ "i" "n" ]; } + ]; + opts.formatexpr = "v:lua.require'conform'.formatexpr()"; + + extraConfigLua = '' + vim.api.nvim_create_user_command("Format", function(opts) + require("conform").format({ formatters = opts.fargs }) + end, { + nargs = "+", + complete = function() + local names = formatters_by_ft[vim.bo.filetype] or formatters_by_ft["_"] or {} + names = vim.list_extend(names, formatters_by_ft["*"] or {}) + names = vim.tbl_flatten(names) + local formatters = vim.tbl_map(require("conform").get_formatter_info, names) + formatters = vim.tbl_filter(function(formatter) + return formatter.available + end, formatters) + return vim.tbl_map(function(formatter_info) + return formatter_info.name + end, formatters) + end, + }) + ''; + + plugins.oil.enable = true; + + plugins.telescope.enable = true; + plugins.telescope.extensions.fzf-native.enable = true; + plugins.telescope.keymaps = { + "ff" = { + action = "find_files"; + options.desc = "Find files"; + }; + "fb" = { + action = "buffers"; + options.desc = "Find buffers"; + }; + "fl" = { + action = "current_buffer_fuzzy_find"; + options.desc = "Search lines"; + }; + "fg" = { + action = "live_grep"; + options.desc = "Live grep"; + }; + "fh" = { + action = "help_tags"; + options.desc = "Help tags"; + }; + "fr" = { + action = "oldfiles"; + options.desc = "Recent files"; + }; + }; + + plugins.nvim-autopairs.enable = true; + + plugins.surround.enable = true; + + extraConfigLuaPre = readFile ./options.lua; + performance = { + byteCompileLua = { + enable = true; + configs = true; + initLua = true; + nvimRuntime = true; + plugins = true; + }; + combinePlugins.enable = true; + combinePlugins.standalonePlugins = [ + "nvim-treesitter" + "conform.nvim" + ]; + }; }; }; }; diff --git a/modules/programs/nvim/options.lua b/modules/programs/nvim/options.lua index bc776d8..a6dc719 100644 --- a/modules/programs/nvim/options.lua +++ b/modules/programs/nvim/options.lua @@ -23,6 +23,7 @@ vim.opt.termguicolors = true vim.opt.undofile = true vim.opt.undolevels = 10000 vim.opt.updatetime = 300 +vim.opt.foldlevel = 2 vim.opt_local.spell = true vim.opt_local.spelllang = { "en", "de_20" } -- all English regions and new German spelling From 44bcf963b269f88b97cfa6a9a674e01a8c7d409e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Moritz=20B=C3=B6hme?= Date: Sun, 1 Sep 2024 22:05:20 +0200 Subject: [PATCH 2/9] feat: add more plugins --- modules/programs/nvim/default.nix | 554 +++++++++++++++++------------- modules/programs/nvim/options.lua | 2 +- 2 files changed, 307 insertions(+), 249 deletions(-) diff --git a/modules/programs/nvim/default.nix b/modules/programs/nvim/default.nix index f358ba5..208c58b 100644 --- a/modules/programs/nvim/default.nix +++ b/modules/programs/nvim/default.nix @@ -22,12 +22,6 @@ in ]; # programs.neovim = { - # enable = true; - # package = inputs.neovim-nightly-overlay.packages.${pkgs.system}.default; - # vimAlias = true; - # vimdiffAlias = true; - # withNodeJs = true; - # withPython3 = true; # extraPackages = with pkgs; # [ # alejandra @@ -49,263 +43,327 @@ in # taplo # yamllint # ]; - # extraLuaConfig = readFile ./options.lua; - # lazy.enable = true; # }; - programs.nixvim = { - enable = true; - package = inputs.neovim-nightly-overlay.packages.${pkgs.system}.default; - vimAlias = true; - - colorschemes.catppuccin.enable = true; - colorschemes.catppuccin.settings.flavour = "macchiato"; - - plugins.lualine.enable = true; - - plugins.cmp.autoEnableSources = true; - plugins.cmp.enable = true; - plugins.cmp.settings.sources = [ - { priority = 1; name = "async_path"; } - { priority = 1; name = "buffer"; } - { priority = 2; name = "nvim_lsp"; } - { priority = 3; name = "nvim_lsp_signature_help"; } - { priority = 4; name = "luasnip"; } - { priority = 4; name = "vimtex"; } - ]; - plugins.cmp.settings.mapping = { - __raw = '' - cmp.mapping.preset.insert({ - [''] = cmp.mapping.scroll_docs(-4), - [''] = cmp.mapping.scroll_docs(4), - [''] = cmp.mapping.complete(), - [''] = cmp.mapping.abort(), - [''] = cmp.mapping.confirm({ select = true }), - [""] = cmp.mapping(function(fallback) - if cmp.visible() then - cmp.select_next_item({ behavior = cmp.SelectBehavior.Select }) - elseif require("luasnip").locally_jumpable(1) then - require("luasnip").jump(1) - else - fallback() - end - end, { "i", "s" }), - [""] = cmp.mapping(function(fallback) - if cmp.visible() then - cmp.select_prev_item({ behavior = cmp.SelectBehavior.Select }) - elseif require("luasnip").locally_jumpable(-1) then - require("luasnip").jump(-1) - else - fallback() - end - end, { "i", "s" }), - [""] = cmp.mapping(function(fallback) - if require("luasnip").choice_active() then - require("luasnip").change_choice(1) - elseif require("luasnip").locally_jumpable(1) then - require("luasnip").jump(1) - else - fallback() - end - end, { "i", "s" }), - [""] = cmp.mapping(function(fallback) - if require("luasnip").choice_active() then - require("luasnip").change_choice(-1) - elseif require("luasnip").locally_jumpable(-1) then - require("luasnip").jump(-1) - else - fallback() - end - end, { "i", "s" }), - }) - ''; - }; - - plugins.luasnip.enable = true; - plugins.luasnip.settings = { - history = true; - update_events = "TextChanged,TextChangedI"; - delete_check_events = "TextChanged"; - ext_opts.__raw = ''{ + programs.nixvim = lib.mkMerge [ + { + enable = true; + package = inputs.neovim-nightly-overlay.packages.${pkgs.system}.default; + vimAlias = true; + extraConfigLuaPre = readFile ./options.lua; + performance = { + byteCompileLua = { + enable = true; + configs = true; + initLua = true; + nvimRuntime = true; + plugins = true; + }; + combinePlugins.enable = true; + }; + } + { + colorschemes.catppuccin = { + enable = true; + settings.flavour = "macchiato"; + }; + } + { + plugins.lualine.enable = true; + } + { + plugins.cmp = { + autoEnableSources = true; + enable = true; + settings.sources = [ + { priority = 1; name = "async_path"; } + { priority = 1; name = "buffer"; } + { priority = 2; name = "nvim_lsp"; } + { priority = 3; name = "nvim_lsp_signature_help"; } + { priority = 4; name = "luasnip"; } + { priority = 4; name = "vimtex"; } + ]; + settings.mapping = { + __raw = '' + cmp.mapping.preset.insert({ + [''] = cmp.mapping.scroll_docs(-4), + [''] = cmp.mapping.scroll_docs(4), + [''] = cmp.mapping.complete(), + [''] = cmp.mapping.abort(), + [''] = cmp.mapping.confirm({ select = true }), + [""] = cmp.mapping(function(fallback) + if cmp.visible() then + cmp.select_next_item({ behavior = cmp.SelectBehavior.Select }) + elseif require("luasnip").locally_jumpable(1) then + require("luasnip").jump(1) + else + fallback() + end + end, { "i", "s" }), + [""] = cmp.mapping(function(fallback) + if cmp.visible() then + cmp.select_prev_item({ behavior = cmp.SelectBehavior.Select }) + elseif require("luasnip").locally_jumpable(-1) then + require("luasnip").jump(-1) + else + fallback() + end + end, { "i", "s" }), + [""] = cmp.mapping(function(fallback) + if require("luasnip").choice_active() then + require("luasnip").change_choice(1) + elseif require("luasnip").locally_jumpable(1) then + require("luasnip").jump(1) + else + fallback() + end + end, { "i", "s" }), + [""] = cmp.mapping(function(fallback) + if require("luasnip").choice_active() then + require("luasnip").change_choice(-1) + elseif require("luasnip").locally_jumpable(-1) then + require("luasnip").jump(-1) + else + fallback() + end + end, { "i", "s" }), + }) + ''; + }; + }; + } + { + plugins.luasnip = { + enable = true; + settings = { + history = true; + update_events = "TextChanged,TextChangedI"; + delete_check_events = "TextChanged"; + ext_opts.__raw = ''{ [require("luasnip.util.types").choiceNode] = { active = { virt_text = { { "<--", "Error" } }, }, }, }''; - ft_func.__raw = ''require("luasnip.extras.filetype_functions").from_pos_or_filetype''; - }; - - plugins.lsp.enable = true; - plugins.lsp.inlayHints = true; - plugins.lsp.servers.nil-ls.enable = true; - plugins.lsp.servers.nixd.enable = true; - plugins.lsp.servers.nixd.extraOptions.settings.nixd = { - nixpkgs = { - expr = "import { }"; - }; - options = { - nixos = { - expr = ''(builtins.getFlake ("git+file://" + toString ./.)).nixosConfigurations.nixos-desktop.options''; - }; - "flake-parts" = { - expr = ''(builtins.getFlake ("git+file://" + toString ./.)).debug.options''; - }; - "flake-parts2" = { - expr = ''(builtins.getFlake ("git+file://" + toString ./.)).currentSystem.options''; + ft_func.__raw = ''require("luasnip.extras.filetype_functions").from_pos_or_filetype''; }; }; - }; - plugins.lspsaga = { - enable = true; - codeAction.keys.quit = ""; - lightbulb.virtualText = false; - }; - keymapsOnEvents = { - LspAttach = [ - { - key = "cc"; - action = "Lspsaga code_action"; - options.desc = "Code Action"; - options.buffer = true; - } - { - key = "gd"; - action = "Lspsaga goto_definition"; - options.desc = "Goto Definition"; - options.buffer = true; - } - { - key = "cr"; - action = "Lspsaga rename"; - options.desc = "Rename"; - options.buffer = true; - } - { - key = "K"; - action = "Lspsaga hover_doc"; - options.desc = "Hover"; - options.buffer = true; - } - ]; - }; - - plugins.nvim-ufo.enable = true; - - plugins.treesitter = { - enable = true; - folding = true; - nixvimInjections = true; - settings.indent.enable = true; - settings.highlight.enable = true; - }; - - plugins.which-key.enable = true; - plugins.lastplace.enable = true; - plugins.comment.enable = true; - plugins.ts-context-commentstring.enable = true; - - plugins.vimtex = { - enable = true; - settings.view_method = "zathura"; - }; - - plugins.todo-comments.enable = true; - plugins.todo-comments.keymaps.todoTelescope.key = "fc"; - - plugins.conform-nvim.enable = true; - plugins.conform-nvim.settings.formatters_by_ft = { - "*" = [ "codespell" "trim_whitespace" ]; - elixir = [ "mix" ]; - gleam = [ "gleam" ]; - go = [ "gofmt" ]; - json = [ "jq" ]; - lua = [ "stylua" ]; - nix = [ [ "nixpkgs_fmt" "alejandra" ] ]; - python = [ [ "ruff_fix" "isort" ] [ "ruff_format" "black" ] ]; - rust = [ "rustfmt" ]; - sh = [ "shfmt" ]; - tex = [ "latexindent" ]; - toml = [ "taplo" ]; - yaml = [ "yamlfix" ]; - }; - - keymaps = [ - { key = ""; action = "noh"; options.desc = "Escape and clear hlsearch"; mode = [ "i" "n" ]; } - ]; - opts.formatexpr = "v:lua.require'conform'.formatexpr()"; - - extraConfigLua = '' - vim.api.nvim_create_user_command("Format", function(opts) - require("conform").format({ formatters = opts.fargs }) - end, { - nargs = "+", - complete = function() - local names = formatters_by_ft[vim.bo.filetype] or formatters_by_ft["_"] or {} - names = vim.list_extend(names, formatters_by_ft["*"] or {}) - names = vim.tbl_flatten(names) - local formatters = vim.tbl_map(require("conform").get_formatter_info, names) - formatters = vim.tbl_filter(function(formatter) - return formatter.available - end, formatters) - return vim.tbl_map(function(formatter_info) - return formatter_info.name - end, formatters) - end, - }) - ''; - - plugins.oil.enable = true; - - plugins.telescope.enable = true; - plugins.telescope.extensions.fzf-native.enable = true; - plugins.telescope.keymaps = { - "ff" = { - action = "find_files"; - options.desc = "Find files"; - }; - "fb" = { - action = "buffers"; - options.desc = "Find buffers"; - }; - "fl" = { - action = "current_buffer_fuzzy_find"; - options.desc = "Search lines"; - }; - "fg" = { - action = "live_grep"; - options.desc = "Live grep"; - }; - "fh" = { - action = "help_tags"; - options.desc = "Help tags"; - }; - "fr" = { - action = "oldfiles"; - options.desc = "Recent files"; - }; - }; - - plugins.nvim-autopairs.enable = true; - - plugins.surround.enable = true; - - extraConfigLuaPre = readFile ./options.lua; - performance = { - byteCompileLua = { + } + { + plugins.lsp = { enable = true; - configs = true; - initLua = true; - nvimRuntime = true; - plugins = true; + inlayHints = true; + servers.nil-ls.enable = true; + servers.nixd.enable = true; + servers.nixd.extraOptions.settings.nixd = { + nixpkgs = { + expr = "import { }"; + }; + options = { + nixos = { + expr = ''(builtins.getFlake ("git+file://" + toString ./.)).nixosConfigurations.nixos-desktop.options''; + }; + "flake-parts" = { + expr = ''(builtins.getFlake ("git+file://" + toString ./.)).debug.options''; + }; + "flake-parts2" = { + expr = ''(builtins.getFlake ("git+file://" + toString ./.)).currentSystem.options''; + }; + }; + }; }; - combinePlugins.enable = true; - combinePlugins.standalonePlugins = [ + } + { + plugins.lspsaga = { + enable = true; + codeAction.keys.quit = ""; + lightbulb.virtualText = false; + }; + keymapsOnEvents = { + LspAttach = [ + { + key = "cc"; + action = "Lspsaga code_action"; + options.desc = "Code Action"; + options.buffer = true; + } + { + key = "gd"; + action = "Lspsaga goto_definition"; + options.desc = "Goto Definition"; + options.buffer = true; + } + { + key = "cr"; + action = "Lspsaga rename"; + options.desc = "Rename"; + options.buffer = true; + } + { + key = "K"; + action = "Lspsaga hover_doc"; + options.desc = "Hover"; + options.buffer = true; + } + ]; + }; + } + { + plugins.nvim-ufo.enable = true; + } + { + plugins.treesitter = { + enable = true; + folding = true; + nixvimInjections = true; + settings.indent.enable = true; + settings.highlight.enable = true; + }; + performance.combinePlugins.standalonePlugins = [ "nvim-treesitter" + ]; + } + { plugins.which-key.enable = true; } + { plugins.lastplace.enable = true; } + { plugins.comment.enable = true; } + { plugins.ts-context-commentstring.enable = true; } + { + plugins.vimtex = { + enable = true; + settings.view_method = "zathura"; + }; + } + { + plugins.todo-comments = { + enable = true; + keymaps.todoTelescope.key = "fc"; + }; + } + { + plugins.conform-nvim = { + enable = true; + settings.formatters_by_ft = { + "*" = [ "codespell" "trim_whitespace" ]; + elixir = [ "mix" ]; + gleam = [ "gleam" ]; + go = [ "gofmt" ]; + json = [ "jq" ]; + lua = [ "stylua" ]; + nix.__raw = ''{ "nixpkgs_fmt", "alejandra", stop_after_first=true }''; + python.__raw = '' + function(bufnr) + return { first("ruff_organize_imports", "isort"), first("ruff_format", "black")} + end + ''; + rust = [ "rustfmt" ]; + sh = [ "shfmt" ]; + tex = [ "latexindent" ]; + toml = [ "taplo" ]; + yaml = [ "yamlfix" ]; + }; + }; + opts.formatexpr = "v:lua.require'conform'.formatexpr()"; + extraConfigLuaPre = '' + ---@param bufnr integer + ---@param ... string + ---@return string + local function first(bufnr, ...) + local conform = require("conform") + for i = 1, select("#", ...) do + local formatter = select(i, ...) + if conform.get_formatter_info(formatter, bufnr).available then + return formatter + end + end + return select(1, ...) + end + + vim.api.nvim_create_user_command("Format", function(opts) + require("conform").format({ formatters = opts.fargs }) + end, { + nargs = "+", + complete = function() + local formatters_by_ft = require("conform").formatters_by_ft + local names = formatters_by_ft[vim.bo.filetype] or formatters_by_ft["_"] or {} + names = vim.list_extend(names, formatters_by_ft["*"] or {}) + names = vim.tbl_flatten(names) + local formatters = vim.tbl_map(require("conform").get_formatter_info, names) + formatters = vim.tbl_filter(function(formatter) + return formatter.available + end, formatters) + return vim.tbl_map(function(formatter_info) + return formatter_info.name + end, formatters) + end, + }) + ''; + performance.combinePlugins.standalonePlugins = [ "conform.nvim" ]; - }; - }; + keymaps = [ + { key = "cf"; action.__raw = ''function() require("conform").format() end''; options.desc = "Format current file"; } + ]; + } + { + keymaps = [ + { key = ""; action = "noh"; options.desc = "Escape and clear hlsearch"; mode = [ "i" "n" ]; } + ]; + } + { plugins.oil.enable = true; } + { + plugins.telescope = { + enable = true; + extensions.fzf-native.enable = true; + keymaps = { + "ff" = { + action = "find_files"; + options.desc = "Find files"; + }; + "fb" = { + action = "buffers"; + options.desc = "Find buffers"; + }; + "fl" = { + action = "current_buffer_fuzzy_find"; + options.desc = "Search lines"; + }; + "fg" = { + action = "live_grep"; + options.desc = "Live grep"; + }; + "fh" = { + action = "help_tags"; + options.desc = "Help tags"; + }; + "fr" = { + action = "oldfiles"; + options.desc = "Recent files"; + }; + }; + }; + } + { plugins.nvim-autopairs.enable = true; } + { plugins.surround.enable = true; } + { + plugins.lint.enable = true; + # TODO: add linters + plugins.lint.lintersByFt = { }; + } + { + plugins.marks.enable = true; + plugins.marks.defaultMappings = false; + } + { + plugins.hmts.enable = true; + performance.combinePlugins.standalonePlugins = [ "hmts.nvim" ]; + } + { plugins.gitsigns.enable = true; } + { plugins.fugitive.enable = true; } + { plugins.friendly-snippets.enable = true; } + { plugins.direnv.enable = true; } + { plugins.crates-nvim.enable = true; } + ]; }; }; } diff --git a/modules/programs/nvim/options.lua b/modules/programs/nvim/options.lua index a6dc719..9ae480b 100644 --- a/modules/programs/nvim/options.lua +++ b/modules/programs/nvim/options.lua @@ -23,7 +23,7 @@ vim.opt.termguicolors = true vim.opt.undofile = true vim.opt.undolevels = 10000 vim.opt.updatetime = 300 -vim.opt.foldlevel = 2 +vim.opt.foldlevel = 99 vim.opt_local.spell = true vim.opt_local.spelllang = { "en", "de_20" } -- all English regions and new German spelling From 1aa171423751ae8c5909fcd419048c2bbe9e00d3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Moritz=20B=C3=B6hme?= Date: Sat, 14 Sep 2024 11:05:12 +0200 Subject: [PATCH 3/9] feat(nvim): add avante and split up plugins --- flake.lock | 171 +-------- flake.nix | 22 +- modules/programs/nvim/default.nix | 333 +----------------- .../programs/nvim/new_plugins/catppuccin.nix | 15 + modules/programs/nvim/new_plugins/cmp.nix | 68 ++++ modules/programs/nvim/new_plugins/lsp.nix | 31 ++ modules/programs/nvim/new_plugins/lspsaga.nix | 42 +++ modules/programs/nvim/new_plugins/lualine.nix | 10 + modules/programs/nvim/new_plugins/luasnip.nix | 27 ++ .../programs/nvim/new_plugins/nvim-ufo.nix | 10 + modules/programs/nvim/new_plugins/other.nix | 171 +++++++++ .../programs/nvim/new_plugins/treesitter.nix | 19 + 12 files changed, 419 insertions(+), 500 deletions(-) create mode 100644 modules/programs/nvim/new_plugins/catppuccin.nix create mode 100644 modules/programs/nvim/new_plugins/cmp.nix create mode 100644 modules/programs/nvim/new_plugins/lsp.nix create mode 100644 modules/programs/nvim/new_plugins/lspsaga.nix create mode 100644 modules/programs/nvim/new_plugins/lualine.nix create mode 100644 modules/programs/nvim/new_plugins/luasnip.nix create mode 100644 modules/programs/nvim/new_plugins/nvim-ufo.nix create mode 100644 modules/programs/nvim/new_plugins/other.nix create mode 100644 modules/programs/nvim/new_plugins/treesitter.nix diff --git a/flake.lock b/flake.lock index 3391298..b4c1870 100644 --- a/flake.lock +++ b/flake.lock @@ -1,21 +1,5 @@ { "nodes": { - "actions-preview-nvim": { - "flake": false, - "locked": { - "lastModified": 1718540350, - "narHash": "sha256-lYjsv8y1fMuTGpBF/iG7cm/a7tLdh748vJhVsSp/Iz8=", - "owner": "aznhe21", - "repo": "actions-preview.nvim", - "rev": "9f52a01c374318e91337697ebed51c6fae57f8a4", - "type": "github" - }, - "original": { - "owner": "aznhe21", - "repo": "actions-preview.nvim", - "type": "github" - } - }, "agenix": { "inputs": { "darwin": "darwin", @@ -105,19 +89,19 @@ "type": "github" } }, - "cmp-vimtex": { + "avante-nvim": { "flake": false, "locked": { - "lastModified": 1722941837, - "narHash": "sha256-pD2dPdpyn5A/uwonDdAxCX138yBeDqbXDdlG/IKjVTU=", - "owner": "micangl", - "repo": "cmp-vimtex", - "rev": "5283bf9108ef33d41e704027b9ef22437ce7a15b", + "lastModified": 1725237964, + "narHash": "sha256-3jwSkCHr5iaeEIjt2lz/SQl7gbrkFiJ0FjspX6Ufa88=", + "owner": "yetone", + "repo": "avante.nvim", + "rev": "d520f0933323ba982c9665d8e4fe91000ff14e99", "type": "github" }, "original": { - "owner": "micangl", - "repo": "cmp-vimtex", + "owner": "yetone", + "repo": "avante.nvim", "type": "github" } }, @@ -374,22 +358,6 @@ "type": "github" } }, - "gen-nvim": { - "flake": false, - "locked": { - "lastModified": 1723301200, - "narHash": "sha256-Yp7HrDMOyR929AfM7IjEz4dP3RhIx9kXZ1Z3zRr5yJg=", - "owner": "David-Kunz", - "repo": "gen.nvim", - "rev": "c9a73d8c0d462333da6d2191806ff98f2884d706", - "type": "github" - }, - "original": { - "owner": "David-Kunz", - "repo": "gen.nvim", - "type": "github" - } - }, "git-hooks": { "inputs": { "flake-compat": "flake-compat_2", @@ -543,22 +511,6 @@ "type": "github" } }, - "hawtkeys-nvim": { - "flake": false, - "locked": { - "lastModified": 1715069568, - "narHash": "sha256-oVpWh5pVU/OMnQ8ZRgW3iNG8I0xsLJnRBvt67yPWLQ0=", - "owner": "tris203", - "repo": "hawtkeys.nvim", - "rev": "261cc311d4abdc88decceca6dc1013faa14c56ea", - "type": "github" - }, - "original": { - "owner": "tris203", - "repo": "hawtkeys.nvim", - "type": "github" - } - }, "hercules-ci-effects": { "inputs": { "flake-parts": "flake-parts_3", @@ -871,23 +823,6 @@ "type": "github" } }, - "neotest-python": { - "flake": false, - "locked": { - "lastModified": 1698425037, - "narHash": "sha256-C3Dw+fl1QNYU9tg0fE52EzOqeGXxu1vq5SPmDnv2LD8=", - "owner": "MoritzBoehme", - "repo": "neotest-python", - "rev": "3c09dbafb0a1e3ac8b19eabc7157ec312cc2f2ee", - "type": "github" - }, - "original": { - "owner": "MoritzBoehme", - "ref": "fix-runtimepath-search", - "repo": "neotest-python", - "type": "github" - } - }, "neovim-nightly-overlay": { "inputs": { "flake-compat": "flake-compat", @@ -968,21 +903,6 @@ "type": "github" } }, - "nix-lazy-nvim": { - "locked": { - "lastModified": 1698421129, - "narHash": "sha256-pwpLc6SS3c4s6i2+MZa8y+JigFwAbFw69bwN8S1CYwQ=", - "ref": "refs/heads/main", - "rev": "408ab5cad386453e3cce8233b377fc95320e4637", - "revCount": 5, - "type": "git", - "url": "https://git.moritzboeh.me/moritz/NixLazy.nvim" - }, - "original": { - "type": "git", - "url": "https://git.moritzboeh.me/moritz/NixLazy.nvim" - } - }, "nix-monitored": { "inputs": { "nixpkgs": [ @@ -1279,22 +1199,6 @@ "type": "github" } }, - "none-ls-shellcheck-nvim": { - "flake": false, - "locked": { - "lastModified": 1710845791, - "narHash": "sha256-t06Nu7wVEGoJtaaZh/psvuC9kdYhwh6JeOd0cg3WVHY=", - "owner": "gbprod", - "repo": "none-ls-shellcheck.nvim", - "rev": "0f84461241e76e376a95fb7391deac82dc3efdbf", - "type": "github" - }, - "original": { - "owner": "gbprod", - "repo": "none-ls-shellcheck.nvim", - "type": "github" - } - }, "nur": { "locked": { "lastModified": 1723976478, @@ -1332,22 +1236,6 @@ "type": "github" } }, - "nvim-lspconfig": { - "flake": false, - "locked": { - "lastModified": 1723788573, - "narHash": "sha256-y64E6q6bB0kzJzxHnOYWjCZW5tpBTzhAVs/lvpmOpU0=", - "owner": "neovim", - "repo": "nvim-lspconfig", - "rev": "a89de2e049b5f89a0ee55029d5a31213bd4de6f8", - "type": "github" - }, - "original": { - "owner": "neovim", - "repo": "nvim-lspconfig", - "type": "github" - } - }, "pre-commit-hooks": { "inputs": { "flake-compat": "flake-compat_5", @@ -1389,57 +1277,32 @@ }, "root": { "inputs": { - "actions-preview-nvim": "actions-preview-nvim", "agenix": "agenix", "arkenfox-userjs": "arkenfox-userjs", "asus-touchpad-numpad-driver": "asus-touchpad-numpad-driver", - "cmp-vimtex": "cmp-vimtex", + "avante-nvim": "avante-nvim", "devshell": "devshell", "disko": "disko", "flake-parts": "flake-parts", "flake-utils": "flake-utils", - "gen-nvim": "gen-nvim", - "hawtkeys-nvim": "hawtkeys-nvim", "home-manager": "home-manager_2", "hypr-contrib": "hypr-contrib", "hyprland": "hyprland", "impermanence": "impermanence", "master": "master", - "neotest-python": "neotest-python", "neovim-nightly-overlay": "neovim-nightly-overlay", "nix-index-database": "nix-index-database", - "nix-lazy-nvim": "nix-lazy-nvim", "nix-monitored": "nix-monitored", "nix-super": "nix-super", "nixpkgs": "nixpkgs_7", "nixvim": "nixvim", - "none-ls-shellcheck-nvim": "none-ls-shellcheck-nvim", "nur": "nur", - "nvim-lspconfig": "nvim-lspconfig", "pre-commit-hooks": "pre-commit-hooks", "river": "river", - "smartcolumn-nvim": "smartcolumn-nvim", "stable": "stable", - "telekasten-nvim": "telekasten-nvim", "timers": "timers" } }, - "smartcolumn-nvim": { - "flake": false, - "locked": { - "lastModified": 1710067624, - "narHash": "sha256-DHIeDNUF9n9s14GVeojIwc5QUPwJMYYl3gRvhvO/rdE=", - "owner": "m4xshen", - "repo": "smartcolumn.nvim", - "rev": "cefb17be095ad5526030a21bb2a80553cae09127", - "type": "github" - }, - "original": { - "owner": "m4xshen", - "repo": "smartcolumn.nvim", - "type": "github" - } - }, "stable": { "locked": { "lastModified": 1723688146, @@ -1531,22 +1394,6 @@ "type": "github" } }, - "telekasten-nvim": { - "flake": false, - "locked": { - "lastModified": 1713773667, - "narHash": "sha256-RsxzOa9bQMKB6LRyo4Vc9hxIJGJ35NSBrLdEi2BSaBU=", - "owner": "renerocksai", - "repo": "telekasten.nvim", - "rev": "319276a7853ff996b7bb1ed4250d8047c84ad29d", - "type": "github" - }, - "original": { - "owner": "renerocksai", - "repo": "telekasten.nvim", - "type": "github" - } - }, "timers": { "inputs": { "naersk": "naersk", diff --git a/flake.nix b/flake.nix index 132bec5..23d2119 100644 --- a/flake.nix +++ b/flake.nix @@ -27,26 +27,9 @@ timers.url = "git+https://gitea.moritzboeh.me/moritz/timers.git"; # Neovim - actions-preview-nvim.flake = false; - actions-preview-nvim.url = "github:aznhe21/actions-preview.nvim"; neovim-nightly-overlay.url = "github:nix-community/neovim-nightly-overlay"; - nix-lazy-nvim.url = "git+https://git.moritzboeh.me/moritz/NixLazy.nvim"; - nvim-lspconfig.flake = false; - nvim-lspconfig.url = "github:neovim/nvim-lspconfig"; - smartcolumn-nvim.flake = false; - smartcolumn-nvim.url = "github:m4xshen/smartcolumn.nvim"; - telekasten-nvim.flake = false; - telekasten-nvim.url = "github:renerocksai/telekasten.nvim"; - neotest-python.flake = false; - neotest-python.url = "github:MoritzBoehme/neotest-python/fix-runtimepath-search"; - gen-nvim.flake = false; - gen-nvim.url = "github:David-Kunz/gen.nvim"; - hawtkeys-nvim.flake = false; - hawtkeys-nvim.url = "github:tris203/hawtkeys.nvim"; - none-ls-shellcheck-nvim.flake = false; - none-ls-shellcheck-nvim.url = "github:gbprod/none-ls-shellcheck.nvim"; - cmp-vimtex.flake = false; - cmp-vimtex.url = "github:micangl/cmp-vimtex"; + avante-nvim.flake = false; + avante-nvim.url = "github:yetone/avante.nvim"; nixvim.url = "github:nix-community/nixvim"; nixvim.inputs.devshell.follows = "devshell"; @@ -160,7 +143,6 @@ useUserPackages = true; extraSpecialArgs = { inherit inputs self; }; sharedModules = [ - inputs.nix-lazy-nvim.homeManagerModules.default inputs.nixvim.homeManagerModules.nixvim ]; }; diff --git a/modules/programs/nvim/default.nix b/modules/programs/nvim/default.nix index 208c58b..789809d 100644 --- a/modules/programs/nvim/default.nix +++ b/modules/programs/nvim/default.nix @@ -6,7 +6,7 @@ let cfg = config.my.programs.nvim; in { - imports = lib.my.listModulesRec ./plugins; + imports = lib.my.listModulesRec ./new_plugins; options.my.programs.nvim.enable = mkEnableOption "nvim"; @@ -45,325 +45,22 @@ in # ]; # }; - programs.nixvim = lib.mkMerge [ - { - enable = true; - package = inputs.neovim-nightly-overlay.packages.${pkgs.system}.default; - vimAlias = true; - extraConfigLuaPre = readFile ./options.lua; - performance = { - byteCompileLua = { - enable = true; - configs = true; - initLua = true; - nvimRuntime = true; - plugins = true; - }; - combinePlugins.enable = true; - }; - } - { - colorschemes.catppuccin = { + programs.nixvim = { + enable = true; + package = inputs.neovim-nightly-overlay.packages.${pkgs.system}.default; + vimAlias = true; + extraConfigLuaPre = readFile ./options.lua; + performance = { + byteCompileLua = { enable = true; - settings.flavour = "macchiato"; + configs = true; + initLua = true; + nvimRuntime = true; + plugins = true; }; - } - { - plugins.lualine.enable = true; - } - { - plugins.cmp = { - autoEnableSources = true; - enable = true; - settings.sources = [ - { priority = 1; name = "async_path"; } - { priority = 1; name = "buffer"; } - { priority = 2; name = "nvim_lsp"; } - { priority = 3; name = "nvim_lsp_signature_help"; } - { priority = 4; name = "luasnip"; } - { priority = 4; name = "vimtex"; } - ]; - settings.mapping = { - __raw = '' - cmp.mapping.preset.insert({ - [''] = cmp.mapping.scroll_docs(-4), - [''] = cmp.mapping.scroll_docs(4), - [''] = cmp.mapping.complete(), - [''] = cmp.mapping.abort(), - [''] = cmp.mapping.confirm({ select = true }), - [""] = cmp.mapping(function(fallback) - if cmp.visible() then - cmp.select_next_item({ behavior = cmp.SelectBehavior.Select }) - elseif require("luasnip").locally_jumpable(1) then - require("luasnip").jump(1) - else - fallback() - end - end, { "i", "s" }), - [""] = cmp.mapping(function(fallback) - if cmp.visible() then - cmp.select_prev_item({ behavior = cmp.SelectBehavior.Select }) - elseif require("luasnip").locally_jumpable(-1) then - require("luasnip").jump(-1) - else - fallback() - end - end, { "i", "s" }), - [""] = cmp.mapping(function(fallback) - if require("luasnip").choice_active() then - require("luasnip").change_choice(1) - elseif require("luasnip").locally_jumpable(1) then - require("luasnip").jump(1) - else - fallback() - end - end, { "i", "s" }), - [""] = cmp.mapping(function(fallback) - if require("luasnip").choice_active() then - require("luasnip").change_choice(-1) - elseif require("luasnip").locally_jumpable(-1) then - require("luasnip").jump(-1) - else - fallback() - end - end, { "i", "s" }), - }) - ''; - }; - }; - } - { - plugins.luasnip = { - enable = true; - settings = { - history = true; - update_events = "TextChanged,TextChangedI"; - delete_check_events = "TextChanged"; - ext_opts.__raw = ''{ - [require("luasnip.util.types").choiceNode] = { - active = { - virt_text = { { "<--", "Error" } }, - }, - }, - }''; - ft_func.__raw = ''require("luasnip.extras.filetype_functions").from_pos_or_filetype''; - }; - }; - } - { - plugins.lsp = { - enable = true; - inlayHints = true; - servers.nil-ls.enable = true; - servers.nixd.enable = true; - servers.nixd.extraOptions.settings.nixd = { - nixpkgs = { - expr = "import { }"; - }; - options = { - nixos = { - expr = ''(builtins.getFlake ("git+file://" + toString ./.)).nixosConfigurations.nixos-desktop.options''; - }; - "flake-parts" = { - expr = ''(builtins.getFlake ("git+file://" + toString ./.)).debug.options''; - }; - "flake-parts2" = { - expr = ''(builtins.getFlake ("git+file://" + toString ./.)).currentSystem.options''; - }; - }; - }; - }; - } - { - plugins.lspsaga = { - enable = true; - codeAction.keys.quit = ""; - lightbulb.virtualText = false; - }; - keymapsOnEvents = { - LspAttach = [ - { - key = "cc"; - action = "Lspsaga code_action"; - options.desc = "Code Action"; - options.buffer = true; - } - { - key = "gd"; - action = "Lspsaga goto_definition"; - options.desc = "Goto Definition"; - options.buffer = true; - } - { - key = "cr"; - action = "Lspsaga rename"; - options.desc = "Rename"; - options.buffer = true; - } - { - key = "K"; - action = "Lspsaga hover_doc"; - options.desc = "Hover"; - options.buffer = true; - } - ]; - }; - } - { - plugins.nvim-ufo.enable = true; - } - { - plugins.treesitter = { - enable = true; - folding = true; - nixvimInjections = true; - settings.indent.enable = true; - settings.highlight.enable = true; - }; - performance.combinePlugins.standalonePlugins = [ - "nvim-treesitter" - ]; - } - { plugins.which-key.enable = true; } - { plugins.lastplace.enable = true; } - { plugins.comment.enable = true; } - { plugins.ts-context-commentstring.enable = true; } - { - plugins.vimtex = { - enable = true; - settings.view_method = "zathura"; - }; - } - { - plugins.todo-comments = { - enable = true; - keymaps.todoTelescope.key = "fc"; - }; - } - { - plugins.conform-nvim = { - enable = true; - settings.formatters_by_ft = { - "*" = [ "codespell" "trim_whitespace" ]; - elixir = [ "mix" ]; - gleam = [ "gleam" ]; - go = [ "gofmt" ]; - json = [ "jq" ]; - lua = [ "stylua" ]; - nix.__raw = ''{ "nixpkgs_fmt", "alejandra", stop_after_first=true }''; - python.__raw = '' - function(bufnr) - return { first("ruff_organize_imports", "isort"), first("ruff_format", "black")} - end - ''; - rust = [ "rustfmt" ]; - sh = [ "shfmt" ]; - tex = [ "latexindent" ]; - toml = [ "taplo" ]; - yaml = [ "yamlfix" ]; - }; - }; - opts.formatexpr = "v:lua.require'conform'.formatexpr()"; - extraConfigLuaPre = '' - ---@param bufnr integer - ---@param ... string - ---@return string - local function first(bufnr, ...) - local conform = require("conform") - for i = 1, select("#", ...) do - local formatter = select(i, ...) - if conform.get_formatter_info(formatter, bufnr).available then - return formatter - end - end - return select(1, ...) - end - - vim.api.nvim_create_user_command("Format", function(opts) - require("conform").format({ formatters = opts.fargs }) - end, { - nargs = "+", - complete = function() - local formatters_by_ft = require("conform").formatters_by_ft - local names = formatters_by_ft[vim.bo.filetype] or formatters_by_ft["_"] or {} - names = vim.list_extend(names, formatters_by_ft["*"] or {}) - names = vim.tbl_flatten(names) - local formatters = vim.tbl_map(require("conform").get_formatter_info, names) - formatters = vim.tbl_filter(function(formatter) - return formatter.available - end, formatters) - return vim.tbl_map(function(formatter_info) - return formatter_info.name - end, formatters) - end, - }) - ''; - performance.combinePlugins.standalonePlugins = [ - "conform.nvim" - ]; - keymaps = [ - { key = "cf"; action.__raw = ''function() require("conform").format() end''; options.desc = "Format current file"; } - ]; - } - { - keymaps = [ - { key = ""; action = "noh"; options.desc = "Escape and clear hlsearch"; mode = [ "i" "n" ]; } - ]; - } - { plugins.oil.enable = true; } - { - plugins.telescope = { - enable = true; - extensions.fzf-native.enable = true; - keymaps = { - "ff" = { - action = "find_files"; - options.desc = "Find files"; - }; - "fb" = { - action = "buffers"; - options.desc = "Find buffers"; - }; - "fl" = { - action = "current_buffer_fuzzy_find"; - options.desc = "Search lines"; - }; - "fg" = { - action = "live_grep"; - options.desc = "Live grep"; - }; - "fh" = { - action = "help_tags"; - options.desc = "Help tags"; - }; - "fr" = { - action = "oldfiles"; - options.desc = "Recent files"; - }; - }; - }; - } - { plugins.nvim-autopairs.enable = true; } - { plugins.surround.enable = true; } - { - plugins.lint.enable = true; - # TODO: add linters - plugins.lint.lintersByFt = { }; - } - { - plugins.marks.enable = true; - plugins.marks.defaultMappings = false; - } - { - plugins.hmts.enable = true; - performance.combinePlugins.standalonePlugins = [ "hmts.nvim" ]; - } - { plugins.gitsigns.enable = true; } - { plugins.fugitive.enable = true; } - { plugins.friendly-snippets.enable = true; } - { plugins.direnv.enable = true; } - { plugins.crates-nvim.enable = true; } - ]; + combinePlugins.enable = true; + }; + }; }; }; } diff --git a/modules/programs/nvim/new_plugins/catppuccin.nix b/modules/programs/nvim/new_plugins/catppuccin.nix new file mode 100644 index 0000000..795c81e --- /dev/null +++ b/modules/programs/nvim/new_plugins/catppuccin.nix @@ -0,0 +1,15 @@ +{ config, lib, pkgs, inputs, ... }: + +let + inherit (lib) mkEnableOption mkIf readFile; + + +in +{ + home-manager.users.moritz.programs.nixvim = { + colorschemes.catppuccin = { + enable = true; + settings.flavour = "macchiato"; + }; + }; +} diff --git a/modules/programs/nvim/new_plugins/cmp.nix b/modules/programs/nvim/new_plugins/cmp.nix new file mode 100644 index 0000000..9e894f6 --- /dev/null +++ b/modules/programs/nvim/new_plugins/cmp.nix @@ -0,0 +1,68 @@ +{ config, lib, pkgs, inputs, ... }: + +let + inherit (lib) mkEnableOption mkIf readFile; +in +{ + home-manager.users.moritz.programs.nixvim = { + plugins.cmp = { + autoEnableSources = true; + enable = true; + settings.sources = [ + { priority = 1; name = "async_path"; } + { priority = 1; name = "buffer"; } + { priority = 2; name = "nvim_lsp"; } + { priority = 3; name = "nvim_lsp_signature_help"; } + { priority = 4; name = "luasnip"; } + { priority = 4; name = "vimtex"; } + ]; + settings.mapping = { + __raw = '' + cmp.mapping.preset.insert({ + [''] = cmp.mapping.scroll_docs(-4), + [''] = cmp.mapping.scroll_docs(4), + [''] = cmp.mapping.complete(), + [''] = cmp.mapping.abort(), + [''] = cmp.mapping.confirm({ select = true }), + [""] = cmp.mapping(function(fallback) + if cmp.visible() then + cmp.select_next_item({ behavior = cmp.SelectBehavior.Select }) + elseif require("luasnip").locally_jumpable(1) then + require("luasnip").jump(1) + else + fallback() + end + end, { "i", "s" }), + [""] = cmp.mapping(function(fallback) + if cmp.visible() then + cmp.select_prev_item({ behavior = cmp.SelectBehavior.Select }) + elseif require("luasnip").locally_jumpable(-1) then + require("luasnip").jump(-1) + else + fallback() + end + end, { "i", "s" }), + [""] = cmp.mapping(function(fallback) + if require("luasnip").choice_active() then + require("luasnip").change_choice(1) + elseif require("luasnip").locally_jumpable(1) then + require("luasnip").jump(1) + else + fallback() + end + end, { "i", "s" }), + [""] = cmp.mapping(function(fallback) + if require("luasnip").choice_active() then + require("luasnip").change_choice(-1) + elseif require("luasnip").locally_jumpable(-1) then + require("luasnip").jump(-1) + else + fallback() + end + end, { "i", "s" }), + }) + ''; + }; + }; + }; +} diff --git a/modules/programs/nvim/new_plugins/lsp.nix b/modules/programs/nvim/new_plugins/lsp.nix new file mode 100644 index 0000000..b8cfbeb --- /dev/null +++ b/modules/programs/nvim/new_plugins/lsp.nix @@ -0,0 +1,31 @@ +{ config, lib, pkgs, inputs, ... }: + +let + inherit (lib) mkEnableOption mkIf readFile; +in +{ + home-manager.users.moritz.programs.nixvim = { + plugins.lsp = { + enable = true; + inlayHints = true; + servers.nil-ls.enable = true; + servers.nixd.enable = true; + servers.nixd.extraOptions.settings.nixd = { + nixpkgs = { + expr = "import { }"; + }; + options = { + nixos = { + expr = ''(builtins.getFlake ("git+file://" + toString ./.)).nixosConfigurations.nixos-desktop.options''; + }; + "flake-parts" = { + expr = ''(builtins.getFlake ("git+file://" + toString ./.)).debug.options''; + }; + "flake-parts2" = { + expr = ''(builtins.getFlake ("git+file://" + toString ./.)).currentSystem.options''; + }; + }; + }; + }; + }; +} diff --git a/modules/programs/nvim/new_plugins/lspsaga.nix b/modules/programs/nvim/new_plugins/lspsaga.nix new file mode 100644 index 0000000..260acdf --- /dev/null +++ b/modules/programs/nvim/new_plugins/lspsaga.nix @@ -0,0 +1,42 @@ +{ config, lib, pkgs, inputs, ... }: + +let + inherit (lib) mkEnableOption mkIf readFile; +in +{ + home-manager.users.moritz.programs.nixvim = { + plugins.lspsaga = { + enable = true; + codeAction.keys.quit = ""; + lightbulb.virtualText = false; + }; + keymapsOnEvents = { + LspAttach = [ + { + key = "cc"; + action = "Lspsaga code_action"; + options.desc = "Code Action"; + options.buffer = true; + } + { + key = "gd"; + action = "Lspsaga goto_definition"; + options.desc = "Goto Definition"; + options.buffer = true; + } + { + key = "cr"; + action = "Lspsaga rename"; + options.desc = "Rename"; + options.buffer = true; + } + { + key = "K"; + action = "Lspsaga hover_doc"; + options.desc = "Hover"; + options.buffer = true; + } + ]; + }; + }; +} diff --git a/modules/programs/nvim/new_plugins/lualine.nix b/modules/programs/nvim/new_plugins/lualine.nix new file mode 100644 index 0000000..a5dfd2a --- /dev/null +++ b/modules/programs/nvim/new_plugins/lualine.nix @@ -0,0 +1,10 @@ +{ config, lib, pkgs, inputs, ... }: + +let + inherit (lib) mkEnableOption mkIf readFile; +in +{ + home-manager.users.moritz.programs.nixvim = { + plugins.lualine.enable = true; + }; +} diff --git a/modules/programs/nvim/new_plugins/luasnip.nix b/modules/programs/nvim/new_plugins/luasnip.nix new file mode 100644 index 0000000..7f84147 --- /dev/null +++ b/modules/programs/nvim/new_plugins/luasnip.nix @@ -0,0 +1,27 @@ +{ config, lib, pkgs, inputs, ... }: + +let + inherit (lib) mkEnableOption mkIf readFile; +in +{ + home-manager.users.moritz.programs.nixvim = { + plugins.luasnip = { + enable = true; + settings = { + history = true; + update_events = "TextChanged,TextChangedI"; + delete_check_events = "TextChanged"; + ext_opts.__raw = '' + { + [require("luasnip.util.types").choiceNode] = { + active = { + virt_text = { { "<--", "Error" } }, + }, + }, + } + ''; + ft_func.__raw = ''require("luasnip.extras.filetype_functions").from_pos_or_filetype''; + }; + }; + }; +} diff --git a/modules/programs/nvim/new_plugins/nvim-ufo.nix b/modules/programs/nvim/new_plugins/nvim-ufo.nix new file mode 100644 index 0000000..7189f8f --- /dev/null +++ b/modules/programs/nvim/new_plugins/nvim-ufo.nix @@ -0,0 +1,10 @@ +{ config, lib, pkgs, inputs, ... }: + +let + inherit (lib) mkEnableOption mkIf readFile; +in +{ + home-manager.users.moritz.programs.nixvim = { + plugins.nvim-ufo.enable = true; + }; +} diff --git a/modules/programs/nvim/new_plugins/other.nix b/modules/programs/nvim/new_plugins/other.nix new file mode 100644 index 0000000..479cd38 --- /dev/null +++ b/modules/programs/nvim/new_plugins/other.nix @@ -0,0 +1,171 @@ +{ config, lib, pkgs, inputs, ... }: + +let + inherit (lib) mkEnableOption mkIf readFile; +in +{ + home-manager.users.moritz = { + programs.nixvim = lib.mkMerge [ + { plugins.which-key.enable = true; } + { plugins.lastplace.enable = true; } + { plugins.comment.enable = true; } + { plugins.ts-context-commentstring.enable = true; } + { + plugins.vimtex = { + enable = true; + settings.view_method = "zathura"; + }; + } + { + plugins.todo-comments = { + enable = true; + keymaps.todoTelescope.key = "fc"; + }; + } + { + plugins.conform-nvim = { + enable = true; + settings.formatters_by_ft = { + "*" = [ "codespell" "trim_whitespace" ]; + elixir = [ "mix" ]; + gleam = [ "gleam" ]; + go = [ "gofmt" ]; + json = [ "jq" ]; + lua = [ "stylua" ]; + nix.__raw = ''{ "nixpkgs_fmt", "alejandra", stop_after_first=true }''; + python.__raw = '' + function(bufnr) + return { first("ruff_organize_imports", "isort"), first("ruff_format", "black")} + end + ''; + rust = [ "rustfmt" ]; + sh = [ "shfmt" ]; + tex = [ "latexindent" ]; + toml = [ "taplo" ]; + yaml = [ "yamlfix" ]; + }; + }; + opts.formatexpr = "v:lua.require'conform'.formatexpr()"; + extraConfigLuaPre = '' + ---@param bufnr integer + ---@param ... string + ---@return string + local function first(bufnr, ...) + local conform = require("conform") + for i = 1, select("#", ...) do + local formatter = select(i, ...) + if conform.get_formatter_info(formatter, bufnr).available then + return formatter + end + end + return select(1, ...) + end + + vim.api.nvim_create_user_command("Format", function(opts) + require("conform").format({ formatters = opts.fargs }) + end, { + nargs = "+", + complete = function() + local formatters_by_ft = require("conform").formatters_by_ft + local names = formatters_by_ft[vim.bo.filetype] or formatters_by_ft["_"] or {} + names = vim.list_extend(names, formatters_by_ft["*"] or {}) + names = vim.tbl_flatten(names) + local formatters = vim.tbl_map(require("conform").get_formatter_info, names) + formatters = vim.tbl_filter(function(formatter) + return formatter.available + end, formatters) + return vim.tbl_map(function(formatter_info) + return formatter_info.name + end, formatters) + end, + }) + ''; + performance.combinePlugins.standalonePlugins = [ + "conform.nvim" + ]; + keymaps = [ + { key = "cf"; action.__raw = ''function() require("conform").format() end''; options.desc = "Format current file"; } + ]; + } + { + keymaps = [ + { key = ""; action = "noh"; options.desc = "Escape and clear hlsearch"; mode = [ "i" "n" ]; } + ]; + } + { plugins.oil.enable = true; } + { + plugins.telescope = { + enable = true; + extensions.fzf-native.enable = true; + keymaps = { + "ff" = { + action = "find_files"; + options.desc = "Find files"; + }; + "fb" = { + action = "buffers"; + options.desc = "Find buffers"; + }; + "fl" = { + action = "current_buffer_fuzzy_find"; + options.desc = "Search lines"; + }; + "fg" = { + action = "live_grep"; + options.desc = "Live grep"; + }; + "fh" = { + action = "help_tags"; + options.desc = "Help tags"; + }; + "fr" = { + action = "oldfiles"; + options.desc = "Recent files"; + }; + }; + }; + } + { plugins.nvim-autopairs.enable = true; } + { plugins.surround.enable = true; } + { + plugins.lint.enable = true; + # TODO: add linters + plugins.lint.lintersByFt = { }; + } + { + plugins.marks.enable = true; + plugins.marks.defaultMappings = false; + } + { + plugins.hmts.enable = true; + performance.combinePlugins.standalonePlugins = [ "hmts.nvim" ]; + } + { plugins.gitsigns.enable = true; } + { plugins.fugitive.enable = true; } + { plugins.friendly-snippets.enable = true; } + { plugins.direnv.enable = true; } + { plugins.crates-nvim.enable = true; } + { + extraPlugins = [ + (pkgs.vimUtils.buildVimPlugin { + pname = "avante.nvim"; + src = inputs.avante-nvim; + version = lib.my.mkVersionInput inputs.avante-nvim; + }) + pkgs.vimPlugins.nui-nvim + ]; + extraConfigLuaPost = '' + require("avante").setup({ + provider = "copilot", + auto_suggestions_provider = "copilot", + }) + ''; + plugins.copilot-lua.enable = true; + plugins.copilot-lua.suggestion.enabled = false; + plugins.copilot-lua.panel.enabled = false; + plugins.dressing.enable = true; + performance.combinePlugins.standalonePlugins = [ "copilot.lua" ]; + } + ]; + }; +} diff --git a/modules/programs/nvim/new_plugins/treesitter.nix b/modules/programs/nvim/new_plugins/treesitter.nix new file mode 100644 index 0000000..6ccb255 --- /dev/null +++ b/modules/programs/nvim/new_plugins/treesitter.nix @@ -0,0 +1,19 @@ +{ config, lib, pkgs, inputs, ... }: + +let + inherit (lib) mkEnableOption mkIf readFile; +in +{ + home-manager.users.moritz.programs.nixvim = { + plugins.treesitter = { + enable = true; + folding = true; + nixvimInjections = true; + settings.indent.enable = true; + settings.highlight.enable = true; + }; + performance.combinePlugins.standalonePlugins = [ + "nvim-treesitter" + ]; + }; +} From 9a66c102413a31c0b651cb3db66d0e278dcafcad Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Moritz=20B=C3=B6hme?= Date: Sun, 15 Sep 2024 15:31:39 +0200 Subject: [PATCH 4/9] feat(nvim): move avante to own file and use openai --- modules/programs/nvim/new_plugins/avante.nix | 33 +++++++++++++++++++ modules/programs/nvim/new_plugins/other.nix | 22 +------------ secrets/openai.age | Bin 0 -> 597 bytes secrets/secrets.nix | 1 + 4 files changed, 35 insertions(+), 21 deletions(-) create mode 100644 modules/programs/nvim/new_plugins/avante.nix create mode 100644 secrets/openai.age diff --git a/modules/programs/nvim/new_plugins/avante.nix b/modules/programs/nvim/new_plugins/avante.nix new file mode 100644 index 0000000..1bf5c89 --- /dev/null +++ b/modules/programs/nvim/new_plugins/avante.nix @@ -0,0 +1,33 @@ +{ config, lib, pkgs, inputs, ... }: + +let + inherit (lib) mkEnableOption mkIf readFile; +in +{ + home-manager.users.moritz.programs.nixvim = { + extraPlugins = [ + (pkgs.vimUtils.buildVimPlugin { + pname = "avante.nvim"; + src = inputs.avante-nvim; + version = lib.my.mkVersionInput inputs.avante-nvim; + }) + pkgs.vimPlugins.nui-nvim + ]; + extraConfigLuaPost = '' + require("avante").setup({ + provider = "openai", + auto_suggestions_provider = "openai", + openai = { + api_key_name = "cmd:cat /run/agenix/openai" + } + }) + ''; + plugins.copilot-lua.enable = true; + plugins.copilot-lua.suggestion.enabled = false; + plugins.copilot-lua.panel.enabled = false; + plugins.dressing.enable = true; + performance.combinePlugins.standalonePlugins = [ "copilot.lua" ]; + }; + age.secrets."openai".file = ../../../../secrets/openai.age; + age.secrets."openai".owner = "moritz"; +} diff --git a/modules/programs/nvim/new_plugins/other.nix b/modules/programs/nvim/new_plugins/other.nix index 479cd38..b5d91a1 100644 --- a/modules/programs/nvim/new_plugins/other.nix +++ b/modules/programs/nvim/new_plugins/other.nix @@ -145,27 +145,7 @@ in { plugins.friendly-snippets.enable = true; } { plugins.direnv.enable = true; } { plugins.crates-nvim.enable = true; } - { - extraPlugins = [ - (pkgs.vimUtils.buildVimPlugin { - pname = "avante.nvim"; - src = inputs.avante-nvim; - version = lib.my.mkVersionInput inputs.avante-nvim; - }) - pkgs.vimPlugins.nui-nvim - ]; - extraConfigLuaPost = '' - require("avante").setup({ - provider = "copilot", - auto_suggestions_provider = "copilot", - }) - ''; - plugins.copilot-lua.enable = true; - plugins.copilot-lua.suggestion.enabled = false; - plugins.copilot-lua.panel.enabled = false; - plugins.dressing.enable = true; - performance.combinePlugins.standalonePlugins = [ "copilot.lua" ]; - } + ]; }; } diff --git a/secrets/openai.age b/secrets/openai.age new file mode 100644 index 0000000000000000000000000000000000000000..32ad5627d4d7edf245d1419c96c9fbedc491fc64 GIT binary patch literal 597 zcmYdHPt{G$OD?J`D9Oyv)5|YP*Do{V(zR14F3!+RO))YxHMCT4&MGZTb5tlZ(f6w; zE%mjC$SFz<_VG(JOV2QJbjmUEOw1_vHb_g!O3m^#56v>DFySgq^fbuz4#-Ul_fFII zcPhyYG%Q+=_RBWDOma3gml9yI)QC5}d%4Jkuo*R{HnQq|fnUNcjms8*qVUigb z91-Rp;%lN`X5p7-W>Dyzt6gk}VOvyWig{GJLRwy6R$zItg=45kMWS|Yc#fN6rgMp_ znX!wjWlBYIsdi3zXRB&FAiBXtevVoDmQF^&gxNDJT zc%*^9r?G1>*SV?nXC9|C^&Ea{$78M~m{qa(FZB8q4Jls>5|H|~~f=%6b&Z}5$(AoX_TD^If)|Fe0D;$EqK0E7a z<#+d^RkgTks!B{+$2^9XJx+7%nwFi=4|~+7oVWG$j?J9*d)gknn$CD%#69EAjJP{r zRX9)0C~e+7y`yf?EZbnY{4=#7ueY8J5PY!iw(#-qYn1d9detZ9q|Dm1@}9|Ap|jS9 NV}l!C6szZL0RXF; Date: Sun, 15 Sep 2024 15:32:43 +0200 Subject: [PATCH 5/9] feat(nvim): move conform to own file --- modules/programs/nvim/new_plugins/conform.nix | 73 +++++++++++++++++++ modules/programs/nvim/new_plugins/other.nix | 64 ---------------- 2 files changed, 73 insertions(+), 64 deletions(-) create mode 100644 modules/programs/nvim/new_plugins/conform.nix diff --git a/modules/programs/nvim/new_plugins/conform.nix b/modules/programs/nvim/new_plugins/conform.nix new file mode 100644 index 0000000..a8b94f3 --- /dev/null +++ b/modules/programs/nvim/new_plugins/conform.nix @@ -0,0 +1,73 @@ +{ config, lib, pkgs, inputs, ... }: + +let + inherit (lib) mkEnableOption mkIf readFile; +in +{ + home-manager.users.moritz.programs.nixvim = { + plugins.conform-nvim = { + enable = true; + settings.formatters_by_ft = { + "*" = [ "codespell" "trim_whitespace" ]; + elixir = [ "mix" ]; + gleam = [ "gleam" ]; + go = [ "gofmt" ]; + json = [ "jq" ]; + lua = [ "stylua" ]; + nix.__raw = ''{ "nixpkgs_fmt", "alejandra", stop_after_first=true }''; + python.__raw = '' + function(bufnr) + return { first("ruff_organize_imports", "isort"), first("ruff_format", "black")} + end + ''; + rust = [ "rustfmt" ]; + sh = [ "shfmt" ]; + tex = [ "latexindent" ]; + toml = [ "taplo" ]; + yaml = [ "yamlfix" ]; + }; + }; + opts.formatexpr = "v:lua.require'conform'.formatexpr()"; + extraConfigLuaPre = '' + ---@param bufnr integer + ---@param ... string + ---@return string + local function first(bufnr, ...) + local conform = require("conform") + for i = 1, select("#", ...) do + local formatter = select(i, ...) + if conform.get_formatter_info(formatter, bufnr).available then + return formatter + end + end + return select(1, ...) + end + + vim.api.nvim_create_user_command("Format", function(opts) + require("conform").format({ formatters = opts.fargs }) + end, { + nargs = "+", + complete = function() + local formatters_by_ft = require("conform").formatters_by_ft + local names = formatters_by_ft[vim.bo.filetype] or formatters_by_ft["_"] or {} + names = vim.list_extend(names, formatters_by_ft["*"] or {}) + names = vim.tbl_flatten(names) + local formatters = vim.tbl_map(require("conform").get_formatter_info, names) + formatters = vim.tbl_filter(function(formatter) + return formatter.available + end, formatters) + return vim.tbl_map(function(formatter_info) + return formatter_info.name + end, formatters) + end, + }) + ''; + performance.combinePlugins.standalonePlugins = [ + "conform.nvim" + ]; + keymaps = [ + { key = "cf"; action.__raw = ''function() require("conform").format() end''; options.desc = "Format current file"; } + ]; + }; + +} diff --git a/modules/programs/nvim/new_plugins/other.nix b/modules/programs/nvim/new_plugins/other.nix index b5d91a1..ac8ec77 100644 --- a/modules/programs/nvim/new_plugins/other.nix +++ b/modules/programs/nvim/new_plugins/other.nix @@ -22,71 +22,7 @@ in keymaps.todoTelescope.key = "fc"; }; } - { - plugins.conform-nvim = { - enable = true; - settings.formatters_by_ft = { - "*" = [ "codespell" "trim_whitespace" ]; - elixir = [ "mix" ]; - gleam = [ "gleam" ]; - go = [ "gofmt" ]; - json = [ "jq" ]; - lua = [ "stylua" ]; - nix.__raw = ''{ "nixpkgs_fmt", "alejandra", stop_after_first=true }''; - python.__raw = '' - function(bufnr) - return { first("ruff_organize_imports", "isort"), first("ruff_format", "black")} - end - ''; - rust = [ "rustfmt" ]; - sh = [ "shfmt" ]; - tex = [ "latexindent" ]; - toml = [ "taplo" ]; - yaml = [ "yamlfix" ]; - }; - }; - opts.formatexpr = "v:lua.require'conform'.formatexpr()"; - extraConfigLuaPre = '' - ---@param bufnr integer - ---@param ... string - ---@return string - local function first(bufnr, ...) - local conform = require("conform") - for i = 1, select("#", ...) do - local formatter = select(i, ...) - if conform.get_formatter_info(formatter, bufnr).available then - return formatter - end - end - return select(1, ...) - end - vim.api.nvim_create_user_command("Format", function(opts) - require("conform").format({ formatters = opts.fargs }) - end, { - nargs = "+", - complete = function() - local formatters_by_ft = require("conform").formatters_by_ft - local names = formatters_by_ft[vim.bo.filetype] or formatters_by_ft["_"] or {} - names = vim.list_extend(names, formatters_by_ft["*"] or {}) - names = vim.tbl_flatten(names) - local formatters = vim.tbl_map(require("conform").get_formatter_info, names) - formatters = vim.tbl_filter(function(formatter) - return formatter.available - end, formatters) - return vim.tbl_map(function(formatter_info) - return formatter_info.name - end, formatters) - end, - }) - ''; - performance.combinePlugins.standalonePlugins = [ - "conform.nvim" - ]; - keymaps = [ - { key = "cf"; action.__raw = ''function() require("conform").format() end''; options.desc = "Format current file"; } - ]; - } { keymaps = [ { key = ""; action = "noh"; options.desc = "Escape and clear hlsearch"; mode = [ "i" "n" ]; } From 22a6b5156ca9d7234612455db0e0b6d3d7e35a32 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Moritz=20B=C3=B6hme?= Date: Mon, 7 Oct 2024 09:31:06 +0200 Subject: [PATCH 6/9] feat: improve luasnip --- modules/programs/nvim/default.nix | 4 -- modules/programs/nvim/new_plugins/cmp.nix | 11 ++- modules/programs/nvim/new_plugins/luasnip.nix | 43 ++++++----- .../programs/nvim/plugins/snippets/elixir.lua | 46 ------------ .../programs/nvim/snippets/elixir.snippets | 71 +++++++++++++++++++ .../nvim/{plugins => }/snippets/gleam.lua | 0 .../nvim/{plugins => }/snippets/heex.lua | 0 .../nvim/{plugins => }/snippets/python.lua | 0 .../programs/nvim/snippets/snippets.snippets | 7 ++ 9 files changed, 115 insertions(+), 67 deletions(-) delete mode 100644 modules/programs/nvim/plugins/snippets/elixir.lua create mode 100644 modules/programs/nvim/snippets/elixir.snippets rename modules/programs/nvim/{plugins => }/snippets/gleam.lua (100%) rename modules/programs/nvim/{plugins => }/snippets/heex.lua (100%) rename modules/programs/nvim/{plugins => }/snippets/python.lua (100%) create mode 100644 modules/programs/nvim/snippets/snippets.snippets diff --git a/modules/programs/nvim/default.nix b/modules/programs/nvim/default.nix index 789809d..7e26b6e 100644 --- a/modules/programs/nvim/default.nix +++ b/modules/programs/nvim/default.nix @@ -12,10 +12,6 @@ in config = mkIf cfg.enable { home-manager.users.moritz = { - xdg.configFile."nvim/snippets" = { - recursive = true; - source = ./plugins/snippets; - }; home.packages = with pkgs; [ xdotool # for vimtex diff --git a/modules/programs/nvim/new_plugins/cmp.nix b/modules/programs/nvim/new_plugins/cmp.nix index 9e894f6..b496b6d 100644 --- a/modules/programs/nvim/new_plugins/cmp.nix +++ b/modules/programs/nvim/new_plugins/cmp.nix @@ -5,6 +5,15 @@ let in { home-manager.users.moritz.programs.nixvim = { + extraConfigLuaPre = '' + local has_words_before = function() + if vim.api.nvim_buf_get_option(0, "buftype") == "prompt" then + return false + end + local line, col = unpack(vim.api.nvim_win_get_cursor(0)) + return col ~= 0 and vim.api.nvim_buf_get_text(0, line-1, 0, line-1, col, {})[1]:match("^%s@*$") == nil + end + ''; plugins.cmp = { autoEnableSources = true; enable = true; @@ -27,7 +36,7 @@ in [""] = cmp.mapping(function(fallback) if cmp.visible() then cmp.select_next_item({ behavior = cmp.SelectBehavior.Select }) - elseif require("luasnip").locally_jumpable(1) then + elseif require("luasnip").locally_jumpable(1) and has_words_before() then require("luasnip").jump(1) else fallback() diff --git a/modules/programs/nvim/new_plugins/luasnip.nix b/modules/programs/nvim/new_plugins/luasnip.nix index 7f84147..fdaf5c6 100644 --- a/modules/programs/nvim/new_plugins/luasnip.nix +++ b/modules/programs/nvim/new_plugins/luasnip.nix @@ -4,24 +4,35 @@ let inherit (lib) mkEnableOption mkIf readFile; in { - home-manager.users.moritz.programs.nixvim = { - plugins.luasnip = { - enable = true; - settings = { - history = true; - update_events = "TextChanged,TextChangedI"; - delete_check_events = "TextChanged"; - ext_opts.__raw = '' - { - [require("luasnip.util.types").choiceNode] = { - active = { - virt_text = { { "<--", "Error" } }, + home-manager.users.moritz = { + xdg.configFile."nvim/snippets" = { + recursive = true; + source = ../snippets; + }; + programs.nixvim = { + plugins.luasnip = { + enable = true; + settings = { + history = true; + update_events = "TextChanged,TextChangedI"; + delete_check_events = "TextChanged"; + ext_opts.__raw = '' + { + [require("luasnip.util.types").choiceNode] = { + active = { + virt_text = { { "<--", "Error" } }, + }, }, - }, - } - ''; - ft_func.__raw = ''require("luasnip.extras.filetype_functions").from_pos_or_filetype''; + } + ''; + ft_func.__raw = ''require("luasnip.extras.filetype_functions").from_pos_or_filetype''; + }; }; + extraConfigLuaPost = '' + require("luasnip.loaders.from_lua").load({ paths = "~/.config/nvim/snippets" }) + require("luasnip.loaders.from_snipmate").lazy_load({ paths = "~/.config/nvim/snippets" }) + require("luasnip.loaders.from_vscode").lazy_load() + ''; }; }; } diff --git a/modules/programs/nvim/plugins/snippets/elixir.lua b/modules/programs/nvim/plugins/snippets/elixir.lua deleted file mode 100644 index e393f11..0000000 --- a/modules/programs/nvim/plugins/snippets/elixir.lua +++ /dev/null @@ -1,46 +0,0 @@ -local ls = require("luasnip") -local s = ls.snippet -local sn = ls.snippet_node -local isn = ls.indent_snippet_node -local t = ls.text_node -local i = ls.insert_node -local f = ls.function_node -local c = ls.choice_node -local d = ls.dynamic_node -local r = ls.restore_node -local events = require("luasnip.util.events") -local ai = require("luasnip.nodes.absolute_indexer") -local extras = require("luasnip.extras") -local l = extras.lambda -local rep = extras.rep -local p = extras.partial -local m = extras.match -local n = extras.nonempty -local dl = extras.dynamic_lambda -local fmt = require("luasnip.extras.fmt").fmt -local fmta = require("luasnip.extras.fmt").fmta -local conds = require("luasnip.extras.expand_conditions") -local postfix = require("luasnip.extras.postfix").postfix -local types = require("luasnip.util.types") -local parse = require("luasnip.util.parser").parse_snippet -local ms = ls.multi_snippet -local k = require("luasnip.nodes.key_indexer").new_key - -local def_template = [[ -def {fname}({args}) do - {final} -end -]] - -local def = s( - "def", - fmt(def_template, { - fname = i(1, "fname"), - args = i(2), - final = i(3), - }, { priority = 1001 }) -) - -return { - def, -} diff --git a/modules/programs/nvim/snippets/elixir.snippets b/modules/programs/nvim/snippets/elixir.snippets new file mode 100644 index 0000000..a02788e --- /dev/null +++ b/modules/programs/nvim/snippets/elixir.snippets @@ -0,0 +1,71 @@ +snippet defmodule "Define a new module" + defmodule ${1} do + ${2} + end + +snippet def "Define a function" + def ${1} do + ${2} + end + +snippet defw "Define a function with guard" + def ${1}(${2}) when ${3} do + ${4} + end + +snippet defa "Define a function with arguments" + def ${1}(${2}) do + ${3} + end + +snippet defp "Define a private function" + defp ${1} do + ${2} + end + +snippet defpw "Define a private function with guard" + defp ${1}(${2}) when ${3} do + ${4} + end + +snippet defpa "Define a private function with arguments" + defp ${1}(${2}) do + ${3} + end + +snippet defmacro "Define a macro" + defmacro ${1}(${2}) do + ${3} + end + +snippet defmacrow "Define a macro with guard" + defmacro ${1}(${2}) when ${3} do + ${4} + end + +snippet quote "Quote block" + quote do + ${1} + end + +snippet quoteb "Quote block with bind_quoted" + quote bind_quoted: [${1}] do + ${2} + end + +snippet do "Do block" + do + ${1} + end + +snippet if "If block" + if ${1} do + ${2} + end + +snippet ife "If-Else block" + if ${1} do + ${2} + else + ${3} + end diff --git a/modules/programs/nvim/plugins/snippets/gleam.lua b/modules/programs/nvim/snippets/gleam.lua similarity index 100% rename from modules/programs/nvim/plugins/snippets/gleam.lua rename to modules/programs/nvim/snippets/gleam.lua diff --git a/modules/programs/nvim/plugins/snippets/heex.lua b/modules/programs/nvim/snippets/heex.lua similarity index 100% rename from modules/programs/nvim/plugins/snippets/heex.lua rename to modules/programs/nvim/snippets/heex.lua diff --git a/modules/programs/nvim/plugins/snippets/python.lua b/modules/programs/nvim/snippets/python.lua similarity index 100% rename from modules/programs/nvim/plugins/snippets/python.lua rename to modules/programs/nvim/snippets/python.lua diff --git a/modules/programs/nvim/snippets/snippets.snippets b/modules/programs/nvim/snippets/snippets.snippets new file mode 100644 index 0000000..f242e82 --- /dev/null +++ b/modules/programs/nvim/snippets/snippets.snippets @@ -0,0 +1,7 @@ +snippet snip + snippet ${1:trigger} "${2:description}" + ${0:${VISUAL}} +snippet v + {VISUAL} +snippet $ + ${${1:1}:${0:text}} From 87473baed4227ad3704fd00977a2b3b5b63553bb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Moritz=20B=C3=B6hme?= Date: Tue, 8 Oct 2024 09:42:32 +0200 Subject: [PATCH 7/9] chore: update flake --- flake.lock | 281 ++++++++++-------- flake.nix | 2 - hosts/nixos-laptop/default.nix | 1 + hosts/nixos-laptop/disko.nix | 26 +- modules/programs/nvim/new_plugins/avante.nix | 26 +- modules/programs/nvim/new_plugins/lspsaga.nix | 11 +- modules/programs/nvim/new_plugins/other.nix | 60 ++-- modules/programs/river/default.nix | 8 - 8 files changed, 225 insertions(+), 190 deletions(-) diff --git a/flake.lock b/flake.lock index b4c1870..a550039 100644 --- a/flake.lock +++ b/flake.lock @@ -43,11 +43,11 @@ ] }, "locked": { - "lastModified": 1723920171, - "narHash": "sha256-dVCMrAe+D/5S91erhwQj2DSzHOVzAanWqoy+vPWB9DY=", + "lastModified": 1727261104, + "narHash": "sha256-rxDI7WrxIRV9it9mDCHcLa7xQykf1JloXnoXr5xQ8zI=", "owner": "hyprwm", "repo": "aquamarine", - "rev": "71d49670fe246cdaff4860b0effba0ab9f163b72", + "rev": "b82fdaff917582a9d568969e15e61b398c71e990", "type": "github" }, "original": { @@ -59,11 +59,11 @@ "arkenfox-userjs": { "flake": false, "locked": { - "lastModified": 1722919020, - "narHash": "sha256-tTKGJXg/yicwpCI9WwFmbKYL6cyQ0OOetbvT9i/psUk=", + "lastModified": 1724661688, + "narHash": "sha256-XLswsa2u2qsUPsLYRYn6lwis7VwSjAW6BRNdI4brbSM=", "owner": "arkenfox", "repo": "user.js", - "rev": "11582f905a21971eb5869b48ef8c3f2d4eac4d89", + "rev": "f906f7f3b41fe3f6aaa744980431f4fdcd086379", "type": "github" }, "original": { @@ -89,22 +89,6 @@ "type": "github" } }, - "avante-nvim": { - "flake": false, - "locked": { - "lastModified": 1725237964, - "narHash": "sha256-3jwSkCHr5iaeEIjt2lz/SQl7gbrkFiJ0FjspX6Ufa88=", - "owner": "yetone", - "repo": "avante.nvim", - "rev": "d520f0933323ba982c9665d8e4fe91000ff14e99", - "type": "github" - }, - "original": { - "owner": "yetone", - "repo": "avante.nvim", - "type": "github" - } - }, "darwin": { "inputs": { "nixpkgs": [ @@ -150,11 +134,11 @@ "nixpkgs": "nixpkgs_2" }, "locked": { - "lastModified": 1723685519, - "narHash": "sha256-GkXQIoZmW2zCPp1YFtAYGg/xHNyFH/Mgm79lcs81rq0=", + "lastModified": 1728109432, + "narHash": "sha256-wmbErh8FG7dRKOtMMpHUqDtFjeqt9Zjx4zssSeTalwU=", "owner": "nix-community", "repo": "disko", - "rev": "276a0d055a720691912c6a34abb724e395c8e38a", + "rev": "48ebb577855fb2398653f033b3b2208a9249203d", "type": "github" }, "original": { @@ -246,11 +230,11 @@ "nixpkgs-lib": "nixpkgs-lib" }, "locked": { - "lastModified": 1722555600, - "narHash": "sha256-XOQkdLafnb/p9ij77byFQjDf5m5QYl9b2REiVClC+x4=", + "lastModified": 1727826117, + "narHash": "sha256-K5ZLCyfO/Zj9mPFldf3iwS6oZStJcU4tSpiXTMYaaL0=", "owner": "hercules-ci", "repo": "flake-parts", - "rev": "8471fe90ad337a8074e957b69ca4d0089218391d", + "rev": "3d04084d54bedc3d6b8b736c70ef449225c361b1", "type": "github" }, "original": { @@ -267,11 +251,11 @@ ] }, "locked": { - "lastModified": 1722555600, - "narHash": "sha256-XOQkdLafnb/p9ij77byFQjDf5m5QYl9b2REiVClC+x4=", + "lastModified": 1727826117, + "narHash": "sha256-K5ZLCyfO/Zj9mPFldf3iwS6oZStJcU4tSpiXTMYaaL0=", "owner": "hercules-ci", "repo": "flake-parts", - "rev": "8471fe90ad337a8074e957b69ca4d0089218391d", + "rev": "3d04084d54bedc3d6b8b736c70ef449225c361b1", "type": "github" }, "original": { @@ -327,11 +311,11 @@ "systems": "systems_2" }, "locked": { - "lastModified": 1710146030, - "narHash": "sha256-SZ5L6eA7HJ/nmkzGG7/ISclqe6oZdOZTNoesiInkXPQ=", + "lastModified": 1726560853, + "narHash": "sha256-X6rJYSESBVr3hBoH0WbKE5KvhPU5bloyZ2L4K60/fPQ=", "owner": "numtide", "repo": "flake-utils", - "rev": "b1d9ab70662946ef0850d488da1c9019f3a9752a", + "rev": "c1dfcf08411b08f6b8615f7d8971a2bfa81d5e8a", "type": "github" }, "original": { @@ -345,11 +329,11 @@ "systems": "systems_4" }, "locked": { - "lastModified": 1710146030, - "narHash": "sha256-SZ5L6eA7HJ/nmkzGG7/ISclqe6oZdOZTNoesiInkXPQ=", + "lastModified": 1726560853, + "narHash": "sha256-X6rJYSESBVr3hBoH0WbKE5KvhPU5bloyZ2L4K60/fPQ=", "owner": "numtide", "repo": "flake-utils", - "rev": "b1d9ab70662946ef0850d488da1c9019f3a9752a", + "rev": "c1dfcf08411b08f6b8615f7d8971a2bfa81d5e8a", "type": "github" }, "original": { @@ -372,11 +356,11 @@ ] }, "locked": { - "lastModified": 1723803910, - "narHash": "sha256-yezvUuFiEnCFbGuwj/bQcqg7RykIEqudOy/RBrId0pc=", + "lastModified": 1727805723, + "narHash": "sha256-b8flytpuc4Ey/g3mcvpS/ICORcD4h56QDZeP5LogevY=", "owner": "cachix", "repo": "git-hooks.nix", - "rev": "bfef0ada09e2c8ac55bbcd0831bd0c9d42e651ba", + "rev": "2f5ae3fc91db865eff2c5a418da85a0fbe6238a3", "type": "github" }, "original": { @@ -433,11 +417,11 @@ ] }, "locked": { - "lastModified": 1724857454, - "narHash": "sha256-Qyl9Q4QMTLZnnBb/8OuQ9LSkzWjBU1T5l5zIzTxkkhk=", + "lastModified": 1728092656, + "narHash": "sha256-eMeCTJZ5xBeQ0f9Os7K8DThNVSo9gy4umZLDfF5q6OM=", "owner": "cachix", "repo": "git-hooks.nix", - "rev": "4509ca64f1084e73bc7a721b20c669a8d4c5ebe6", + "rev": "1211305a5b237771e13fcca0c51e60ad47326a9a", "type": "github" }, "original": { @@ -520,11 +504,11 @@ ] }, "locked": { - "lastModified": 1719226092, - "narHash": "sha256-YNkUMcCUCpnULp40g+svYsaH1RbSEj6s4WdZY/SHe38=", + "lastModified": 1724947644, + "narHash": "sha256-MHHrHasTngp7EYQOObHJ1a/IsRF+wodHqOckhH6uZbk=", "owner": "hercules-ci", "repo": "hercules-ci-effects", - "rev": "11e4b8dc112e2f485d7c97e1cee77f9958f498f5", + "rev": "dba4367b9a9d9615456c430a6d6af716f6e84cef", "type": "github" }, "original": { @@ -561,11 +545,11 @@ ] }, "locked": { - "lastModified": 1723399884, - "narHash": "sha256-97wn0ihhGqfMb8WcUgzzkM/TuAxce2Gd20A8oiruju4=", + "lastModified": 1728041527, + "narHash": "sha256-03liqiJtk9UP7YQHW4r8MduKCK242FQzud8iWvvlK+o=", "owner": "nix-community", "repo": "home-manager", - "rev": "086f619dd991a4d355c07837448244029fc2d9ab", + "rev": "509dbf8d45606b618e9ec3bbe4e936b7c5bc6c1e", "type": "github" }, "original": { @@ -579,11 +563,11 @@ "nixpkgs": "nixpkgs_3" }, "locked": { - "lastModified": 1722636442, - "narHash": "sha256-+7IS0n3/F0I5j6ZbrVlLcIIPHY3o+/vLAqg/G48sG+w=", + "lastModified": 1725551787, + "narHash": "sha256-6LgsZHz8w3g4c9bRUwRAR+WIMwFGGf3P1VZQcKNRf2o=", "owner": "hyprwm", "repo": "contrib", - "rev": "9d67858b437d4a1299be496d371b66fc0d3e01f6", + "rev": "1e531dc49ad36c88b45bf836081a7a2c8927e072", "type": "github" }, "original": { @@ -608,11 +592,11 @@ ] }, "locked": { - "lastModified": 1722623071, - "narHash": "sha256-sLADpVgebpCBFXkA1FlCXtvEPu1tdEsTfqK1hfeHySE=", + "lastModified": 1727532803, + "narHash": "sha256-ZaZ7h7PY8mQc4vtGmVqWLAq9CAO02gHMyNR5yY8zDmM=", "owner": "hyprwm", "repo": "hyprcursor", - "rev": "912d56025f03d41b1ad29510c423757b4379eb1c", + "rev": "b98726e431d4d3ed58bd58bee1047cdb81cec69f", "type": "github" }, "original": { @@ -625,6 +609,7 @@ "inputs": { "aquamarine": "aquamarine", "hyprcursor": "hyprcursor", + "hyprland-protocols": "hyprland-protocols", "hyprlang": "hyprlang", "hyprutils": "hyprutils", "hyprwayland-scanner": "hyprwayland-scanner", @@ -633,11 +618,11 @@ "xdph": "xdph" }, "locked": { - "lastModified": 1723969407, - "narHash": "sha256-COChiv/1EsfN0aVQcDBPXqNR/T5sUXtalsuO1RGvwcY=", + "lastModified": 1728223706, + "narHash": "sha256-HrsylIpk+17wwsh/+sgUBmL7VHakF+EWv9v9Dx1268I=", "ref": "refs/heads/main", - "rev": "1006663b6eaa55149e9a21aa8a34e41c85eb08ca", - "revCount": 5103, + "rev": "4e41cda27ed4176005082436cb35878335e63fae", + "revCount": 5301, "submodules": true, "type": "git", "url": "https://github.com/hyprwm/Hyprland" @@ -649,6 +634,31 @@ } }, "hyprland-protocols": { + "inputs": { + "nixpkgs": [ + "hyprland", + "nixpkgs" + ], + "systems": [ + "hyprland", + "systems" + ] + }, + "locked": { + "lastModified": 1727451107, + "narHash": "sha256-qV9savtHwmZUa0eJE294WYJjKPGB2+bJhwByFShsVyo=", + "owner": "hyprwm", + "repo": "hyprland-protocols", + "rev": "6b3261ee13a6d2b99de79a31d352f6996e35bde3", + "type": "github" + }, + "original": { + "owner": "hyprwm", + "repo": "hyprland-protocols", + "type": "github" + } + }, + "hyprland-protocols_2": { "inputs": { "nixpkgs": [ "hyprland", @@ -691,11 +701,11 @@ ] }, "locked": { - "lastModified": 1721324361, - "narHash": "sha256-BiJKO0IIdnSwHQBSrEJlKlFr753urkLE48wtt0UhNG4=", + "lastModified": 1725997860, + "narHash": "sha256-d/rZ/fHR5l1n7PeyLw0StWMNLXVU9c4HFyfskw568so=", "owner": "hyprwm", "repo": "hyprlang", - "rev": "adbefbf49664a6c2c8bf36b6487fd31e3eb68086", + "rev": "dfeb5811dd6485490cce18d6cc1e38a055eea876", "type": "github" }, "original": { @@ -716,11 +726,11 @@ ] }, "locked": { - "lastModified": 1722869141, - "narHash": "sha256-0KU4qhyMp441qfwbirNg3+wbm489KnEjXOz2I/RbeFs=", + "lastModified": 1727300645, + "narHash": "sha256-OvAtVLaSRPnbXzOwlR1fVqCXR7i+ICRX3aPMCdIiv+c=", "owner": "hyprwm", "repo": "hyprutils", - "rev": "0252fd13e78e60fb0da512a212e56007515a49f7", + "rev": "3f5293432b6dc6a99f26aca2eba3876d2660665c", "type": "github" }, "original": { @@ -741,11 +751,11 @@ ] }, "locked": { - "lastModified": 1721324119, - "narHash": "sha256-SOOqIT27/X792+vsLSeFdrNTF+OSRp5qXv6Te+fb2Qg=", + "lastModified": 1726874836, + "narHash": "sha256-VKR0sf0PSNCB0wPHVKSAn41mCNVCnegWmgkrneKDhHM=", "owner": "hyprwm", "repo": "hyprwayland-scanner", - "rev": "a048a6cb015340bd82f97c1f40a4b595ca85cc30", + "rev": "500c81a9e1a76760371049a8d99e008ea77aa59e", "type": "github" }, "original": { @@ -756,11 +766,11 @@ }, "impermanence": { "locked": { - "lastModified": 1719091691, - "narHash": "sha256-AxaLX5cBEcGtE02PeGsfscSb/fWMnyS7zMWBXQWDKbE=", + "lastModified": 1727649413, + "narHash": "sha256-FA53of86DjFdeQzRDVtvgWF9o52rWK70VHGx0Y8fElQ=", "owner": "nix-community", "repo": "impermanence", - "rev": "23c1f06316b67cb5dabdfe2973da3785cfe9c34a", + "rev": "d0b38e550039a72aff896ee65b0918e975e6d48e", "type": "github" }, "original": { @@ -788,11 +798,11 @@ }, "master": { "locked": { - "lastModified": 1723976400, - "narHash": "sha256-WpKvJffFrcvNMGMR3hNtQIRa/CTAvrWYohPMAFElLJE=", + "lastModified": 1728286420, + "narHash": "sha256-o2MfGdzZsQxcBDlAiYASBqMrAUOgz2b/EzzCtIo6RNI=", "owner": "nixos", "repo": "nixpkgs", - "rev": "7c87c474f1b4f020b1ab9d2b962fde094c2599cf", + "rev": "a825406b157355e5fe73c48d04db97439a02edc9", "type": "github" }, "original": { @@ -833,11 +843,11 @@ "nixpkgs": "nixpkgs_5" }, "locked": { - "lastModified": 1723969597, - "narHash": "sha256-nNSmyoR8k2gEw9LZ+nFcBQm+bquflzw2R44BeJ4gmKk=", + "lastModified": 1727852635, + "narHash": "sha256-eY0Y5ZDMo5IS+K42kMwAMCLsYHoAgPW3R4UxeGfzP0U=", "owner": "nix-community", "repo": "neovim-nightly-overlay", - "rev": "ec3ee3674c80882ac54d93b5575426c66e3f430d", + "rev": "377cf41246ee443c86c4ae48f66f5100038fe158", "type": "github" }, "original": { @@ -849,11 +859,11 @@ "neovim-src": { "flake": false, "locked": { - "lastModified": 1723936741, - "narHash": "sha256-x/0wYCshhLSA9zW4fvPK+W6g3gTqE8fMJQZrIucDyXg=", + "lastModified": 1727825968, + "narHash": "sha256-7DbbGIAbJesqYEkZh2FaEo5wycZ/cRbvZP6k01Z5+ZM=", "owner": "neovim", "repo": "neovim", - "rev": "d1bdeacb00186ba72fa61f3c7f2951fd018ae21d", + "rev": "2168d772b864fd05109fb4299e409d4bdc1df39d", "type": "github" }, "original": { @@ -870,11 +880,11 @@ ] }, "locked": { - "lastModified": 1724561770, - "narHash": "sha256-zv8C9RNa86CIpyHwPIVO/k+5TfM8ZbjGwOOpTe1grls=", + "lastModified": 1727999297, + "narHash": "sha256-LTJuQPCsSItZ/8TieFeP30iY+uaLoD0mT0tAj1gLeyQ=", "owner": "lnl7", "repo": "nix-darwin", - "rev": "ac5694a0b855a981e81b4d9f14052e3ff46ca39e", + "rev": "8c8388ade72e58efdeae71b4cbb79e872c23a56b", "type": "github" }, "original": { @@ -890,11 +900,11 @@ ] }, "locked": { - "lastModified": 1723950649, - "narHash": "sha256-dHMkGjwwCGj0c2MKyCjRXVBXq2Sz3TWbbM23AS7/5Hc=", + "lastModified": 1728263287, + "narHash": "sha256-GJDtsxz2/zw6g/Nrp4XVWBS5IaZ7ZUkuvxPOBEDe7pg=", "owner": "Mic92", "repo": "nix-index-database", - "rev": "392828aafbed62a6ea6ccab13728df2e67481805", + "rev": "5fce10c871bab6d7d5ac9e5e7efbb3a2783f5259", "type": "github" }, "original": { @@ -981,14 +991,14 @@ }, "nixpkgs-lib": { "locked": { - "lastModified": 1722555339, - "narHash": "sha256-uFf2QeW7eAHlYXuDktm9c25OxOyCoUOQmh5SZ9amE5Q=", + "lastModified": 1727825735, + "narHash": "sha256-0xHYkMkeLVQAMa7gvkddbPqpxph+hDzdu1XdGPJR+Os=", "type": "tarball", - "url": "https://github.com/NixOS/nixpkgs/archive/a5d394176e64ab29c852d03346c1fc9b0b7d33eb.tar.gz" + "url": "https://github.com/NixOS/nixpkgs/archive/fb192fec7cc7a4c26d51779e9bab07ce6fa5597a.tar.gz" }, "original": { "type": "tarball", - "url": "https://github.com/NixOS/nixpkgs/archive/a5d394176e64ab29c852d03346c1fc9b0b7d33eb.tar.gz" + "url": "https://github.com/NixOS/nixpkgs/archive/fb192fec7cc7a4c26d51779e9bab07ce6fa5597a.tar.gz" } }, "nixpkgs-regression": { @@ -1041,11 +1051,11 @@ }, "nixpkgs_2": { "locked": { - "lastModified": 1723603349, - "narHash": "sha256-VMg6N7MryOuvSJ8Sj6YydarnUCkL7cvMdrMcnsJnJCE=", + "lastModified": 1725194671, + "narHash": "sha256-tLGCFEFTB5TaOKkpfw3iYT9dnk4awTP/q4w+ROpMfuw=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "daf7bb95821b789db24fc1ac21f613db0c1bf2cb", + "rev": "b833ff01a0d694b910daca6e2ff4a3f26dee478c", "type": "github" }, "original": { @@ -1073,11 +1083,11 @@ }, "nixpkgs_4": { "locked": { - "lastModified": 1723637854, - "narHash": "sha256-med8+5DSWa2UnOqtdICndjDAEjxr5D7zaIiK4pn0Q7c=", + "lastModified": 1727348695, + "narHash": "sha256-J+PeFKSDV+pHL7ukkfpVzCOO7mBSrrpJ3svwBFABbhI=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "c3aa7b8938b17aebd2deecf7be0636000d62a2b9", + "rev": "1925c603f17fc89f4c8f6bf6f631a802ad85d784", "type": "github" }, "original": { @@ -1089,11 +1099,11 @@ }, "nixpkgs_5": { "locked": { - "lastModified": 1723856861, - "narHash": "sha256-OTDg91+Zzs2SpU3csK4xVdSQFoG8cK1lNUwKmTqERyE=", + "lastModified": 1727747005, + "narHash": "sha256-2PBox0LkPhxirg1asEIpvfFARjq5KLw0EHPCy4unjPs=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "cd7b95ee3725af7113bacbce91dd6549cee58ca5", + "rev": "9682b2197dabc185fcca802ac1ac21136e48fcc2", "type": "github" }, "original": { @@ -1121,11 +1131,11 @@ }, "nixpkgs_7": { "locked": { - "lastModified": 1723891200, - "narHash": "sha256-uljX21+D/DZgb9uEFFG2dkkQbPZN+ig4Z6+UCLWFVAk=", + "lastModified": 1728249353, + "narHash": "sha256-7NBJm1jfMeAowE1J2oljYqWVvI9X7FyyxBY4O8uB/Os=", "owner": "nixos", "repo": "nixpkgs", - "rev": "a0d6390cb3e82062a35d0288979c45756e481f60", + "rev": "c8a17040be4a20b29589cb4043a9e0c36af1930e", "type": "github" }, "original": { @@ -1137,11 +1147,11 @@ }, "nixpkgs_8": { "locked": { - "lastModified": 1724819573, - "narHash": "sha256-GnR7/ibgIH1vhoy8cYdmXE6iyZqKqFxQSVkFgosBh6w=", + "lastModified": 1728018373, + "narHash": "sha256-NOiTvBbRLIOe5F6RbHaAh6++BNjsb149fGZd1T4+KBg=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "71e91c409d1e654808b2621f28a327acfdad8dc2", + "rev": "bc947f541ae55e999ffdb4013441347d83b00feb", "type": "github" }, "original": { @@ -1186,11 +1196,11 @@ "treefmt-nix": "treefmt-nix" }, "locked": { - "lastModified": 1724968633, - "narHash": "sha256-eb2NCdLwfXL1MuTAkoDncSl2lCJwyylV5/NM1Ws2P/U=", + "lastModified": 1728245494, + "narHash": "sha256-bulK/Z+SEJaHM2PPk7W/kRvO51Ag9bTebcaWai9EEJc=", "owner": "nix-community", "repo": "nixvim", - "rev": "2704133fe3ca616b22ed6685cc67180456eb4160", + "rev": "33d030d23c9b88bb29e300d702aade58c3734612", "type": "github" }, "original": { @@ -1201,11 +1211,11 @@ }, "nur": { "locked": { - "lastModified": 1723976478, - "narHash": "sha256-eF815/buOMQlX2XbtNgN3GtA9bwv4psLbckU9iTBsxs=", + "lastModified": 1728282432, + "narHash": "sha256-ftGSLQ5W9Jq8lQa3+ta/v7RtnY3MNwLQ6ybXtLbbLSw=", "owner": "nix-community", "repo": "NUR", - "rev": "575ee4dc4dc7c031663bdcfe2e8779abacc80d0a", + "rev": "baa11edb344e5715eedaeb2a92b6bc5c220a69e4", "type": "github" }, "original": { @@ -1223,11 +1233,11 @@ ] }, "locked": { - "lastModified": 1724584782, - "narHash": "sha256-7FfHv7b1jwMPSu9SPY9hdxStk8E6EeSwzqdvV69U4BM=", + "lastModified": 1728017046, + "narHash": "sha256-ofWYux/uUAv8wq7sWw8XWke0sh8p4qYxSOn8d+EaJ8c=", "owner": "NuschtOS", "repo": "search", - "rev": "5a08d691de30b6fc28d58ce71a5e420f2694e087", + "rev": "ba81d9c1eae20fc3a1cd066062a05ac2e799e629", "type": "github" }, "original": { @@ -1244,11 +1254,11 @@ "nixpkgs-stable": "nixpkgs-stable" }, "locked": { - "lastModified": 1723803910, - "narHash": "sha256-yezvUuFiEnCFbGuwj/bQcqg7RykIEqudOy/RBrId0pc=", + "lastModified": 1728092656, + "narHash": "sha256-eMeCTJZ5xBeQ0f9Os7K8DThNVSo9gy4umZLDfF5q6OM=", "owner": "cachix", "repo": "pre-commit-hooks.nix", - "rev": "bfef0ada09e2c8ac55bbcd0831bd0c9d42e651ba", + "rev": "1211305a5b237771e13fcca0c51e60ad47326a9a", "type": "github" }, "original": { @@ -1260,11 +1270,11 @@ "river": { "flake": false, "locked": { - "lastModified": 1723715391, - "narHash": "sha256-Tc0FYZJsQ/YDFl7czKfsDxTEUr1a0d41MyRrdyhdcjw=", + "lastModified": 1727948541, + "narHash": "sha256-pC8D581CMhh3XCVBbwZ/8woAuD58ilGCrBX4ic5G9Zo=", "ref": "refs/heads/master", - "rev": "f82b2f58163eb092941d7d2e05e1d0eeaa9f50fe", - "revCount": 1293, + "rev": "fd55f51ba1b53af95fe3a24611490d42a895ef98", + "revCount": 1297, "submodules": true, "type": "git", "url": "https://github.com/riverwm/river" @@ -1280,7 +1290,6 @@ "agenix": "agenix", "arkenfox-userjs": "arkenfox-userjs", "asus-touchpad-numpad-driver": "asus-touchpad-numpad-driver", - "avante-nvim": "avante-nvim", "devshell": "devshell", "disko": "disko", "flake-parts": "flake-parts", @@ -1305,11 +1314,11 @@ }, "stable": { "locked": { - "lastModified": 1723688146, - "narHash": "sha256-sqLwJcHYeWLOeP/XoLwAtYjr01TISlkOfz+NG82pbdg=", + "lastModified": 1728193676, + "narHash": "sha256-PbDWAIjKJdlVg+qQRhzdSor04bAPApDqIv2DofTyynk=", "owner": "nixos", "repo": "nixpkgs", - "rev": "c3d4ac725177c030b1e289015989da2ad9d56af0", + "rev": "ecbc1ca8ffd6aea8372ad16be9ebbb39889e55b6", "type": "github" }, "original": { @@ -1422,11 +1431,11 @@ ] }, "locked": { - "lastModified": 1724833132, - "narHash": "sha256-F4djBvyNRAXGusJiNYInqR6zIMI3rvlp6WiKwsRISos=", + "lastModified": 1727984844, + "narHash": "sha256-xpRqITAoD8rHlXQafYZOLvUXCF6cnZkPfoq67ThN0Hc=", "owner": "numtide", "repo": "treefmt-nix", - "rev": "3ffd842a5f50f435d3e603312eefa4790db46af5", + "rev": "4446c7a6fc0775df028c5a3f6727945ba8400e64", "type": "github" }, "original": { @@ -1455,11 +1464,19 @@ }, "xdph": { "inputs": { - "hyprland-protocols": "hyprland-protocols", + "hyprland-protocols": "hyprland-protocols_2", "hyprlang": [ "hyprland", "hyprlang" ], + "hyprutils": [ + "hyprland", + "hyprutils" + ], + "hyprwayland-scanner": [ + "hyprland", + "hyprwayland-scanner" + ], "nixpkgs": [ "hyprland", "nixpkgs" @@ -1470,11 +1487,11 @@ ] }, "locked": { - "lastModified": 1722365976, - "narHash": "sha256-Khdm+mDzYA//XaU0M+hftod+rKr5q9SSHSEuiQ0/9ow=", + "lastModified": 1727524473, + "narHash": "sha256-1DGktDtSWIJpnDbVoj/qpvJSH5zg6JbOfuh6xqZMap0=", "owner": "hyprwm", "repo": "xdg-desktop-portal-hyprland", - "rev": "7f2a77ddf60390248e2a3de2261d7102a13e5341", + "rev": "7e500e679ede40e79cf2d89b5f5fa3e34923bd26", "type": "github" }, "original": { diff --git a/flake.nix b/flake.nix index 23d2119..ec41ffd 100644 --- a/flake.nix +++ b/flake.nix @@ -28,8 +28,6 @@ # Neovim neovim-nightly-overlay.url = "github:nix-community/neovim-nightly-overlay"; - avante-nvim.flake = false; - avante-nvim.url = "github:yetone/avante.nvim"; nixvim.url = "github:nix-community/nixvim"; nixvim.inputs.devshell.follows = "devshell"; diff --git a/hosts/nixos-laptop/default.nix b/hosts/nixos-laptop/default.nix index 0885b5e..10754e9 100644 --- a/hosts/nixos-laptop/default.nix +++ b/hosts/nixos-laptop/default.nix @@ -137,6 +137,7 @@ boot = { supportedFilesystems = [ "zfs" ]; loader.systemd-boot.enable = true; + loader.efi.canTouchEfiVariables = true; }; # SERVICES diff --git a/hosts/nixos-laptop/disko.nix b/hosts/nixos-laptop/disko.nix index 6efc317..86732d7 100644 --- a/hosts/nixos-laptop/disko.nix +++ b/hosts/nixos-laptop/disko.nix @@ -1,4 +1,4 @@ -{ lib, ... }: +{ lib, pkgs, ... }: { # needed for zfs pool @@ -76,9 +76,27 @@ }; }; # rollback to blank - boot.initrd.postDeviceCommands = lib.mkAfter '' - zfs rollback -r zroot/encrypted/root@blank - ''; + boot.initrd.systemd.services.rollback = { + description = "Rollback ZFS datasets to a pristine state"; + wantedBy = [ + "initrd.target" + ]; + after = [ + "zfs-import-zroot.service" + ]; + before = [ + "sysroot.mount" + ]; + path = with pkgs; [ + zfs + ]; + unitConfig.DefaultDependencies = "no"; + serviceConfig.Type = "oneshot"; + script = '' + zfs rollback -r zroot/encrypted/root@blank && echo "rollback complete" + ''; + }; + boot.initrd.systemd.enable = true; fileSystems."/persist".neededForBoot = true; # HACK: to fix issue of agenix running before impermanence age.identityPaths = [ diff --git a/modules/programs/nvim/new_plugins/avante.nix b/modules/programs/nvim/new_plugins/avante.nix index 1bf5c89..0e98bb5 100644 --- a/modules/programs/nvim/new_plugins/avante.nix +++ b/modules/programs/nvim/new_plugins/avante.nix @@ -5,28 +5,32 @@ let in { home-manager.users.moritz.programs.nixvim = { - extraPlugins = [ - (pkgs.vimUtils.buildVimPlugin { - pname = "avante.nvim"; - src = inputs.avante-nvim; - version = lib.my.mkVersionInput inputs.avante-nvim; - }) - pkgs.vimPlugins.nui-nvim + extraPlugins = with pkgs.vimPlugins; [ + nui-nvim + render-markdown-nvim + avante-nvim ]; extraConfigLuaPost = '' + require("render-markdown").setup({ file_types = {"markdown", "Avante"} }) + + require("avante_lib").load() require("avante").setup({ provider = "openai", auto_suggestions_provider = "openai", + behaviour = { + auto_suggestions = true, + }, openai = { + model = "gpt-4o", api_key_name = "cmd:cat /run/agenix/openai" } }) ''; - plugins.copilot-lua.enable = true; - plugins.copilot-lua.suggestion.enabled = false; - plugins.copilot-lua.panel.enabled = false; + # plugins.copilot-lua.enable = true; + # plugins.copilot-lua.suggestion.enabled = false; + # plugins.copilot-lua.panel.enabled = false; plugins.dressing.enable = true; - performance.combinePlugins.standalonePlugins = [ "copilot.lua" ]; + # performance.combinePlugins.standalonePlugins = [ "copilot.lua" ]; }; age.secrets."openai".file = ../../../../secrets/openai.age; age.secrets."openai".owner = "moritz"; diff --git a/modules/programs/nvim/new_plugins/lspsaga.nix b/modules/programs/nvim/new_plugins/lspsaga.nix index 260acdf..6b60349 100644 --- a/modules/programs/nvim/new_plugins/lspsaga.nix +++ b/modules/programs/nvim/new_plugins/lspsaga.nix @@ -5,10 +5,13 @@ let in { home-manager.users.moritz.programs.nixvim = { - plugins.lspsaga = { - enable = true; - codeAction.keys.quit = ""; - lightbulb.virtualText = false; + plugins = { + lspsaga = { + enable = true; + codeAction.keys.quit = ""; + lightbulb.virtualText = false; + }; + web-devicons.enable = true; }; keymapsOnEvents = { LspAttach = [ diff --git a/modules/programs/nvim/new_plugins/other.nix b/modules/programs/nvim/new_plugins/other.nix index ac8ec77..1b5d7c4 100644 --- a/modules/programs/nvim/new_plugins/other.nix +++ b/modules/programs/nvim/new_plugins/other.nix @@ -30,39 +30,42 @@ in } { plugins.oil.enable = true; } { - plugins.telescope = { - enable = true; - extensions.fzf-native.enable = true; - keymaps = { - "ff" = { - action = "find_files"; - options.desc = "Find files"; - }; - "fb" = { - action = "buffers"; - options.desc = "Find buffers"; - }; - "fl" = { - action = "current_buffer_fuzzy_find"; - options.desc = "Search lines"; - }; - "fg" = { - action = "live_grep"; - options.desc = "Live grep"; - }; - "fh" = { - action = "help_tags"; - options.desc = "Help tags"; - }; - "fr" = { - action = "oldfiles"; - options.desc = "Recent files"; + plugins = { + telescope = { + enable = true; + extensions.fzf-native.enable = true; + keymaps = { + "ff" = { + action = "find_files"; + options.desc = "Find files"; + }; + "fb" = { + action = "buffers"; + options.desc = "Find buffers"; + }; + "fl" = { + action = "current_buffer_fuzzy_find"; + options.desc = "Search lines"; + }; + "fg" = { + action = "live_grep"; + options.desc = "Live grep"; + }; + "fh" = { + action = "help_tags"; + options.desc = "Help tags"; + }; + "fr" = { + action = "oldfiles"; + options.desc = "Recent files"; + }; }; }; + web-devicons.enable = true; }; } { plugins.nvim-autopairs.enable = true; } - { plugins.surround.enable = true; } + { plugins.vim-surround.enable = true; } { plugins.lint.enable = true; # TODO: add linters @@ -81,7 +84,6 @@ in { plugins.friendly-snippets.enable = true; } { plugins.direnv.enable = true; } { plugins.crates-nvim.enable = true; } - ]; }; } diff --git a/modules/programs/river/default.nix b/modules/programs/river/default.nix index 858e178..809573e 100644 --- a/modules/programs/river/default.nix +++ b/modules/programs/river/default.nix @@ -138,14 +138,6 @@ in # add waybar as a status bar programs.waybar = { enable = true; - package = pkgs.waybar.overrideAttrs (old: { - patches = old.patches or [ ] ++ [ - (pkgs.fetchpatch { - url = "https://gitlab.archlinux.org/archlinux/packaging/packages/waybar/-/raw/0306af03fcb6de6aee1e288f42b0bf1b223513bd/a544f4b2cdcf632f1a4424b89f6e3d85ef5aaa85.patch"; - sha256 = "sha256-S/1oUj9Aj6BElNTsDY8CTcKtS1j7Gl54JFgCywH05pg="; - }) - ]; - }); # start using systemd service systemd = { From 8376321b37aaf8451fe69bc7a370848d59f03703 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Moritz=20B=C3=B6hme?= Date: Fri, 11 Oct 2024 11:41:19 +0200 Subject: [PATCH 8/9] fix(avante): disable auto_suggestions --- modules/programs/nvim/new_plugins/avante.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/programs/nvim/new_plugins/avante.nix b/modules/programs/nvim/new_plugins/avante.nix index 0e98bb5..d01ed84 100644 --- a/modules/programs/nvim/new_plugins/avante.nix +++ b/modules/programs/nvim/new_plugins/avante.nix @@ -18,7 +18,7 @@ in provider = "openai", auto_suggestions_provider = "openai", behaviour = { - auto_suggestions = true, + -- auto_suggestions = true, }, openai = { model = "gpt-4o", From 985f3b37c181d7f6fe2b553326a0b3952635e5e6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Moritz=20B=C3=B6hme?= Date: Thu, 17 Oct 2024 11:15:24 +0200 Subject: [PATCH 9/9] feat: add elixir lsp --- modules/programs/nvim/new_plugins/lsp.nix | 2 ++ 1 file changed, 2 insertions(+) diff --git a/modules/programs/nvim/new_plugins/lsp.nix b/modules/programs/nvim/new_plugins/lsp.nix index b8cfbeb..403938f 100644 --- a/modules/programs/nvim/new_plugins/lsp.nix +++ b/modules/programs/nvim/new_plugins/lsp.nix @@ -8,6 +8,8 @@ in plugins.lsp = { enable = true; inlayHints = true; + servers.elixirls.enable = true; + servers.nextls.enable = true; servers.nil-ls.enable = true; servers.nixd.enable = true; servers.nixd.extraOptions.settings.nixd = {