diff --git a/share/functions/fish_vi_key_bindings.fish b/share/functions/fish_vi_key_bindings.fish index 6463ff3e9..844376637 100644 --- a/share/functions/fish_vi_key_bindings.fish +++ b/share/functions/fish_vi_key_bindings.fish @@ -204,7 +204,7 @@ function fish_vi_key_bindings --description 'vi-like key bindings for fish' bind -s --preset K 'man (commandline -t) 2>/dev/null; or echo -n \a' bind -s --preset yy kill-whole-line yank - for seq in '",*,y,y' '",*,Y' '"+,y,y' '",+,Y' + for seq in '",*,y,y' '",*,Y' '",+,y,y' '",+,Y' bind -s --preset $seq fish_clipboard_copy end bind -s --preset Y kill-whole-line yank diff --git a/src/key.rs b/src/key.rs index bdd413dc6..5359e24e9 100644 --- a/src/key.rs +++ b/src/key.rs @@ -265,7 +265,7 @@ pub(crate) fn parse_keys(value: &wstr) -> Result, WString> { _ if modifier == "shift" => modifiers.shift = true, _ => { return Err(wgettext_fmt!( - "unknown modififer '%s' in '%s'", + "unknown modifier '%s' in '%s'", modifier, full_key_name )) @@ -431,7 +431,7 @@ fn ctrl_to_symbol(buf: &mut WString, c: char) { /// Return true if the character must be escaped when used in the sequence of chars to be bound in /// a `bind` command. fn must_escape(c: char) -> bool { - "[]()<>{}*\\?$#;&|'\"".contains(c) + "~[]()<>{}*\\?$#;&|'\"".contains(c) } fn ascii_printable_to_symbol(buf: &mut WString, c: char) { diff --git a/tests/checks/bind.fish b/tests/checks/bind.fish index 129bbd52f..2b5c35bc6 100644 --- a/tests/checks/bind.fish +++ b/tests/checks/bind.fish @@ -1,4 +1,23 @@ #RUN: %fish %s | %filter-ctrlseqs +#REQUIRES: command -v diff + +set -l fish (status fish-path) + +set -l tmpdir (mktemp -d) +for bindings in true fish_default_key_bindings fish_vi_key_bindings + $fish -c " + $bindings + bind > $tmpdir/old + bind --erase --all --preset + bind --erase --all + source $tmpdir/old + bind >$tmpdir/new + diff -u $tmpdir/{old,new} + " +end +echo >&2 bind output evaluation works +# CHECKERR: bind output evaluation works + # Test various `bind` command invocations. This is meant to verify that # invalid flags, mode names, etc. are caught as well as to verify that valid # ones are allowed.