From f6babaf98c2dfddc8a6a6242b2d1d6e37bd8f97e Mon Sep 17 00:00:00 2001 From: Valentin Lab Date: Mon, 12 Apr 2021 16:43:20 +0200 Subject: [PATCH] new: [host] allow long bash history conservation and saving of all commands, added fzf Signed-off-by: Valentin Lab --- .../base-0k/hooks/install.d/30-customize.sh | 47 +++++++++++++++++-- 1 file changed, 44 insertions(+), 3 deletions(-) diff --git a/precise/base-0k/hooks/install.d/30-customize.sh b/precise/base-0k/hooks/install.d/30-customize.sh index 472ddfb..b121a12 100755 --- a/precise/base-0k/hooks/install.d/30-customize.sh +++ b/precise/base-0k/hooks/install.d/30-customize.sh @@ -24,14 +24,24 @@ else cp /root/.bashrc /root/.bashrc.pre-install fi +apt-get install fzf fd-find > /root/.bashrc ## History management -export HISTCONTROL=ignoredups -export HISTSIZE=50000 +export HISTCONTROL=ignoreboth +export HISTSIZE=500000 +export HISTIGNORE="&:[bf]g:exit:ls:history" +export HISTFILESIZE= +export HISTTIMEFORMAT="%Y-%m-%d %T " + shopt -s histappend -PROMPT_COMMAND='history -a' ## Prompt easy management @@ -54,5 +64,36 @@ function glog() { prompt 1 +PROMPT_COMMAND='history -a' ## after prompt setting as it resets it + + +## +## fzf (apt-get install fzf) and fd (apt-get install fd-find) +## + +if [ -e /usr/share/doc/fzf/examples/key-bindings.bash ]; then + . /usr/share/doc/fzf/examples/key-bindings.bash +fi + +if [ -e /usr/share/doc/fzf/examples/completion.bash ]; then + . /usr/share/doc/fzf/examples/completion.bash +fi + +#export FZF_DEFAULT_OPTS="--color 'fg:#bbccdd,fg+:#ddeeff,bg:#111820,preview-bg:#223344,border:#778899'" +export FZF_DEFAULT_COMMAND='fd --type f --hidden --follow --exclude .git' +export FZF_CTRL_T_COMMAND="$FZF_DEFAULT_COMMAND" + + EOF +cat <> /root/.bash_profile + +## XXXvlab: +## http://stackoverflow.com/questions/9652126/bashrc-profile-is-not-loaded-on-new-tmux-session-or-window-why +## Including ``.bashrc`` if it exists (tmux don't load bashrc, and bashrc +## don't load profile... so not recursive call) +if [ -f ~/.bashrc ]; then + . ~/.bashrc +fi + +EOF