Table des matières

hstr

Installation

Installation sur Ubuntu (doc officielle)

$ sudo add-apt-repository ppa:ultradvorka/ppa && sudo apt-get update && sudo apt-get install hstr

Configuration

On peut fouiller la documentation officielle ou simplement utiliser la génération de la configuration par défaut.

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

J'ai changé deux-trois trucs, voici ma configuration finale :

#hstr
# HSTR configuration - add this to ~/.bashrc
alias hh=hstr                    # hh to be alias for hstr
#export HSTR_CONFIG=hicolor       # get more colors
export HSTR_CONFIG=hicolor,raw-history-view       # get more colors
shopt -s histappend              # append new history items to .bash_history
#export HISTCONTROL=ignorespace   # leading space hides commands from history
export HISTCONTROL=ignoreboth    # don't put duplicate lines or lines starting with space in the history.
export HISTFILESIZE=10000        # increase history file size (default is 500)
export HISTSIZE=${HISTFILESIZE}  # increase history size (default is 500)
# ensure synchronization between bash memory and history file
export PROMPT_COMMAND="history -a; history -n; ${PROMPT_COMMAND}"
# if this is interactive shell, then bind hstr to Ctrl-r (for Vi mode check doc)
if [[ $- =~ .*i.* ]]; then bind '"\C-r": "\C-a hstr -- \C-j"'; fi
# if this is interactive shell, then bind 'kill last command' to Ctrl-x k
if [[ $- =~ .*i.* ]]; then bind '"\C-xk": "\C-a hstr -k \C-j"'; fi