A per directory history for zsh.
zsh-directory-history is a zsh plugin giving you a history which is sensitive to the directory you are in.
It implements forward/backward navigation as well as substring search in a directory sensitive manner.
Since zsh-directory-history includes zsh-history-substring-search, do not load zsh-history-substring-search when loading this plugin.
Since the plugin creates its own history (in
~/.directory_history), it needs some time to fill up and become useful.
git clone https://github.com/tymm/zsh-directory-history sudo cp zsh-directory-history/dirhist /usr/bin/
Activate plugin by appending the following line to your .zshrc file
Bind keyboard shortcuts in your .zshrc
directory-history-search-backward needs to be bind for forward/backward navigation.
history-substring-search-down needs to be bind for substring search.
# Bind up/down arrow keys to navigate through your history bindkey '\e[A' directory-history-search-backward bindkey '\e[B' directory-history-search-forward # Bind CTRL+k and CTRL+j to substring search bindkey '^j' history-substring-search-up bindkey '^k' history-substring-search-down
It is possible that \e[A and \e[B will not work for you. Look here under 2. for more information.
For more information on how to configure substring search, take a look here: https://github.com/zsh-users/zsh-history-substring-search