From 1a20afe2458b7cb146b3bbe2be866bb67ce86a33 Mon Sep 17 00:00:00 2001 From: Patrick Jackson Date: Thu, 26 Oct 2023 00:42:46 -0600 Subject: [PATCH] fix(nu): disable the up-arrow keybinding for Nushell (#1329) --- atuin/src/command/init.rs | 30 ++++++++++++++++-------------- docs/docs/key-binding.md | 2 ++ 2 files changed, 18 insertions(+), 14 deletions(-) diff --git a/atuin/src/command/init.rs b/atuin/src/command/init.rs index 880fcf8..b2fb7f1 100644 --- a/atuin/src/command/init.rs +++ b/atuin/src/command/init.rs @@ -109,20 +109,22 @@ bind -M insert \e\[A _atuin_bind_up"; event: { send: executehostcommand cmd: (_atuin_search_cmd) } } ) -) -"#; - const BIND_UP_ARROW: &str = r#"$env.config = ( - $env.config | upsert keybindings ( - $env.config.keybindings - | append { - name: atuin - modifier: none - keycode: up - mode: [emacs, vi_normal, vi_insert] - event: { send: executehostcommand cmd: (_atuin_search_cmd '--shell-up-key-binding') } - } - ) -) +)"#; + const BIND_UP_ARROW: &str = r#" +# The up arrow keybinding has surprising behavior in Nu, and is disabled by default. +# See https://github.com/atuinsh/atuin/issues/1025 for details +# $env.config = ( +# $env.config | upsert keybindings ( +# $env.config.keybindings +# | append { +# name: atuin +# modifier: none +# keycode: up +# mode: [emacs, vi_normal, vi_insert] +# event: { send: executehostcommand cmd: (_atuin_search_cmd '--shell-up-key-binding') } +# } +# ) +# ) "#; if !self.disable_ctrl_r { println!("{BIND_CTRL_R}"); diff --git a/docs/docs/key-binding.md b/docs/docs/key-binding.md index f4deba2..02d00d5 100644 --- a/docs/docs/key-binding.md +++ b/docs/docs/key-binding.md @@ -50,6 +50,8 @@ eval "$(atuin init zsh)" You can then choose to bind Atuin if needed, do this after the call to init. +**Nushell Only**: The up-arrow keybinding is disabled by default for Nushell until [#1025](https://github.com/atuinsh/atuin/issues/1025) is resolved. + ## Ctrl-n key shortcuts macOS does not have an Alt key, although terminal emulators can often be configured to map the Option key to be used as Alt. *However*, remapping Option this way may prevent typing some characters, such as using Option-3 to type `#` on the British English layout. For such a scenario, set the `ctrl_n_shortcuts` option to `true` in your config file to replace Alt-0 to Alt-9 shortcuts with Ctrl-0 to Ctrl-9 instead: