From 5518f1ca35c206ccdd21f97395ec1bbd13df927c Mon Sep 17 00:00:00 2001 From: muon Date: Sun, 8 Mar 2026 15:31:23 +0000 Subject: [PATCH] Add atuin to nushell --- modules/home/terminal/nushell.nix | 64 +++++++++++++++++-------------- modules/home/terminal/tools.nix | 1 + 2 files changed, 37 insertions(+), 28 deletions(-) diff --git a/modules/home/terminal/nushell.nix b/modules/home/terminal/nushell.nix index b7e38d1..dbdab6d 100644 --- a/modules/home/terminal/nushell.nix +++ b/modules/home/terminal/nushell.nix @@ -23,35 +23,43 @@ in { shellAliases = aliases; - # vi mode + sensible defaults - extraConfig = '' - $env.config = { - show_banner: false - edit_mode: vi + # vi mode + sensible defaults via flat assignments (avoids clobbering other modules) + settings = { + show_banner = false; + edit_mode = "vi"; + cursor_shape = { + vi_insert = "line"; + vi_normal = "block"; + }; + history = { + max_size = 2097152; + sync_on_enter = true; + file_format = "sqlite"; + isolation = false; + }; + completions = { + case_sensitive = false; + quick = true; + partial = true; + algorithm = "fuzzy"; + }; + table.mode = "rounded"; + }; - cursor_shape: { - vi_insert: line - vi_normal: block - } - - history: { - max_size: 2097152 - sync_on_enter: true - file_format: "sqlite" - isolation: false - } - - completions: { - case_sensitive: false - quick: true - partial: true - algorithm: "fuzzy" - } - - table: { - mode: rounded - } - } + # Append the / keybinding after all integrations (including atuin) are sourced, + # so _atuin_search_cmd is defined when this runs. + extraConfig = lib.mkAfter '' + $env.config = ( + $env.config | upsert keybindings ( + $env.config.keybindings | append { + name: atuin_search_vi_normal + modifier: none + keycode: char_/ + mode: vi_normal + event: { send: executehostcommand cmd: (_atuin_search_cmd) } + } + ) + ) ''; # Carry over zsh session variables diff --git a/modules/home/terminal/tools.nix b/modules/home/terminal/tools.nix index b3c00dd..88b4745 100644 --- a/modules/home/terminal/tools.nix +++ b/modules/home/terminal/tools.nix @@ -42,6 +42,7 @@ in atuin = { enable = true; enableZshIntegration = true; + enableNushellIntegration = true; flags = ["--disable-up-arrow"]; settings = { sync_frequency = "5m";