From 6fd42a30b011f2bf674db463493fb9ad78b7cbee Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thea=20Sch=C3=B6bl?= Date: Wed, 1 Jul 2026 16:08:27 +0200 Subject: [PATCH] feat: auto-session feat: vim ui2 feat: harpoon feat: nvim changes --- .../modules/nixvim/auto-session.nix | 49 ++++++++++ .../home-manager/modules/nixvim/base/tree.nix | 13 +-- .../home-manager/modules/nixvim/default.nix | 1 + .../home-manager/modules/nixvim/harpoon.nix | 91 +++++++++++-------- .../home-manager/modules/nixvim/lazygit.nix | 1 + modules/home-manager/programs/nixvim.nix | 20 ++-- modules/nixos/desktops/hyprland.nix | 2 +- modules/nixos/desktops/niri.nix | 2 +- 8 files changed, 118 insertions(+), 61 deletions(-) create mode 100644 modules/home-manager/modules/nixvim/auto-session.nix diff --git a/modules/home-manager/modules/nixvim/auto-session.nix b/modules/home-manager/modules/nixvim/auto-session.nix new file mode 100644 index 0000000..40bfa0a --- /dev/null +++ b/modules/home-manager/modules/nixvim/auto-session.nix @@ -0,0 +1,49 @@ +{ lib, config, ... }: +let + cfg = config.presets.auto-session; +in +{ + options.presets.auto-session = { + enable = lib.mkEnableOption "auto session"; + }; + + config = lib.mkIf cfg.enable { + opts.sessionoptions = lib.mkDefault ( + lib.strings.concatStringsSep "," [ + "blank" + "buffers" + "curdir" + "folds" + "help" + "tabpages" + "winsize" + "winpos" + "terminal" + "localoptions" + ] + ); + + plugins = { + auto-session = { + enable = lib.mkDefault true; + settings = { + cwd_change_handling = lib.mkDefault true; + lazy_support = false; + show_auto_restore_notif = true; + bypass_save_filetypes = [ "neo-tree" ]; + }; + }; + lz-n.enable = true; + neo-tree.lazyLoad = { + enable = true; + settings.cmd = "Neotree"; + }; + fidget.lazyLoad = { + enable = true; + settings = { + event = [ "LspAttach" ]; + }; + }; + }; + }; +} diff --git a/modules/home-manager/modules/nixvim/base/tree.nix b/modules/home-manager/modules/nixvim/base/tree.nix index 1a347b9..5c6d1d6 100644 --- a/modules/home-manager/modules/nixvim/base/tree.nix +++ b/modules/home-manager/modules/nixvim/base/tree.nix @@ -21,22 +21,13 @@ in neo-tree = { enable = true; settings = { - event_handlers = [ - { - event = "neo_tree_buffer_leave"; - handler.__raw = '' - function() - require('neo-tree').close_all() - end - ''; - } - ]; + window.position = "float"; filesystem = { use_libuv_file_watcher = true; follow_current_file.enabled = true; filtered_items.visible = true; }; - popupBorderStyle = "rounded"; + popup_border_style = ""; }; }; which-key.settings.spec = [ diff --git a/modules/home-manager/modules/nixvim/default.nix b/modules/home-manager/modules/nixvim/default.nix index af42ce7..53bed30 100644 --- a/modules/home-manager/modules/nixvim/default.nix +++ b/modules/home-manager/modules/nixvim/default.nix @@ -17,6 +17,7 @@ ./aerial.nix ./auto-save.nix + ./auto-session.nix ./auto-format.nix ./harpoon.nix ./mergetool.nix diff --git a/modules/home-manager/modules/nixvim/harpoon.nix b/modules/home-manager/modules/nixvim/harpoon.nix index 891c668..b5fed89 100644 --- a/modules/home-manager/modules/nixvim/harpoon.nix +++ b/modules/home-manager/modules/nixvim/harpoon.nix @@ -10,49 +10,60 @@ in config = lib.mkIf cfg.enable { keymaps = [ { - key = "hh"; + key = "m"; mode = "n"; - action = ":Telescope harpoon marks"; + action.__raw = '' + function() require("harpoon"):list():add() end + ''; + options.desc = "Mark"; + } + { + key = ""; + mode = "n"; + action.__raw = '' + function() + local harpoon = require("harpoon") + local conf = require("telescope.config").values + + local harpoon_files = harpoon:list() + + local file_paths = {} + for _, item in ipairs(harpoon_files.items) do + table.insert(file_paths, item.value) + end + + require("telescope.pickers").new({}, { + prompt_title = "Harpoon", + finder = require("telescope.finders").new_table({ + results = file_paths, + }), + previewer = conf.file_previewer({}), + sorter = conf.generic_sorter({}), + }):find() + end + ''; + options.desc = "Harpoon List"; + } + { + key = ""; + mode = "n"; + action.__raw = '' + function() require("harpoon"):list():next() end + ''; + options.desc = "Harpoon Next"; + } + { + key = ""; + mode = "n"; + action.__raw = '' + function() require("harpoon"):list():prev() end + ''; + options.desc = "Harpoon Prev"; } ]; - plugins = { - telescope.enable = true; - harpoon = { - enable = true; - enableTelescope = true; - keymaps = { - addFile = "hm"; - navNext = "hn"; - navPrev = "hp"; - }; - }; - which-key.settings.spec = [ - { - __unkeyed-1 = "h"; - group = "Harpoon"; - icon = "󱀺"; - } - { - __unkeyed-1 = "hh"; - desc = "Marks"; - icon = "󰈢"; - } - { - __unkeyed-1 = "hm"; - desc = "Add File"; - icon = "󱪝"; - } - { - __unkeyed-1 = "hn"; - desc = "Next"; - icon = ""; - } - { - __unkeyed-1 = "hp"; - desc = "Prev"; - icon = ""; - } - ]; + plugins.harpoon = { + enable = true; + enableTelescope = true; }; }; } diff --git a/modules/home-manager/modules/nixvim/lazygit.nix b/modules/home-manager/modules/nixvim/lazygit.nix index d6bce55..91bceaf 100644 --- a/modules/home-manager/modules/nixvim/lazygit.nix +++ b/modules/home-manager/modules/nixvim/lazygit.nix @@ -64,6 +64,7 @@ in settings = { direction = lib.mkDefault "vertical"; size = lib.mkDefault 60; + float_opts.border = config.opts.winborder; }; }; diff --git a/modules/home-manager/programs/nixvim.nix b/modules/home-manager/programs/nixvim.nix index f12fda1..b03d83d 100644 --- a/modules/home-manager/programs/nixvim.nix +++ b/modules/home-manager/programs/nixvim.nix @@ -6,10 +6,16 @@ vimAlias = true; nixpkgs.useGlobalPackages = true; + extraConfigLuaPre = '' + require('vim._core.ui2').enable() + ''; + opts = { number = true; relativenumber = true; + cmdheight = 0; + tabstop = 2; softtabstop = 2; shiftwidth = 2; @@ -28,6 +34,9 @@ updatetime = 50; fillchars.eob = " "; + + winborder = "solid"; + pumborder = "solid"; }; clipboard = { register = "unnamedplus"; @@ -37,11 +46,13 @@ presets = { auto-save.enable = true; + auto-session.enable = true; auto-format.enable = true; lazygit.enable = true; mergetool.enable = true; undotree.enable = true; aerial.enable = true; + harpoon.enable = true; base = { completion = { enable = true; @@ -55,7 +66,7 @@ enable = true; prettier = true; }; - leap.enable = false; + leap.enable = true; spellcheck.enable = true; status-line.enable = true; syntax.enable = true; @@ -103,13 +114,6 @@ enable = false; # TODO: looks weird with Neovide settings.line_numbers = false; }; - auto-session = { - enable = true; - settings = { - cwd_change_handling = true; - use_git_branch = true; - }; - }; lsp.servers = { html.enable = true; diff --git a/modules/nixos/desktops/hyprland.nix b/modules/nixos/desktops/hyprland.nix index 706b842..9a3d273 100644 --- a/modules/nixos/desktops/hyprland.nix +++ b/modules/nixos/desktops/hyprland.nix @@ -90,7 +90,7 @@ in services = { kmscon = { enable = true; - hwaccel = true; + config.hwaccel = true; }; greetd = { enable = true; diff --git a/modules/nixos/desktops/niri.nix b/modules/nixos/desktops/niri.nix index 8d6572b..271ddea 100644 --- a/modules/nixos/desktops/niri.nix +++ b/modules/nixos/desktops/niri.nix @@ -137,7 +137,7 @@ in services = { kmscon = { enable = true; - hwaccel = true; + config.hwaccel = true; }; greetd = { enable = true;