diff options
| author | Ellie Huxtable <ellie@atuin.sh> | 2025-04-07 14:15:14 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-04-07 14:15:14 +0100 |
| commit | 2935a5a6bd67fc7e3b685967267f401d42196742 (patch) | |
| tree | 2fa8864211f82b7bde1e8b8a724e4cf3db2d4806 | |
| parent | Revert "Revert "chore: update to rust 1.86 (#2666)" (#2667)" (#2676) (diff) | |
| download | atuin-2935a5a6bd67fc7e3b685967267f401d42196742.zip | |
fix: fish up binding bug (#2677)
Closes: #2672
I think this was introduced in #2616 - typing the literally characters
`u p` lead to opening the TUI, as we were still executing the fish 4
bindings.
| -rw-r--r-- | crates/atuin/src/command/client/init/fish.rs | 20 |
1 files changed, 15 insertions, 5 deletions
diff --git a/crates/atuin/src/command/client/init/fish.rs b/crates/atuin/src/command/client/init/fish.rs index 20b6d774..954a7bd6 100644 --- a/crates/atuin/src/command/client/init/fish.rs +++ b/crates/atuin/src/command/client/init/fish.rs @@ -10,20 +10,30 @@ pub fn init_static(disable_up_arrow: bool, disable_ctrl_r: bool) { // We keep it for compatibility with fish 3.x if std::env::var("ATUIN_NOBIND").is_err() { const BIND_CTRL_R: &str = r"bind \cr _atuin_search"; - const BIND_UP_ARROW: &str = r"bind -k up _atuin_bind_up -bind up _atuin_bind_up -bind \eOA _atuin_bind_up -bind \e\[A _atuin_bind_up"; const BIND_CTRL_R_INS: &str = r"bind -M insert \cr _atuin_search"; const BIND_UP_ARROW_INS: &str = r"bind -M insert -k up _atuin_bind_up bind -M insert \eOA _atuin_bind_up bind -M insert \e\[A _atuin_bind_up"; + let bind_up_arrow = match std::env::var("FISH_VERSION") { + Ok(ref version) if version.starts_with("4.") => r"bind up _atuin_bind_up", + Ok(_) => r"bind -k up _atuin_bind_up", + + // do nothing - we can't panic or error as this could be in use in + // non-fish pipelines + _ => "", + } + .to_string(); + if !disable_ctrl_r { println!("{BIND_CTRL_R}"); } if !disable_up_arrow { - println!("{BIND_UP_ARROW}"); + println!( + r"{bind_up_arrow} +bind \eOA _atuin_bind_up +bind \e\[A _atuin_bind_up" + ); } println!("if bind -M insert > /dev/null 2>&1"); |
