jimhester / per-directory-history

Per directory history for zsh, as well as global history, and the ability to toggle between them with ^G.
zlib License
259 stars 36 forks source link

Setting various keybindings after sourcing per-directory-history causes toggle command keybinding to not work #51

Open life5ign opened 10 months ago

life5ign commented 10 months ago

To reproduce:
Install per-directory-history as ohmyzsh plugin, or as directed in this repo.

set the following (not that exotic) keybindings after sourcing per-directory-history, including setting vi mode:

# ============================================================================
# KEYBINDINGS
# ============================================================================
# Set vi mode
bindkey -v

# command line editor keybindings
autoload -z edit-command-line; zle -N edit-command-line
# edit a command in a vim editor while in CLI vi insert mode with "Ctrl+e"
bindkey '^e' edit-command-line
# edit a command in a vim editor while in CLI vi command mode with "v"
bindkey -M vicmd v edit-command-line

# Use vim keys in tab complete menu:
# this is in the "menuselect" keymap
bindkey -M menuselect 'h' vi-backward-char
bindkey -M menuselect 'k' vi-up-line-or-history
bindkey -M menuselect 'l' vi-forward-char
bindkey -M menuselect 'j' vi-down-line-or-history

# keybindings in default keymap
bindkey '^P' up-history
bindkey '^N' down-history
bindkey '^r' history-incremental-search-backward
# very useful: start going back the other way in a reverse incremental, in case
# you just passed your desired command, or want to start going back down towards more 
# recently entered items
bindkey '^s' history-incremental-search-forward

Observe that ^G fails to toggle directory/global history mode (history is still being saved per directory, though)

Comment out each line of the above out individually, and observe that if still fails.

Next, define the above bindings before per-directory-history, and observe that per-directory-history toggle works.