diff options
author | Koichi Murase <myoga.murase@gmail.com> | 2024-01-26 20:48:00 +0900 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-01-26 11:48:00 +0000 |
commit | 2e48e21692491baadb5dbe04159a793e8775b33c (patch) | |
tree | 95a382b05c70101406967bdfd479fbb103569012 | |
parent | 230bf2d1c63b818d09f6da04d23e03d20019e40a (diff) |
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.
-rw-r--r-- | atuin/src/command/init.rs | 4 | ||||
-rw-r--r-- | atuin/src/shell/atuin.bash | 1 |
2 files changed, 3 insertions, 2 deletions
diff --git a/atuin/src/command/init.rs b/atuin/src/command/init.rs index ba501181..2d4b0e51 100644 --- a/atuin/src/command/init.rs +++ b/atuin/src/command/init.rs @@ -33,8 +33,8 @@ impl Cmd { if std::env::var("ATUIN_NOBIND").is_err() { 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 bindkey -M vicmd '^[[A' _atuin_up_search_vicmd_widget diff --git a/atuin/src/shell/atuin.bash b/atuin/src/shell/atuin.bash index bf5f4481..5feb6d12 100644 --- a/atuin/src/shell/atuin.bash +++ b/atuin/src/shell/atuin.bash @@ -244,6 +244,7 @@ if [[ $__atuin_bind_ctrl_r == true ]]; then # the vi_nmap keymap in ble.sh. 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-command -x '"/": __atuin_history --keymap-mode=emacs' fi # shellcheck disable=SC2154 |