hstr/CONFIGURATION.md
2015-01-07 22:36:50 +01:00

1.9 KiB

CONFIGURATION EXPLANATION

hh works best with the optional configuration described in this section. You can configure hh just by running:

hh --show-configuration >> ~/.bashrc

CONFIGURATION OPTIONS

Bind 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 this is interactive shell:

if [[ $- =~ .*i.* ]]; then bind '"\C-r": "\C-a hh \C-j"'; fi

To determine the character sequence emitted by a pressed key in terminal, type Ctrl-v and then press the key. Check your current bindings using:

bind -S

Get hh in more colors:

export HH_CONFIG=hicolor

show normal history by default (instead of metrics-based view):

export HH_CONFIG=rawhistory

show favorites by default (instead of metrics-based view):

export HH_CONFIG=favorites

make search case sensitive (insensitive by default):

export HH_CONFIG=casesensitive

show warnings:

export HH_CONFIG=warning

show debug messages:

export HH_CONFIG=debug

more colors and case sensitive search:

export HH_CONFIG=hicolor,casesensitive

Increase the size of history:

export HISTFILESIZE=10000
export HISTSIZE=${HISTFILESIZE}

Variables defined above increase the number of history items and history file size (default value is 500).

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 histappend

Use leading space to hide commands from history:

export HISTCONTROL=ignorespace

Suitable for a sensitive information like passwords.