fix(nu): disable the up-arrow keybinding for Nushell (#1329)

This commit is contained in:
Patrick Jackson 2023-10-26 00:42:46 -06:00 committed by GitHub
parent ce4573c5ee
commit 1a20afe245
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 18 additions and 14 deletions

View file

@ -109,20 +109,22 @@ bind -M insert \e\[A _atuin_bind_up";
event: { send: executehostcommand cmd: (_atuin_search_cmd) } event: { send: executehostcommand cmd: (_atuin_search_cmd) }
} }
) )
) )"#;
"#; const BIND_UP_ARROW: &str = r#"
const BIND_UP_ARROW: &str = r#"$env.config = ( # The up arrow keybinding has surprising behavior in Nu, and is disabled by default.
$env.config | upsert keybindings ( # See https://github.com/atuinsh/atuin/issues/1025 for details
$env.config.keybindings # $env.config = (
| append { # $env.config | upsert keybindings (
name: atuin # $env.config.keybindings
modifier: none # | append {
keycode: up # name: atuin
mode: [emacs, vi_normal, vi_insert] # modifier: none
event: { send: executehostcommand cmd: (_atuin_search_cmd '--shell-up-key-binding') } # keycode: up
} # mode: [emacs, vi_normal, vi_insert]
) # event: { send: executehostcommand cmd: (_atuin_search_cmd '--shell-up-key-binding') }
) # }
# )
# )
"#; "#;
if !self.disable_ctrl_r { if !self.disable_ctrl_r {
println!("{BIND_CTRL_R}"); println!("{BIND_CTRL_R}");

View file

@ -50,6 +50,8 @@ eval "$(atuin init zsh)"
You can then choose to bind Atuin if needed, do this after the call to init. 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.
## <kbd>Ctrl-n</kbd> key shortcuts ## <kbd>Ctrl-n</kbd> key shortcuts
macOS does not have an <kbd>Alt</kbd> key, although terminal emulators can often be configured to map the <kbd>Option</kbd> key to be used as <kbd>Alt</kbd>. *However*, remapping <kbd>Option</kbd> this way may prevent typing some characters, such as using <kbd>Option-3</kbd> 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 <kbd>Alt-0</kbd> to <kbd>Alt-9</kbd> shortcuts with <kbd>Ctrl-0</kbd> to <kbd>Ctrl-9</kbd> instead: macOS does not have an <kbd>Alt</kbd> key, although terminal emulators can often be configured to map the <kbd>Option</kbd> key to be used as <kbd>Alt</kbd>. *However*, remapping <kbd>Option</kbd> this way may prevent typing some characters, such as using <kbd>Option-3</kbd> 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 <kbd>Alt-0</kbd> to <kbd>Alt-9</kbd> shortcuts with <kbd>Ctrl-0</kbd> to <kbd>Ctrl-9</kbd> instead: