Get most of HSTR by configuring it with:
hh --show-configuration >> ~/.bashrcRun hh --show-configuration to determine what will be appended to your Bash profile.
For more configuration options details please refer to:
- bind
hhcommand to a keyboard shortcut - get more colors
- choose default history view
- command blacklist
- verbosity
- Bash history settings
- zsh history settings
Check also configuration examples.
Bash uses Emacs style keyboard shortcuts by default. There is also Vi mode. Find out how to bind HSTR to a keyboard shortcut based on the style you prefer below.
Check your active Bash keymap with:
bind -v | grep editing-mode
bind -v | grep keymapTo determine character sequence emitted by a pressed key in terminal, type Ctrl-v and then press the key. Check your current bindings using:
bind -SBind hh to a Bash key e.g. to Ctrl-r:
bind '"\C-r": "\C-ahh -- \C-j"'or Ctrl-Alt-r:
bind '"\e\C-r":"\C-ahh -- \C-j"'or Ctrl-F12:
bind '"\e[24;5~":"\C-ahh -- \C-j"'Bind hh to Ctrl-r only if it is interactive shell:
if [[ $- =~ .*i.* ]]; then bind '"\C-r": "\C-a hh -- \C-j"'; fiBind hh to a Bash key e.g. to Ctrl-r:
bind '"\C-r": "\C-ahh -- \C-j"'Bind hh to a Zsh key e.g. to Ctrl-r:
bindkey -s "\C-r" "\eqhh --\n"Get hh in more colors:
export HH_CONFIG=hicoloror ensure black and white mode:
export HH_CONFIG=monochromaticShow normal history by default (instead of metrics-based view):
export HH_CONFIG=rawhistoryShow favorite commands by default (instead of metrics-based view):
export HH_CONFIG=favoritesFlip the view so the prompt is at the bottom:
export HH_CONFIG=prompt-bottomChoose a minimal layout (currently this just removes the help bar):
export HH_CONFIG=minimalMake search case sensitive (insensitive by default):
export HH_CONFIG=casesensitiveKeep duplicates in rawhistory view (duplicates discarded by default):
export HH_CONFIG=duplicatesSkip commands when processing history i.e. make sure that these commands will not be shown in any view:
export HH_CONFIG=blacklistCommands to be stored in ~/.hh_blacklist file with trailing empty line. For instance:
cd
my-private-command
ls
ll
Show warnings:
export HH_CONFIG=warningShow debug messages:
export HH_CONFIG=debugUse the following BASH settings to get most out of hh.
Increase the size of history maintained by BASH - variables defined below increase the number of history items and history file size (default value is 500):
export HISTFILESIZE=10000
export HISTSIZE=${HISTFILESIZE}Ensure syncing (flushing and reloading) of .bash_history with in-memory
history:
export PROMPT_COMMAND="history -a; history -n; ${PROMPT_COMMAND}"Force appending of in-memory history to .bash_history
(instead of overwriting):
shopt -s histappendUse leading space to hide commands from history:
export HISTCONTROL=ignorespaceSuitable for a sensitive information like passwords.
If you use zsh, set HISTFILE environment variable in ~/.zshrc:
export HISTFILE=~/.zsh_history
More colors with case sensitive search of history:
export HH_CONFIG=hicolor,casesensitiveFavorite commands view in black and white:
export HH_CONFIG=favorites,monochromaticKeywords based search in colors with debug mode verbosity:
export HH_CONFIG=keywords,hicolor,debug