From b305be8ad0780dd1788e76bfb3b30e29609b39e7 Mon Sep 17 00:00:00 2001 From: Marty Oehme Date: Fri, 14 Nov 2025 14:02:03 +0100 Subject: [PATCH] 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