A CLI to provide enhanced history for your shell
A CLI to provide enhanced history for your shell
Get binaries
go get -u github.com/b4b4r07/history
(Additional) if you're zsh user, it's better to intergrate your shell
$ git clone https://github.com/b4b4r07/history && cd history
$ source misc/zsh/init.zsh
You should specify some enviroment variables for using this tool.
You can set keybind for getting history.
Example:
export ZSH_HISTORY_KEYBIND_GET="^r"
export ZSH_HISTORY_FILTER_OPTIONS="--filter-branch --filter-dir"
In fact, when you invoke that keybind (in this example, ^r
), the following command will be executed and supplemented to your ZLE (on shell).
command history search $ZSH_HISTORY_FILTER_OPTIONS --query "$LBUFFER"
If you set ZSH_HISTORY_FILTER_OPTIONS
like above, it's equals to $ZSH_HISTORY_KEYBIND_GET
's function behavior.
It should be set history search
option. See also command history help search
.
It's equals to $ZSH_HISTORY_KEYBIND_GET
with ZSH_HISTORY_FILTER_OPTIONS="--filter-branch --filter-dir"
.
Ignore ZSH_HISTORY_FILTER_OPTIONS
and search all history.
Example:
export ZSH_HISTORY_KEYBIND_GET_ALL="^r^a"
Specify the screen column when displaying with ZSH_HISTORY_KEYBIND_GET_ALL
Defaults to "{{.Time}},{{.Status}},{{.Command}},({{.Base}}:{{.Branch}})"
Example:
export ZSH_HISTORY_KEYBIND_ARROW_UP="^p"
Example:
export ZSH_HISTORY_KEYBIND_ARROW_DOWN="^n"
Example:
export ZSH_HISTORY_AUTO_SYNC=true
If you set sync option (for more datail, see and run history config
)
Example:
export ZSH_HISTORY_AUTO_SYNC_INTERVAL="1h"
Anyway, if you want to use it immediately please copy and paste the following into your zshrc
:
alias hs="command history" # as you like
ZSH_HISTORY_KEYBIND_GET="^r"
ZSH_HISTORY_FILTER_OPTIONS="--filter-branch --filter-dir"
ZSH_HISTORY_KEYBIND_ARROW_UP="^p"
ZSH_HISTORY_KEYBIND_ARROW_DOWN="^n"
and invoke that zle function with typing Ctrl-R after reloading your zsh, of cource ;)
For more info and customization, see also wiki pages in this project:
https://github.com/b4b4r07/history/wiki
MIT
b4b4r07