Normalisation et nettoyage #4
@@ -0,0 +1,50 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
# Customize shell history search
|
||||||
|
|
||||||
|
# Indicate your preference order for history tools
|
||||||
|
# The first one found available will be used
|
||||||
|
MY_HISTORY_TOOLS="atuin mcfly"
|
||||||
|
|
||||||
|
for tool in ${MY_HISTORY_TOOLS}; do
|
||||||
|
if (command -v "${tool}" &>/dev/null); then
|
||||||
|
USE_HISTORY_TOOL="${tool}"
|
||||||
|
break
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
|
case "${USE_HISTORY_TOOL}" in
|
||||||
|
|
||||||
|
# https://atuin.sh/
|
||||||
|
"atuin")
|
||||||
|
if (command -v atuin &>/dev/null); then
|
||||||
|
eval "$(atuin init bash)"
|
||||||
|
else
|
||||||
|
echo "${USE_HISTORY_TOOL} command not found"
|
||||||
|
fi
|
||||||
|
;;
|
||||||
|
|
||||||
|
# https://github.com/cantino/mcfly
|
||||||
|
"mcfly")
|
||||||
|
if (command -v mcfly &>/dev/null); then
|
||||||
|
export MCFLY_PROMPT="❯ "
|
||||||
|
export MCFLY_INTERFACE_VIEW=BOTTOM
|
||||||
|
export MCFLY_RESULTS=50
|
||||||
|
export MCFLY_RESULTS_SORT=LAST_RUN
|
||||||
|
# export MCFLY_KEY_SCHEME=vim
|
||||||
|
export MCFLY_FUZZY=3
|
||||||
|
eval "$(mcfly init bash)"
|
||||||
|
else
|
||||||
|
echo "${USE_HISTORY_TOOL} command not found"
|
||||||
|
fi
|
||||||
|
;;
|
||||||
|
|
||||||
|
*)
|
||||||
|
# Default sane bash history behavior
|
||||||
|
export HISTCONTROL=ignoreboth:erasedups
|
||||||
|
export HISTSIZE=10000
|
||||||
|
export HISTFILESIZE=20000
|
||||||
|
shopt -s histappend
|
||||||
|
;;
|
||||||
|
|
||||||
|
esac
|
||||||
-11
@@ -1,11 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
|
|
||||||
if (command -v mcfly &>/dev/null); then
|
|
||||||
export MCFLY_PROMPT="❯ "
|
|
||||||
export MCFLY_INTERFACE_VIEW=BOTTOM
|
|
||||||
export MCFLY_RESULTS=50
|
|
||||||
export MCFLY_RESULTS_SORT=LAST_RUN
|
|
||||||
# export MCFLY_KEY_SCHEME=vim
|
|
||||||
export MCFLY_FUZZY=3
|
|
||||||
eval "$(mcfly init bash)"
|
|
||||||
fi
|
|
||||||
+6
-6
@@ -4,11 +4,11 @@
|
|||||||
|
|
||||||
# Indicate your preference order for prompt tools
|
# Indicate your preference order for prompt tools
|
||||||
# The first one found available will be used
|
# The first one found available will be used
|
||||||
MY_PROMPTS="starship powerline-go"
|
MY_PROMPT_TOOLS="starship powerline-go"
|
||||||
|
|
||||||
for prompt in $MY_PROMPTS; do
|
for prompt in ${MY_PROMPT_TOOLS}; do
|
||||||
if (command -v "$prompt" &>/dev/null); then
|
if (command -v "${prompt}" &>/dev/null); then
|
||||||
USE_PROMPT="$prompt"
|
USE_PROMPT="${prompt}"
|
||||||
break
|
break
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
@@ -30,7 +30,7 @@ case "${USE_PROMPT}" in
|
|||||||
function _update_ps1() {
|
function _update_ps1() {
|
||||||
PS1=$(powerline-go -jobs "$(jobs -p | wc -l)" -error $? -modules "ssh,host,wsl,user,cwd,direnv,venv,perms,git,jobs,exit,root" -modules-right "docker,docker-context,kube,terraform-workspace,termtitle" -newline)
|
PS1=$(powerline-go -jobs "$(jobs -p | wc -l)" -error $? -modules "ssh,host,wsl,user,cwd,direnv,venv,perms,git,jobs,exit,root" -modules-right "docker,docker-context,kube,terraform-workspace,termtitle" -newline)
|
||||||
}
|
}
|
||||||
if [ "$TERM" != "linux" ]; then _prompt_command_add "_update_ps1"; fi
|
if [ "${TERM}" != "linux" ]; then _prompt_command_add "_update_ps1"; fi
|
||||||
else
|
else
|
||||||
echo "${USE_PROMPT} command not found"
|
echo "${USE_PROMPT} command not found"
|
||||||
fi
|
fi
|
||||||
@@ -38,7 +38,7 @@ case "${USE_PROMPT}" in
|
|||||||
|
|
||||||
*)
|
*)
|
||||||
# Default simple prompt
|
# Default simple prompt
|
||||||
if [ "$UID" -eq 0 ]; then
|
if [ "${UID}" -eq 0 ]; then
|
||||||
export PS1='\[\e[01;31m\]\u@\h\[\e[01;34m\] \w \$\[\e[0m\] '
|
export PS1='\[\e[01;31m\]\u@\h\[\e[01;34m\] \w \$\[\e[0m\] '
|
||||||
else
|
else
|
||||||
export PS1='\[\e[01;32m\]\u@\h\[\e[01;34m\] \w \$\[\e[0m\] '
|
export PS1='\[\e[01;32m\]\u@\h\[\e[01;34m\] \w \$\[\e[0m\] '
|
||||||
|
|||||||
Reference in New Issue
Block a user