From 07d36e31324aa4ba0ffa35c07551953c4183f8cb Mon Sep 17 00:00:00 2001 From: Marty Oehme Date: Sat, 18 Oct 2025 12:58:43 +0200 Subject: [PATCH 1/6] starship: Restyle continuation prompt When entering multiline commands, display a slightly more pronounced line prefix so we can recognize faster that it expects more input. --- terminal/.config/starship.toml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/terminal/.config/starship.toml b/terminal/.config/starship.toml index de7e41d..db23219 100644 --- a/terminal/.config/starship.toml +++ b/terminal/.config/starship.toml @@ -26,6 +26,8 @@ $typst\ $package """ +continuation_prompt = "[:::](bright-black) " + [directory] style = "blue" fish_style_pwd_dir_length = 1 From ae5470a5d8e0d740ed5daa4826bbae824ceb902d Mon Sep 17 00:00:00 2001 From: Marty Oehme Date: Sat, 18 Oct 2025 12:58:43 +0200 Subject: [PATCH 2/6] nu: Add fuzzy tab completion, remove nvim hardcoding Removed the buffer editor hardcoding to 'nvim', should use the EDITOR env var instead. Added the (currently undocumented?) config option to enable fuzzy completion matching - essentially enables exactly the behavior the 'fzf-tab-complete' plugin does for zsh, only natively in the nushell program. See: https://github.com/nushell/nushell/issues/1275#issuecomment-2964573062 --- terminal/.config/nushell/config.nu | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/terminal/.config/nushell/config.nu b/terminal/.config/nushell/config.nu index def3a4a..f7521ff 100644 --- a/terminal/.config/nushell/config.nu +++ b/terminal/.config/nushell/config.nu @@ -9,10 +9,11 @@ # # This file is loaded after env.nu and before login.nu # -$env.config.show_banner = false # TODO: FOR TESTING PURPOSES +$env.config.show_banner = false $env.config.edit_mode = "vi" -$env.config.buffer_editor = "nvim" +# Enable same behavior as fzf-tab-complete for zsh +$env.config.completions.algorithm = "fuzzy" $env.PROMPT_INDICATOR = "" $env.PROMPT_MULTILINE_INDICATOR = "::: " @@ -28,7 +29,7 @@ $env.PROMPT_INDICATOR_VI_NORMAL = "" # Temporary workaround $env.config.cursor_shape.vi_insert = "line" $env.config.cursor_shape.vi_normal = "block" -# TODO: Currently recommended starship install. Change when it changes. +# load starship prompt mkdir ($nu.data-dir | path join "vendor/autoload") starship init nu | save -f ($nu.data-dir | path join "vendor/autoload/starship.nu") # load atuin history From 37cc1a3d8350fd22a2b99d54a3e83dde95dc7def Mon Sep 17 00:00:00 2001 From: Marty Oehme Date: Sat, 18 Oct 2025 12:58:43 +0200 Subject: [PATCH 3/6] nu: Enable transient prompt Enabled transient prompt for nushell so we only display the line character and attempt to display command durations for past prompts. Not sure if command duration is working correctly. If not, might have to revert this change. --- terminal/.config/nushell/config.nu | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/terminal/.config/nushell/config.nu b/terminal/.config/nushell/config.nu index f7521ff..2f3484e 100644 --- a/terminal/.config/nushell/config.nu +++ b/terminal/.config/nushell/config.nu @@ -16,7 +16,10 @@ $env.config.edit_mode = "vi" $env.config.completions.algorithm = "fuzzy" $env.PROMPT_INDICATOR = "" -$env.PROMPT_MULTILINE_INDICATOR = "::: " +$env.PROMPT_MULTILINE_INDICATOR = "::: " # overwritten by starship +# enable transient prompt with starship +$env.TRANSIENT_PROMPT_COMMAND = ^starship module character +$env.TRANSIENT_PROMPT_COMMAND_RIGHT = {|| ^starship module cmd_duration } # FIXME: Disabled for now to use starship prompts instead # but still very buggy. See: From 26e8cc3ccc9cd502e6fd898b5b6717938550610f Mon Sep 17 00:00:00 2001 From: Marty Oehme Date: Fri, 14 Nov 2025 14:02:03 +0100 Subject: [PATCH 4/6] nu: Add job control shortcuts Using when a process is running backgrounds it (default behavior) using the new nushell job control system (since v0.103). This change also lets you re-foreground the backgrounded program with the same key mapping. Additionally we add the `fg` alias which does the same and thus mimics the fg command of other shells like zsh. --- terminal/.config/nushell/config.nu | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/terminal/.config/nushell/config.nu b/terminal/.config/nushell/config.nu index 2f3484e..09c26e8 100644 --- a/terminal/.config/nushell/config.nu +++ b/terminal/.config/nushell/config.nu @@ -119,6 +119,17 @@ $env.config.keybindings = [ " } } + # job control + { + name: unfreeze_job + modifier: control + keycode: char_z + mode: ["emacs", "vi_normal", "vi_insert"] + event: { + send: executehostcommand + cmd: "job unfreeze" + } + } ] alias l = ls @@ -131,3 +142,6 @@ def --env mcd [path: path] { } alias v = nvim + +# requires minimum nushell: 0.103 for job control +alias fg = job unfreeze From b305be8ad0780dd1788e76bfb3b30e29609b39e7 Mon Sep 17 00:00:00 2001 From: Marty Oehme Date: Fri, 14 Nov 2025 14:02:03 +0100 Subject: [PATCH 5/6] nu: Add partial auto suggestion completion The suggested history completion on the reedline (i.e. fish-like autosuggestion) can be fully completed with the `l` key in vi cmd mode. This change adds the ability to complete the suggestion partially by completing the current word using `e`. If no history suggestion exists it moves to the end of the current word as usual. This mimics the partial completion I have set up in zsh with the help of the `zsh-autosuggestions` plugin. --- terminal/.config/nushell/config.nu | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/terminal/.config/nushell/config.nu b/terminal/.config/nushell/config.nu index 09c26e8..6413b50 100644 --- a/terminal/.config/nushell/config.nu +++ b/terminal/.config/nushell/config.nu @@ -55,6 +55,7 @@ $env.config.keybindings = [ {send: Enter} ] } + # reedline edits { name: insert_last_token modifier: alt @@ -80,10 +81,23 @@ $env.config.keybindings = [ keycode: char_s mode: [emacs vi_insert vi_normal] event: { - send: executehostcommand + send: ExecuteHostCommand cmd: "let cmd = (commandline); commandline edit (if $cmd starts-with sudo { $cmd | str replace -r '^sudo ' '' } else { 'sudo ' ++ $cmd });" } } + { + name: partial_history_complete + modifier: None + keycode: char_e + mode: [vi_normal] + event: { + until: [ + { send: HistoryHintWordComplete } + { edit: MoveWordRight } + ] + } + } + # file menus { name: run_zoxide modifier: alt From bfecbdcd59c36329c1e32caeb2811fd46cf5ccdd Mon Sep 17 00:00:00 2001 From: Marty Oehme Date: Fri, 14 Nov 2025 14:12:24 +0100 Subject: [PATCH 6/6] nu: Add space prefix to keybind commands to prevent history adding To prevent adding any of the keyboard-binding driven commands to the user's command history, we simply prefix all of them with a single space. --- terminal/.config/nushell/config.nu | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/terminal/.config/nushell/config.nu b/terminal/.config/nushell/config.nu index 6413b50..36173e5 100644 --- a/terminal/.config/nushell/config.nu +++ b/terminal/.config/nushell/config.nu @@ -82,7 +82,7 @@ $env.config.keybindings = [ mode: [emacs vi_insert vi_normal] event: { send: ExecuteHostCommand - cmd: "let cmd = (commandline); commandline edit (if $cmd starts-with sudo { $cmd | str replace -r '^sudo ' '' } else { 'sudo ' ++ $cmd });" + cmd: " let cmd = (commandline); commandline edit (if $cmd starts-with sudo { $cmd | str replace -r '^sudo ' '' } else { 'sudo ' ++ $cmd });" } } { @@ -105,7 +105,7 @@ $env.config.keybindings = [ mode: ["emacs", "vi_normal", "vi_insert"] event: { send: executehostcommand - cmd: "zoxide query --interactive" + cmd: " zoxide query --interactive" } } { @@ -115,7 +115,7 @@ $env.config.keybindings = [ mode: [ "vi_normal"] event: { send: executehostcommand - cmd: "zoxide query --interactive" + cmd: " zoxide query --interactive" } } { @@ -125,7 +125,8 @@ $env.config.keybindings = [ mode: ["emacs", "vi_normal", "vi_insert"] event: { send: executehostcommand - cmd: " + # intentional eol space to prevent adding cmd to history + cmd: " let fzf_ctrl_t_command = \$\"fd --type file --hidden | fzf --preview 'bat --color=always --style=full --line-range=:500 {}' \"; let result = nu -l -i -c $fzf_ctrl_t_command; commandline edit --append $result;