feat(shell)!: bind the Atuin search to "/" in vi-normal mode (#1629)

A search feature in the vi-normal mode of shells can be called by "/".
To make the shell-integration keybindings consistent with the existing
shell keybindings, we add the keybinding to "/" in this patch.

This patch removes the Ctrl-r binding in the "vicmd" keymap in Zsh.
The key Ctrl-r is used for the `redo` operation in the vi-normal mode
by default.  We would like to avoid overwriting an existing keybinding
with a totally different feature.
This commit is contained in:
Koichi Murase 2024-01-26 20:48:00 +09:00 committed by GitHub
parent 230bf2d1c6
commit 2e48e21692
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 3 additions and 2 deletions

View File

@ -33,8 +33,8 @@ impl Cmd {
if std::env::var("ATUIN_NOBIND").is_err() { if std::env::var("ATUIN_NOBIND").is_err() {
const BIND_CTRL_R: &str = r"bindkey -M emacs '^r' _atuin_search_widget const BIND_CTRL_R: &str = r"bindkey -M emacs '^r' _atuin_search_widget
bindkey -M vicmd '^r' _atuin_search_vicmd_widget bindkey -M viins '^r' _atuin_search_viins_widget
bindkey -M viins '^r' _atuin_search_viins_widget"; bindkey -M vicmd '/' _atuin_search_widget";
const BIND_UP_ARROW: &str = r"bindkey -M emacs '^[[A' _atuin_up_search_widget const BIND_UP_ARROW: &str = r"bindkey -M emacs '^[[A' _atuin_up_search_widget
bindkey -M vicmd '^[[A' _atuin_up_search_vicmd_widget bindkey -M vicmd '^[[A' _atuin_up_search_vicmd_widget

View File

@ -244,6 +244,7 @@ if [[ $__atuin_bind_ctrl_r == true ]]; then
# the vi_nmap keymap in ble.sh. # the vi_nmap keymap in ble.sh.
bind -m emacs -x '"\C-r": __atuin_history --keymap-mode=emacs' bind -m emacs -x '"\C-r": __atuin_history --keymap-mode=emacs'
bind -m vi-insert -x '"\C-r": __atuin_history --keymap-mode=vim-insert' bind -m vi-insert -x '"\C-r": __atuin_history --keymap-mode=vim-insert'
bind -m vi-command -x '"/": __atuin_history --keymap-mode=emacs'
fi fi
# shellcheck disable=SC2154 # shellcheck disable=SC2154