{ pkgs, lib, config, ... }: let cfg = config.mods.terminal; aliases = { la = "ls -la"; ".." = "cd .."; "..." = "cd ../.."; "...." = "cd ../../.."; "....." = "cd ../../../.."; "......" = "cd ../../../../.."; }; in { options.mods.terminal.nushell.enable = lib.mkEnableOption "enables nushell"; config = lib.mkIf cfg.nushell.enable { programs.nushell = { enable = true; shellAliases = aliases; # 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"; }; # 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 extraEnv = lib.optionalString config.mods.terminal.development.enable '' $env.EDITOR = "nvim" ''; }; # Starship prompt (same as zsh) programs.starship.enable = true; # direnv nushell integration programs.direnv = lib.mkIf config.mods.terminal.development.enable { enableNushellIntegration = true; }; }; }