jeffreytse / zsh-vi-mode

💻 A better and friendly vi(vim) mode plugin for ZSH.
MIT License
3.31k stars 113 forks source link

Support enabling/disabling key mappings #301

Open hcgatewood opened 5 days ago

hcgatewood commented 5 days ago

General information

- Terminal program: iTerm.app 3.5.9 (xterm-256color)
- Operating system: macOS 14.7.1 (23H222)
- ZSH framework: oh-my-zsh master (7ed475cb)
- ZSH version: zsh 5.9 (x86_64-apple-darwin23.0)
- ZVM version: zsh-vi-mode 0.11.0 

Basic examination

Problem description

I have the following zsh keymappings, which are overridden by this plugin due to its lazy loading. I would like to keep the lazy loading on for startup time's sake, so I would like a config option to disable the plugin's default ctrl-n/ctrl-p keybindings.

# Better forward/backward search
bindkey "^[[A" up-line-or-beginning-search
bindkey "^[[B" down-line-or-beginning-search
bindkey "^p" up-line-or-beginning-search
bindkey "^n" down-line-or-beginning-search

Reproduction steps

  1. Type some prefix to a previous command
  2. Hit ctrl-p
  3. Observe that the chosen history command is just "most recent", not "most recent matching prefix"

Expected behavior

I would like to be able to disable the plugin's ctrl-p/ctrl-n keybindings, such that the "most recent matching prefix" works as expected