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