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.
This commit is contained in:
Marty Oehme 2025-11-14 14:02:03 +01:00
parent 26e8cc3ccc
commit b305be8ad0
Signed by: Marty
GPG key ID: 4E535BC19C61886E

View file

@ -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