From 7000bde368b8ca56365877b3fb3d009e7f01c293 Mon Sep 17 00:00:00 2001 From: Xavier Logerais Date: Sat, 22 Aug 2026 00:19:55 +0200 Subject: [PATCH 01/14] feat(rc): Unify history tool selection (atuin/mcfly) with preference order Merge rc.d/mcfly and rc.d/atuin into rc.d/history, following the same preference-list + availability-check + fallback pattern as rc.d/prompt, so only one history tool is active at a time instead of both being initialized independently. Also normalize variable expansions in rc.d/prompt to consistently use ${var} braces. --- rc.d/history | 50 ++++++++++++++++++++++++++++++++++++++++++++++++++ rc.d/mcfly | 11 ----------- rc.d/prompt | 12 ++++++------ 3 files changed, 56 insertions(+), 17 deletions(-) create mode 100644 rc.d/history delete mode 100644 rc.d/mcfly diff --git a/rc.d/history b/rc.d/history new file mode 100644 index 0000000..be85be8 --- /dev/null +++ b/rc.d/history @@ -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 diff --git a/rc.d/mcfly b/rc.d/mcfly deleted file mode 100644 index 4c30022..0000000 --- a/rc.d/mcfly +++ /dev/null @@ -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 diff --git a/rc.d/prompt b/rc.d/prompt index fc28674..8460667 100644 --- a/rc.d/prompt +++ b/rc.d/prompt @@ -4,11 +4,11 @@ # Indicate your preference order for prompt tools # 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 - if (command -v "$prompt" &>/dev/null); then - USE_PROMPT="$prompt" +for prompt in ${MY_PROMPT_TOOLS}; do + if (command -v "${prompt}" &>/dev/null); then + USE_PROMPT="${prompt}" break fi done @@ -30,7 +30,7 @@ case "${USE_PROMPT}" in 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) } - if [ "$TERM" != "linux" ]; then _prompt_command_add "_update_ps1"; fi + if [ "${TERM}" != "linux" ]; then _prompt_command_add "_update_ps1"; fi else echo "${USE_PROMPT} command not found" fi @@ -38,7 +38,7 @@ case "${USE_PROMPT}" in *) # 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\] ' else export PS1='\[\e[01;32m\]\u@\h\[\e[01;34m\] \w \$\[\e[0m\] ' -- 2.43.0 From 6a53ee36fd46d704074156dd98a36d9eda219a44 Mon Sep 17 00:00:00 2001 From: Xavier Logerais Date: Sat, 22 Aug 2026 00:24:29 +0200 Subject: [PATCH 02/14] chore(rc,profile,aliases,completion,libs,functions): Remove shebangs from sourced files These files are always sourced (never executed directly), so the #!/bin/bash shebang is inert and misleading. Drop it consistently across rc.d/*, profile.d/*, and aliases.d/*. --- _helpers.bash | 2 -- aliases.d/bat | 2 -- aliases.d/colordiff | 2 -- aliases.d/colors | 2 -- aliases.d/fun | 2 -- aliases.d/generic | 2 -- aliases.d/git | 2 -- aliases.d/gopass | 2 -- aliases.d/kitty | 2 -- aliases.d/kubectl | 2 -- aliases.d/lsd | 2 -- aliases.d/mc | 2 -- aliases.d/nvim | 2 -- aliases.d/openvswitch | 2 -- aliases.d/power | 2 -- aliases.d/security | 2 -- aliases.d/ssh | 2 -- aliases.d/system | 2 -- aliases.d/tree | 2 -- aliases.d/vim | 2 -- aliases.d/zfs | 2 -- bash_profile | 2 -- completion.d/aws | 2 -- completion.d/chezmoi | 2 -- completion.d/flux | 2 -- completion.d/glab | 2 -- completion.d/helm | 2 -- completion.d/k3d | 2 -- completion.d/kind | 2 -- completion.d/kubectl | 2 -- completion.d/minikube | 2 -- completion.d/mise | 2 -- completion.d/podman | 2 -- completion.d/poetry | 2 -- completion.d/stern | 2 -- completion.d/tea | 2 -- functions.d/devenv | 2 -- libs/colors.bash | 2 -- libs/ip.bash | 2 -- libs/note.bash | 2 -- libs/password.bash | 2 -- libs/ssh.bash | 2 -- libs/term.bash | 2 -- libs/todo.bash | 2 -- libs/urxvt.bash | 2 -- libs/xml.bash | 2 -- profile.d/anyenv | 2 -- profile.d/history | 2 -- profile.d/keychain | 2 -- profile.d/krew | 2 -- profile.d/lang | 2 -- profile.d/mail | 2 -- profile.d/path | 2 -- profile.d/tsocks | 2 -- rc.after.d/apps | 2 -- rc.after.d/blesh | 2 -- rc.before.d/blesh | 2 -- rc.before.d/mise | 2 -- rc.d/anyenv | 2 -- rc.d/asdf | 2 -- rc.d/broot | 2 -- rc.d/cgroups | 2 -- rc.d/colors | 2 -- rc.d/direnv | 2 -- rc.d/fzf | 2 -- rc.d/git | 2 -- rc.d/history | 2 -- rc.d/lsd | 2 -- rc.d/prompt | 2 -- rc.d/rvm | 2 -- rc.d/screen | 2 -- rc.d/terminal-title | 2 -- rc.d/tmux | 2 -- rc.d/todo.txt | 2 -- rc.d/urxvt | 1 - rc.d/vivid | 2 -- rc.d/zoxide | 2 -- 77 files changed, 153 deletions(-) diff --git a/_helpers.bash b/_helpers.bash index b3f8e8b..acf72e5 100644 --- a/_helpers.bash +++ b/_helpers.bash @@ -1,5 +1,3 @@ -#!/bin/bash - function basedir() { (cd "$(dirname \"$-2\")" && pwd) } diff --git a/aliases.d/bat b/aliases.d/bat index d285751..bab5c77 100644 --- a/aliases.d/bat +++ b/aliases.d/bat @@ -1,5 +1,3 @@ -#!/bin/bash - if (command -v bat &>/dev/null); then alias cat=bat fi diff --git a/aliases.d/colordiff b/aliases.d/colordiff index aa0d214..989b574 100644 --- a/aliases.d/colordiff +++ b/aliases.d/colordiff @@ -1,5 +1,3 @@ -#!/bin/bash - if (which colordiff &> /dev/null) then alias diff=colordiff diff --git a/aliases.d/colors b/aliases.d/colors index e0d5739..671411c 100644 --- a/aliases.d/colors +++ b/aliases.d/colors @@ -1,5 +1,3 @@ -#!/bin/bash - # Colors alias ls='ls --color=auto' alias grep='grep --color=auto' diff --git a/aliases.d/fun b/aliases.d/fun index b0c29e6..8bd2edb 100644 --- a/aliases.d/fun +++ b/aliases.d/fun @@ -1,5 +1,3 @@ -#!/bin/bash - # Fun alias matrix='tr -c "[:digit:]" " " < /dev/urandom | dd cbs=$COLUMNS conv=unblock | GREP_COLOR="1;32" grep --color "[^ ]"' diff --git a/aliases.d/generic b/aliases.d/generic index 9d8fa1d..497fbb1 100644 --- a/aliases.d/generic +++ b/aliases.d/generic @@ -1,5 +1,3 @@ -#!/bin/bash - # Cd alias cdup='cd ..' diff --git a/aliases.d/git b/aliases.d/git index 042934a..d306be0 100644 --- a/aliases.d/git +++ b/aliases.d/git @@ -1,5 +1,3 @@ -#!/bin/bash - # Git if [ -x /usr/bin/git ]; then alias gs='git status' diff --git a/aliases.d/gopass b/aliases.d/gopass index 1765cb3..7c9f8a1 100644 --- a/aliases.d/gopass +++ b/aliases.d/gopass @@ -1,5 +1,3 @@ -#!/bin/bash - if (command -v 'gopass' && ! command -v pass ) &> /dev/null then alias pass='gopass' diff --git a/aliases.d/kitty b/aliases.d/kitty index 844f3ea..4914726 100644 --- a/aliases.d/kitty +++ b/aliases.d/kitty @@ -1,5 +1,3 @@ -#!/bin/bash - # [ "$TERM" = "xterm-kitty" ] && alias ssh="kitty +kitten ssh" if [ -n "${KITTY_INSTALLATION_DIR}" ]; then alias ssh="kitty +kitten ssh" diff --git a/aliases.d/kubectl b/aliases.d/kubectl index 82a301e..9d0bae3 100644 --- a/aliases.d/kubectl +++ b/aliases.d/kubectl @@ -1,5 +1,3 @@ -#!/bin/bash - if (command -v kubectl &>/dev/null); then # create some usefull aliases diff --git a/aliases.d/lsd b/aliases.d/lsd index e614253..ba31bf3 100644 --- a/aliases.d/lsd +++ b/aliases.d/lsd @@ -1,5 +1,3 @@ -#!/bin/bash - if (command -v lsd &> /dev/null) then alias ls='lsd' diff --git a/aliases.d/mc b/aliases.d/mc index 6f6b7c8..e83d552 100644 --- a/aliases.d/mc +++ b/aliases.d/mc @@ -1,5 +1,3 @@ -#!/bin/bash - if (which mc &> /dev/null); then if [ "$TERM" = "rxvt-unicode" ]; then alias mc="TERM=rxvt-unicode-256color mc" diff --git a/aliases.d/nvim b/aliases.d/nvim index 1696caf..c9057bc 100644 --- a/aliases.d/nvim +++ b/aliases.d/nvim @@ -1,5 +1,3 @@ -#!/bin/bash - # Vim Editor if [ -x ~/AppImages/nvim.appimage ] then diff --git a/aliases.d/openvswitch b/aliases.d/openvswitch index ffd8c7e..569ed7f 100644 --- a/aliases.d/openvswitch +++ b/aliases.d/openvswitch @@ -1,5 +1,3 @@ -#!/bin/bash - if (which ovs-appctl &> /dev/null); then alias appctl='sudo ovs-appctl'; fi if (which ovs-vsctl &> /dev/null); then alias vsctl='sudo ovs-vsctl'; fi if (which ovs-ofctl &> /dev/null); then alias ofctl='sudo ovs-ofctl'; fi diff --git a/aliases.d/power b/aliases.d/power index 2bb0f61..1d4ebae 100644 --- a/aliases.d/power +++ b/aliases.d/power @@ -1,5 +1,3 @@ -#!/bin/bash - # Power alias reboot='sudo reboot' alias halt='sudo halt' diff --git a/aliases.d/security b/aliases.d/security index 0ca8e2d..80b7ff0 100644 --- a/aliases.d/security +++ b/aliases.d/security @@ -1,5 +1,3 @@ -#!/bin/bash - # Security alias rm='rm -i' alias mv='mv -i' diff --git a/aliases.d/ssh b/aliases.d/ssh index 5b3ec47..b9231ee 100644 --- a/aliases.d/ssh +++ b/aliases.d/ssh @@ -1,4 +1,2 @@ -#!/bin/bash - # SSH alias ssh!='ssh -q -oStrictHostKeyChecking=no -oIdentitiesOnly=yes' diff --git a/aliases.d/system b/aliases.d/system index a9ff1c2..3d854e3 100644 --- a/aliases.d/system +++ b/aliases.d/system @@ -1,5 +1,3 @@ -#!/bin/bash - # System tools if [ -f /sbin/ifconfig ] && [ -x /sbin/ifconfig ]; then alias ifconfig='/sbin/ifconfig'; fi if [ -f /sbin/ip ] && [ -x /sbin/ip ]; then alias ip='/sbin/ip'; fi diff --git a/aliases.d/tree b/aliases.d/tree index d107eda..c310fb0 100644 --- a/aliases.d/tree +++ b/aliases.d/tree @@ -1,3 +1 @@ -#!/bin/bash - alias tree='tree -A -C' diff --git a/aliases.d/vim b/aliases.d/vim index 772a153..c5c1d9a 100644 --- a/aliases.d/vim +++ b/aliases.d/vim @@ -1,5 +1,3 @@ -#!/bin/bash - # Vim Editor if (command -v nvim &> /dev/null) then diff --git a/aliases.d/zfs b/aliases.d/zfs index 098e855..b283634 100644 --- a/aliases.d/zfs +++ b/aliases.d/zfs @@ -1,4 +1,2 @@ -#!/bin/bash - if (which zfs &> /dev/null); then alias zfs='sudo zfs'; fi if (which zpool &> /dev/null); then alias zpool='sudo zpool'; fi diff --git a/bash_profile b/bash_profile index 39f1384..2dd3d51 100644 --- a/bash_profile +++ b/bash_profile @@ -1,5 +1,3 @@ -#!/bin/bash - if [ -f "${HOME}"/.nix-profile/etc/profile.d/hm-session-vars.sh ]; then source "${HOME}"/.nix-profile/etc/profile.d/hm-session-vars.sh fi diff --git a/completion.d/aws b/completion.d/aws index 6fd4c32..02a9557 100644 --- a/completion.d/aws +++ b/completion.d/aws @@ -1,5 +1,3 @@ -#!/bin/bash - if (command -v aws && command -v aws_completer) &>/dev/null; then complete -C aws_completer aws fi diff --git a/completion.d/chezmoi b/completion.d/chezmoi index acfd0bc..6afc737 100644 --- a/completion.d/chezmoi +++ b/completion.d/chezmoi @@ -1,5 +1,3 @@ -#!/bin/bash - if (command -v chezmoi &>/dev/null); then source <(chezmoi completion bash) fi diff --git a/completion.d/flux b/completion.d/flux index a8f4dde..c1e9cc8 100644 --- a/completion.d/flux +++ b/completion.d/flux @@ -1,5 +1,3 @@ -#!/bin/bash - if (command -v flux &>/dev/null); then source <(flux completion bash) fi diff --git a/completion.d/glab b/completion.d/glab index 065cc60..3f5be3d 100644 --- a/completion.d/glab +++ b/completion.d/glab @@ -1,5 +1,3 @@ -#!/bin/bash - if (command -v glab &>/dev/null); then source <(glab completion) fi diff --git a/completion.d/helm b/completion.d/helm index fb0b30f..56cc855 100644 --- a/completion.d/helm +++ b/completion.d/helm @@ -1,5 +1,3 @@ -#!/bin/bash - if (command -v helm &> /dev/null) then source <( helm completion bash ) diff --git a/completion.d/k3d b/completion.d/k3d index 2d10616..61e606b 100644 --- a/completion.d/k3d +++ b/completion.d/k3d @@ -1,5 +1,3 @@ -#!/bin/bash - if (command -v k3d &>/dev/null); then source <(k3d completion bash) fi diff --git a/completion.d/kind b/completion.d/kind index 84e94e5..29e919b 100644 --- a/completion.d/kind +++ b/completion.d/kind @@ -1,5 +1,3 @@ -#!/bin/bash - if (command -v kind &>/dev/null); then source <(kind completion bash) fi diff --git a/completion.d/kubectl b/completion.d/kubectl index 117399e..5c5e277 100644 --- a/completion.d/kubectl +++ b/completion.d/kubectl @@ -1,5 +1,3 @@ -#!/bin/bash - if (command -v kubectl &> /dev/null) then source <(kubectl completion bash) diff --git a/completion.d/minikube b/completion.d/minikube index ff4ed7c..afdab95 100644 --- a/completion.d/minikube +++ b/completion.d/minikube @@ -1,5 +1,3 @@ -#!/bin/bash - if (command -v minikube &>/dev/null); then source <(minikube completion bash) fi diff --git a/completion.d/mise b/completion.d/mise index a51c4fa..93344fb 100644 --- a/completion.d/mise +++ b/completion.d/mise @@ -1,5 +1,3 @@ -#!/bin/bash - if (command -v mise &>/dev/null); then source <(mise completion bash --include-bash-completion-lib) fi diff --git a/completion.d/podman b/completion.d/podman index e4f61bb..9e25c67 100644 --- a/completion.d/podman +++ b/completion.d/podman @@ -1,5 +1,3 @@ -#!/bin/bash - if (command -v podman &>/dev/null); then source <(podman completion bash) fi diff --git a/completion.d/poetry b/completion.d/poetry index bbae3eb..93309e9 100644 --- a/completion.d/poetry +++ b/completion.d/poetry @@ -1,5 +1,3 @@ -#!/bin/bash - if ( command -v poetry &> /dev/null ) then source <(poetry completions bash) diff --git a/completion.d/stern b/completion.d/stern index d736dfa..c705424 100644 --- a/completion.d/stern +++ b/completion.d/stern @@ -1,5 +1,3 @@ -#!/bin/bash - if (command -v stern &> /dev/null) then source <(stern --completion bash) diff --git a/completion.d/tea b/completion.d/tea index 017cb79..0666c99 100644 --- a/completion.d/tea +++ b/completion.d/tea @@ -1,5 +1,3 @@ -#!/bin/bash - if (command -v tea &>/dev/null); then source <(tea completion bash) fi diff --git a/functions.d/devenv b/functions.d/devenv index e93826d..d27615b 100644 --- a/functions.d/devenv +++ b/functions.d/devenv @@ -1,5 +1,3 @@ -#!/bin/bash - function devenv() { local status diff --git a/libs/colors.bash b/libs/colors.bash index a6f87ec..a2fa315 100755 --- a/libs/colors.bash +++ b/libs/colors.bash @@ -1,5 +1,3 @@ -#!/bin/bash - #ANSI CODES #Code Effect #0 All attributes off diff --git a/libs/ip.bash b/libs/ip.bash index 28513e2..e16f838 100644 --- a/libs/ip.bash +++ b/libs/ip.bash @@ -1,5 +1,3 @@ -#!/bin/bash - function ip_to_hex () { if test -e "$1" ; then echo "Usage : $0 XXX.XXX.XXX.XXX" ; return ; fi diff --git a/libs/note.bash b/libs/note.bash index 49bc104..7739108 100644 --- a/libs/note.bash +++ b/libs/note.bash @@ -1,5 +1,3 @@ -#!/bin/bash - note() { # if file doesn't exist, create it if [[ ! -f $HOME/.notes ]]; then diff --git a/libs/password.bash b/libs/password.bash index cf636a7..b10f857 100755 --- a/libs/password.bash +++ b/libs/password.bash @@ -1,5 +1,3 @@ -#!/bin/bash - encpasswd() { local password_clear=$1 local password_md5hash=$(openssl passwd -1 "$password_clear") diff --git a/libs/ssh.bash b/libs/ssh.bash index 3979cca..f2e3133 100644 --- a/libs/ssh.bash +++ b/libs/ssh.bash @@ -1,5 +1,3 @@ -#!/bin/bash - function ssh_clean_known_hosts() { if [ -z "$1" ]; then echo "No arguments given. Cleaning ~/.ssh/known_hosts" diff --git a/libs/term.bash b/libs/term.bash index e1b183f..cc2c500 100755 --- a/libs/term.bash +++ b/libs/term.bash @@ -1,5 +1,3 @@ -#!/bin/bash - function term_change_title { case $TERM in # Change the window title of X terminals diff --git a/libs/todo.bash b/libs/todo.bash index abebf60..3a11be0 100644 --- a/libs/todo.bash +++ b/libs/todo.bash @@ -1,5 +1,3 @@ -#!/bin/bash - todo() { if [[ ! -f $HOME/.todo ]]; then touch $HOME/.todo diff --git a/libs/urxvt.bash b/libs/urxvt.bash index fd5f30e..9367746 100755 --- a/libs/urxvt.bash +++ b/libs/urxvt.bash @@ -1,5 +1,3 @@ -#!/bin/bash - function urxvt_set_font { # set font diff --git a/libs/xml.bash b/libs/xml.bash index c5e6e3c..e6389a2 100644 --- a/libs/xml.bash +++ b/libs/xml.bash @@ -1,4 +1,2 @@ -#!/bin/bash - function prettyxml () { sed -e 's,>,>\n,g'; } diff --git a/profile.d/anyenv b/profile.d/anyenv index ec4e7bd..481879a 100644 --- a/profile.d/anyenv +++ b/profile.d/anyenv @@ -1,5 +1,3 @@ -#!/bin/bash - # https://github.com/riywo/anyenv # git clone https://github.com/riywo/anyenv $HOME/.anyenv diff --git a/profile.d/history b/profile.d/history index 731148c..19f22d3 100644 --- a/profile.d/history +++ b/profile.d/history @@ -1,5 +1,3 @@ -#!/bin/bash - # Customize history format export HISTSIZE=5000 export HISTFILESIZE=20000 diff --git a/profile.d/keychain b/profile.d/keychain index 7e4bfa7..f795a65 100644 --- a/profile.d/keychain +++ b/profile.d/keychain @@ -1,5 +1,3 @@ -#!/bin/bash - if (command -v keychain &>/dev/null); then eval "$(keychain --inherit any --quiet --noask ~/.ssh/id_{rsa,ed25519})" fi diff --git a/profile.d/krew b/profile.d/krew index 35be151..05ffeac 100644 --- a/profile.d/krew +++ b/profile.d/krew @@ -1,5 +1,3 @@ -#!/bin/bash - if (command -v krew &>/dev/null); then export PATH="${KREW_ROOT:-$HOME/.krew}/bin:$PATH" fi diff --git a/profile.d/lang b/profile.d/lang index 8989d67..6c46a0c 100644 --- a/profile.d/lang +++ b/profile.d/lang @@ -1,4 +1,2 @@ -#!/bin/bash - # Define prefered LANG export LANG=fr_FR.UTF-8 diff --git a/profile.d/mail b/profile.d/mail index 3692de2..85b3b70 100644 --- a/profile.d/mail +++ b/profile.d/mail @@ -1,4 +1,2 @@ -#!/bin/bash - # Mail export MAILPATH=~/Mails/ diff --git a/profile.d/path b/profile.d/path index 2613629..fa5f980 100644 --- a/profile.d/path +++ b/profile.d/path @@ -1,5 +1,3 @@ -#!/bin/bash - # Customize PATH if [ -d $HOME/.bin ] ; then export PATH=$PATH:$HOME/.bin ; fi if [ -d $HOME/.local/bin ] ; then export PATH=$PATH:$HOME/.local/bin ; fi diff --git a/profile.d/tsocks b/profile.d/tsocks index b4ef248..fcb5e73 100644 --- a/profile.d/tsocks +++ b/profile.d/tsocks @@ -1,5 +1,3 @@ -#!/bin/bash - # Proxy if [ -x /usr/bin/tsocks ] then diff --git a/rc.after.d/apps b/rc.after.d/apps index 3376aec..f1d07b9 100644 --- a/rc.after.d/apps +++ b/rc.after.d/apps @@ -1,5 +1,3 @@ -#!/bin/bash - # Defined prefered applications # EDITOR diff --git a/rc.after.d/blesh b/rc.after.d/blesh index f2a1b97..282264d 100644 --- a/rc.after.d/blesh +++ b/rc.after.d/blesh @@ -1,3 +1 @@ -#!/bin/bash - [[ ${BLE_VERSION-} ]] && ble-attach diff --git a/rc.before.d/blesh b/rc.before.d/blesh index 734f5dc..0c0df03 100644 --- a/rc.before.d/blesh +++ b/rc.before.d/blesh @@ -1,5 +1,3 @@ -#!/bin/bash - # ble.sh () installed from nix if (command -v blesh-share &>/dev/null); then source "$(blesh-share)"/ble.sh --attach=none # does not work currently diff --git a/rc.before.d/mise b/rc.before.d/mise index 811ec8d..7498eba 100644 --- a/rc.before.d/mise +++ b/rc.before.d/mise @@ -1,5 +1,3 @@ -#!/bin/bash - if (command -v mise &>/dev/null); then # activate mise-en-place (https://mise.jdx.dev/) diff --git a/rc.d/anyenv b/rc.d/anyenv index debc2c8..a6d52fe 100644 --- a/rc.d/anyenv +++ b/rc.d/anyenv @@ -1,5 +1,3 @@ -#!/bin/bash - # https://github.com/riywo/anyenv # git clone https://github.com/riywo/anyenv $HOME/.anyenv diff --git a/rc.d/asdf b/rc.d/asdf index 92d268f..d4a7fb6 100644 --- a/rc.d/asdf +++ b/rc.d/asdf @@ -1,5 +1,3 @@ -#!/bin/bash - if [ -f ~/.asdf/asdf.sh ]; then # activate asdf diff --git a/rc.d/broot b/rc.d/broot index 5ff0f1d..ce0550b 100644 --- a/rc.d/broot +++ b/rc.d/broot @@ -1,5 +1,3 @@ -#!/bin/bash - if (command -v broot &>/dev/null); then # This script was automatically generated by the broot program # More information can be found in https://github.com/Canop/broot diff --git a/rc.d/cgroups b/rc.d/cgroups index ea1f162..97c7155 100644 --- a/rc.d/cgroups +++ b/rc.d/cgroups @@ -1,5 +1,3 @@ -#!/bin/bash - # Use cgroups if [ "$PS1" ] ; then diff --git a/rc.d/colors b/rc.d/colors index 5d5fa7d..9437a24 100644 --- a/rc.d/colors +++ b/rc.d/colors @@ -1,5 +1,3 @@ -#!/bin/bash - # Enable colors for ls, etc. Prefer ~/.dir_colors #64489 if [[ -f ~/.dir_colors ]]; then eval `dircolors -b ~/.dir_colors` diff --git a/rc.d/direnv b/rc.d/direnv index 023376c..933b92f 100644 --- a/rc.d/direnv +++ b/rc.d/direnv @@ -1,5 +1,3 @@ -#!/bin/bash - if (asdf which direnv &>/dev/null); then # Hook direnv into your shell. eval "$(asdf exec direnv hook bash)" diff --git a/rc.d/fzf b/rc.d/fzf index 4d7276a..947b168 100644 --- a/rc.d/fzf +++ b/rc.d/fzf @@ -1,5 +1,3 @@ -#!/bin/bash - if (command -v fzf &>/dev/null); then # Shell integration diff --git a/rc.d/git b/rc.d/git index 72de9cb..2d6882a 100644 --- a/rc.d/git +++ b/rc.d/git @@ -1,5 +1,3 @@ -#!/bin/bash - if (command -v git && command -v fzf) &>/dev/null; then function gsb { git checkout "$(git branch --all | fzf | tr -d '[:space:]')"; } fi diff --git a/rc.d/history b/rc.d/history index be85be8..b6336b8 100644 --- a/rc.d/history +++ b/rc.d/history @@ -1,5 +1,3 @@ -#!/bin/bash - # Customize shell history search # Indicate your preference order for history tools diff --git a/rc.d/lsd b/rc.d/lsd index ac18fc7..6809d6f 100644 --- a/rc.d/lsd +++ b/rc.d/lsd @@ -1,5 +1,3 @@ -#!/bin/bash - if (which lsd &> /dev/null) then diff --git a/rc.d/prompt b/rc.d/prompt index 8460667..59e6685 100644 --- a/rc.d/prompt +++ b/rc.d/prompt @@ -1,5 +1,3 @@ -#!/bin/bash - # Customize the prompt # Indicate your preference order for prompt tools diff --git a/rc.d/rvm b/rc.d/rvm index 39439fc..e01ba86 100644 --- a/rc.d/rvm +++ b/rc.d/rvm @@ -1,5 +1,3 @@ -#!/bin/bash - # Load RVM into a shell session *as a function* [[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm" diff --git a/rc.d/screen b/rc.d/screen index 3b60f98..686a354 100644 --- a/rc.d/screen +++ b/rc.d/screen @@ -1,5 +1,3 @@ -#!/bin/bash - # GNU Screen stuff if ( which screen &> /dev/null ) then diff --git a/rc.d/terminal-title b/rc.d/terminal-title index f5d4d34..952fbd1 100644 --- a/rc.d/terminal-title +++ b/rc.d/terminal-title @@ -1,5 +1,3 @@ -#!/bin/bash - # Function to update terminal/tmux title _update_terminal_title() { local kubecontext dir gitrepo gitremote icon title diff --git a/rc.d/tmux b/rc.d/tmux index 9ee2ef6..9d73a85 100644 --- a/rc.d/tmux +++ b/rc.d/tmux @@ -1,5 +1,3 @@ -#!/bin/bash - # GNU Screen stuff if (command -v tmux &>/dev/null); then if [ "$(pgrep -u "$UID" "tmux" | wc -l)" -gt 0 ]; then diff --git a/rc.d/todo.txt b/rc.d/todo.txt index ee0e851..cc62cd5 100644 --- a/rc.d/todo.txt +++ b/rc.d/todo.txt @@ -1,5 +1,3 @@ -#!/bin/bash - if [ -f ~/software/todo.txt-cli/todo.sh ]; then export TODOTXT_DEFAULT_ACTION=ls diff --git a/rc.d/urxvt b/rc.d/urxvt index 85588db..ddb6ffb 100644 --- a/rc.d/urxvt +++ b/rc.d/urxvt @@ -1,4 +1,3 @@ -#!/bin/bash # #URXVT_FONT_NAME="DejaVu Sans Mono" #URXVT_FONT_SIZE=16 diff --git a/rc.d/vivid b/rc.d/vivid index 4965e2f..539ddd1 100644 --- a/rc.d/vivid +++ b/rc.d/vivid @@ -1,5 +1,3 @@ -#!/bin/bash - # INFO: #  vivid is a generator for the LS_COLORS environment variable that controls the colorized output of ls, tree, fd, bfs, dust and many other tools. # ➜ https://github.com/sharkdp/vivid diff --git a/rc.d/zoxide b/rc.d/zoxide index 6282d76..5ad5379 100644 --- a/rc.d/zoxide +++ b/rc.d/zoxide @@ -1,5 +1,3 @@ -#!/bin/bash - if (command -v zoxide &>/dev/null); then eval "$(zoxide init bash)" fi -- 2.43.0 From df189f9ec15bf8affb6e60cb9fe0a7818a832bed Mon Sep 17 00:00:00 2001 From: Xavier Logerais Date: Sat, 22 Aug 2026 00:55:39 +0200 Subject: [PATCH 03/14] style: Normalize variable expansions to ${var} across the repo Replace bare $var with ${var} everywhere it was still used, matching the convention already established in rc.d/prompt and rc.d/history. Positional parameters ($1, $@, $#) and special variables ($?, $$, $-) are left as-is, consistent with existing usage in _helpers.bash. rc.d/broot is auto-generated by the broot binary and will likely be overwritten with its original formatting on the next broot update. --- _helpers.bash | 18 +++++++++--------- aliases.d/fun | 2 +- aliases.d/gentoo.bash | 2 +- aliases.d/mc | 2 +- bashrc | 4 ++-- functions.d/devenv | 2 +- libs/note.bash | 10 +++++----- libs/password.bash | 26 +++++++++++++------------- libs/term.bash | 2 +- libs/todo.bash | 16 ++++++++-------- profile.d/anyenv | 6 +++--- profile.d/krew | 2 +- profile.d/path | 8 ++++---- rc.d/anyenv | 2 +- rc.d/asdf | 6 +++--- rc.d/broot | 12 ++++++------ rc.d/cgroups | 10 +++++----- rc.d/rvm | 6 +++--- rc.d/screen | 2 +- rc.d/startx | 8 ++++---- rc.d/terminal-title | 10 +++++----- rc.d/tmux | 4 ++-- rc.d/urxvt | 6 +++--- 23 files changed, 83 insertions(+), 83 deletions(-) diff --git a/_helpers.bash b/_helpers.bash index acf72e5..b36ec1d 100644 --- a/_helpers.bash +++ b/_helpers.bash @@ -4,22 +4,22 @@ function basedir() { function _source_file_if_exists() { if [ -r "$1" ]; then - test -n "$DEBUG_BASHRC" && echo "-- Sourcing file $1" + test -n "${DEBUG_BASHRC}" && echo "-- Sourcing file $1" source "$1" fi } function _source_dir_files() { if [ -d "$1" ]; then - test -n "$DEBUG_BASHRC" && echo "-- Sourcing files in directory $1" + test -n "${DEBUG_BASHRC}" && echo "-- Sourcing files in directory $1" # Safe loops for empty dirs shopt -s nullglob for file in "$1"/*; do - if [ -e "$file" ]; then - test -n "$DEBUG_BASHRC" && echo " * sourcing file $file" - source "$file" + if [ -e "${file}" ]; then + test -n "${DEBUG_BASHRC}" && echo " * sourcing file ${file}" + source "${file}" fi done @@ -30,13 +30,13 @@ function _source_dir_files() { # Source : https://superuser.com/questions/39751/add-directory-to-path-if-its-not-already-there _path_add() { - if [ -d "$1" ] && [[ ":$PATH:" != *":$1:"* ]]; then - PATH="${PATH:+"$PATH:"}$1" + if [ -d "$1" ] && [[ ":${PATH}:" != *":$1:"* ]]; then + PATH="${PATH:+"${PATH}:"}$1" fi } _prompt_command_add() { - if [ -n "$1" ] && [[ ":$PROMPT_COMMAND:" != *":$1:"* ]]; then - PROMPT_COMMAND="${PROMPT_COMMAND:+"$PROMPT_COMMAND;"}$1" + if [ -n "$1" ] && [[ ":${PROMPT_COMMAND}:" != *":$1:"* ]]; then + PROMPT_COMMAND="${PROMPT_COMMAND:+"${PROMPT_COMMAND};"}$1" fi } diff --git a/aliases.d/fun b/aliases.d/fun index 8bd2edb..47e03f7 100644 --- a/aliases.d/fun +++ b/aliases.d/fun @@ -1,5 +1,5 @@ # Fun -alias matrix='tr -c "[:digit:]" " " < /dev/urandom | dd cbs=$COLUMNS conv=unblock | GREP_COLOR="1;32" grep --color "[^ ]"' +alias matrix='tr -c "[:digit:]" " " < /dev/urandom | dd cbs=${COLUMNS} conv=unblock | GREP_COLOR="1;32" grep --color "[^ ]"' if (command -v beep &> /dev/null) then diff --git a/aliases.d/gentoo.bash b/aliases.d/gentoo.bash index 61a615d..19b80e6 100644 --- a/aliases.d/gentoo.bash +++ b/aliases.d/gentoo.bash @@ -1,4 +1,4 @@ -if [ -f /etc/gentoo-release -a "$UID" -ne 0 ] +if [ -f /etc/gentoo-release -a "${UID}" -ne 0 ] then alias emerge='sudo emerge' alias etc-update='sudo etc-update' diff --git a/aliases.d/mc b/aliases.d/mc index e83d552..bb6d78f 100644 --- a/aliases.d/mc +++ b/aliases.d/mc @@ -1,5 +1,5 @@ if (which mc &> /dev/null); then - if [ "$TERM" = "rxvt-unicode" ]; then + if [ "${TERM}" = "rxvt-unicode" ]; then alias mc="TERM=rxvt-unicode-256color mc" fi fi diff --git a/bashrc b/bashrc index 6fb2991..96d5a05 100644 --- a/bashrc +++ b/bashrc @@ -80,7 +80,7 @@ _source_dir_files "${BASH_CONFIG_DIR}"/aliases.d # Source bash completion definitions # TODO: Améliorer cette partie pour éviter les erreurs quand aucun fichier n'existe -for file in /etc/bash*completion /etc/profile.d/bash*completion*; do source "$file"; done +for file in /etc/bash*completion /etc/profile.d/bash*completion*; do source "${file}"; done _source_file_if_exists ~/.bash_completion _source_file_if_exists "${BASH_CONFIG_DIR}"/completion @@ -89,7 +89,7 @@ _source_dir_files "${BASH_CONFIG_DIR}"/completion.d _source_dir_files ~/.nix-profile/share/bash-completion/completions if (command -v _complete_alias &>/dev/null); then - for alias in $(alias -p | awk '{print $2}' | awk -F= '{print $1}'); do complete -o default -F _complete_alias "$alias"; done + for alias in $(alias -p | awk '{print $2}' | awk -F= '{print $1}'); do complete -o default -F _complete_alias "${alias}"; done fi # Late customization diff --git a/functions.d/devenv b/functions.d/devenv index d27615b..b01d9a0 100644 --- a/functions.d/devenv +++ b/functions.d/devenv @@ -9,7 +9,7 @@ function devenv() { if [ "${status}" != "RUNNING" ]; then lxc start devenv; fi # Rename tmux window if inside tmux - if [ -n "$TMUX" ]; then tmux rename-window "devenv"; fi + if [ -n "${TMUX}" ]; then tmux rename-window "devenv"; fi # Login as user xavier lxc exec devenv -- login -f xavier diff --git a/libs/note.bash b/libs/note.bash index 7739108..e067480 100644 --- a/libs/note.bash +++ b/libs/note.bash @@ -1,17 +1,17 @@ note() { # if file doesn't exist, create it - if [[ ! -f $HOME/.notes ]]; then - touch "$HOME"/.notes + if [[ ! -f "${HOME}/.notes" ]]; then + touch "${HOME}"/.notes fi if [[ $# -eq 0 ]]; then # no arguments, print file - cat "$HOME"/.notes + cat "${HOME}"/.notes elif [[ "$1" == "-c" ]]; then # clear file - echo "" >"$HOME"/.notes + echo "" >"${HOME}"/.notes else # add all arguments to file - echo "$@" >>"$HOME"/.notes + echo "$@" >>"${HOME}"/.notes fi } diff --git a/libs/password.bash b/libs/password.bash index b10f857..5f5bcf5 100755 --- a/libs/password.bash +++ b/libs/password.bash @@ -1,21 +1,21 @@ encpasswd() { local password_clear=$1 - local password_md5hash=$(openssl passwd -1 "$password_clear") - local password_sha1=$(echo -n "$password_clear" | openssl dgst -sha1) - echo "Password : $password_clear" - echo "MD5HASH : $password_md5hash" - echo "SHA1 : $password_sha1" + local password_md5hash=$(openssl passwd -1 "${password_clear}") + local password_sha1=$(echo -n "${password_clear}" | openssl dgst -sha1) + echo "Password : ${password_clear}" + echo "MD5HASH : ${password_md5hash}" + echo "SHA1 : ${password_sha1}" } genpasswd() { local l=$1 - [ "$l" == "" ] && l=12 + [ "${l}" == "" ] && l=12 local password_clear=$(tr -dc A-Za-z0-9_ $HOME/.todo + echo "" > "${HOME}/.todo" elif [[ "$1" == "-r" ]]; then - cat -n $HOME/.todo + cat -n "${HOME}/.todo" echo -ne "----------------------------\nType a number to remove: " read NUMBER - sed -ie ${NUMBER}d $HOME/.todo + sed -ie "${NUMBER}d" "${HOME}/.todo" else - echo "$@" >> $HOME/.todo + echo "$@" >> "${HOME}/.todo" fi } diff --git a/profile.d/anyenv b/profile.d/anyenv index 481879a..4d9808a 100644 --- a/profile.d/anyenv +++ b/profile.d/anyenv @@ -1,8 +1,8 @@ # https://github.com/riywo/anyenv -# git clone https://github.com/riywo/anyenv $HOME/.anyenv +# git clone https://github.com/riywo/anyenv ${HOME}/.anyenv -if [ -d "$HOME/.anyenv/bin" ] +if [ -d "${HOME}/.anyenv/bin" ] then - export PATH="$HOME/.anyenv/bin:$PATH" + export PATH="${HOME}/.anyenv/bin:${PATH}" fi diff --git a/profile.d/krew b/profile.d/krew index 05ffeac..3497bbf 100644 --- a/profile.d/krew +++ b/profile.d/krew @@ -1,3 +1,3 @@ if (command -v krew &>/dev/null); then - export PATH="${KREW_ROOT:-$HOME/.krew}/bin:$PATH" + export PATH="${KREW_ROOT:-${HOME}/.krew}/bin:${PATH}" fi diff --git a/profile.d/path b/profile.d/path index fa5f980..3f8db46 100644 --- a/profile.d/path +++ b/profile.d/path @@ -1,6 +1,6 @@ # Customize PATH -if [ -d $HOME/.bin ] ; then export PATH=$PATH:$HOME/.bin ; fi -if [ -d $HOME/.local/bin ] ; then export PATH=$PATH:$HOME/.local/bin ; fi +if [ -d "${HOME}/.bin" ] ; then export PATH="${PATH}:${HOME}/.bin" ; fi +if [ -d "${HOME}/.local/bin" ] ; then export PATH="${PATH}:${HOME}/.local/bin" ; fi -if [ -d $HOME/bin ] ; then export PATH=$PATH:$HOME/bin ; fi -if [ -d $HOME/scripts ] ; then export PATH=$PATH:$HOME/scripts ; fi +if [ -d "${HOME}/bin" ] ; then export PATH="${PATH}:${HOME}/bin" ; fi +if [ -d "${HOME}/scripts" ] ; then export PATH="${PATH}:${HOME}/scripts" ; fi diff --git a/rc.d/anyenv b/rc.d/anyenv index a6d52fe..f9b25ae 100644 --- a/rc.d/anyenv +++ b/rc.d/anyenv @@ -1,6 +1,6 @@ # https://github.com/riywo/anyenv -# git clone https://github.com/riywo/anyenv $HOME/.anyenv +# git clone https://github.com/riywo/anyenv ${HOME}/.anyenv if (which anyenv &>/dev/null); then eval "$(anyenv init -)" diff --git a/rc.d/asdf b/rc.d/asdf index d4a7fb6..e290032 100644 --- a/rc.d/asdf +++ b/rc.d/asdf @@ -8,7 +8,7 @@ if [ -f ~/.asdf/asdf.sh ]; then fi -if [ -f "$HOME/.nix-profile/share/asdf-vm/asdf.sh" ]; then - . "$HOME/.nix-profile/share/asdf-vm/asdf.sh" - . "$HOME/.nix-profile/share/bash-completion/completions/asdf.bash" +if [ -f "${HOME}/.nix-profile/share/asdf-vm/asdf.sh" ]; then + . "${HOME}/.nix-profile/share/asdf-vm/asdf.sh" + . "${HOME}/.nix-profile/share/bash-completion/completions/asdf.bash" fi diff --git a/rc.d/broot b/rc.d/broot index ce0550b..c226a8e 100644 --- a/rc.d/broot +++ b/rc.d/broot @@ -8,14 +8,14 @@ if (command -v broot &>/dev/null); then function br { local cmd cmd_file code cmd_file=$(mktemp) - if broot --outcmd "$cmd_file" "$@"; then - cmd=$(<"$cmd_file") - rm -f "$cmd_file" - eval "$cmd" + if broot --outcmd "${cmd_file}" "$@"; then + cmd=$(<"${cmd_file}") + rm -f "${cmd_file}" + eval "${cmd}" else code=$? - rm -f "$cmd_file" - return "$code" + rm -f "${cmd_file}" + return "${code}" fi } fi diff --git a/rc.d/cgroups b/rc.d/cgroups index 97c7155..a11b280 100644 --- a/rc.d/cgroups +++ b/rc.d/cgroups @@ -1,5 +1,5 @@ # Use cgroups -if [ "$PS1" ] ; then +if [ "${PS1}" ] ; then if [ -d /sys/fs/cgroup ] ; then cdir=/sys/fs/cgroup @@ -7,10 +7,10 @@ if [ "$PS1" ] ; then cdir=/dev/cgroup fi - if [ -d "$cdir/user" ]; then - mkdir -p -m 0700 $cdir/user/$$ > /dev/null 2>&1 - /bin/echo $$ > $cdir/user/$$/tasks - /bin/echo '1' > $cdir/user/$$/notify_on_release + if [ -d "${cdir}/user" ]; then + mkdir -p -m 0700 "${cdir}/user/$$" > /dev/null 2>&1 + /bin/echo $$ > "${cdir}/user/$$/tasks" + /bin/echo '1' > "${cdir}/user/$$/notify_on_release" unset -v cdir fi diff --git a/rc.d/rvm b/rc.d/rvm index e01ba86..a14fc24 100644 --- a/rc.d/rvm +++ b/rc.d/rvm @@ -1,8 +1,8 @@ # Load RVM into a shell session *as a function* -[[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm" +[[ -s "${HOME}/.rvm/scripts/rvm" ]] && source "${HOME}/.rvm/scripts/rvm" # Source bash completion for RVM -[[ -r "$HOME/.rvm/scripts/completion" ]] && source "$HOME/.rvm/scripts/completion" +[[ -r "${HOME}/.rvm/scripts/completion" ]] && source "${HOME}/.rvm/scripts/completion" # Add RVM to PATH for scripting -[[ -r "$HOME/.rvm/bin" ]] && PATH=$PATH:$HOME/.rvm/bin +[[ -r "${HOME}/.rvm/bin" ]] && PATH="${PATH}:${HOME}/.rvm/bin" diff --git a/rc.d/screen b/rc.d/screen index 686a354..45dfd9f 100644 --- a/rc.d/screen +++ b/rc.d/screen @@ -1,7 +1,7 @@ # GNU Screen stuff if ( which screen &> /dev/null ) then - if [[ $TERM != screen* ]] + if [[ ${TERM} != screen* ]] then if [ "$(screen -ls | sed -ne 's/[[:space:]]//' -ne 's/(Attached)// p')" ] then diff --git a/rc.d/startx b/rc.d/startx index 4c42870..1a3ad9f 100644 --- a/rc.d/startx +++ b/rc.d/startx @@ -1,10 +1,10 @@ # Auto startx depending on the VT -if [[ -z "$DISPLAY" && $(id -u) -ge 1000 ]] ; then +if [[ -z "${DISPLAY}" && $(id -u) -ge 1000 ]] ; then TTY=$(tty) - if [ "$TTY" == "not a tty" ]; then return; fi - if [ "${TTY/tty}" != "$TTY" -a $(basename ${TTY/tty}) -le 3 ] + if [ "${TTY}" == "not a tty" ]; then return; fi + if [ "${TTY/tty}" != "${TTY}" -a "$(basename "${TTY/tty}")" -le 3 ] then case $(tty | cut -b9-) in @@ -20,7 +20,7 @@ if [[ -z "$DISPLAY" && $(id -u) -ge 1000 ]] ; then if ( which startx &> /dev/null ) then - $EXEC startx 1> ~/.log/xsession-errors 2>&1 -- $VT + ${EXEC} startx 1> ~/.log/xsession-errors 2>&1 -- "${VT}" fi fi fi diff --git a/rc.d/terminal-title b/rc.d/terminal-title index 952fbd1..3d49271 100644 --- a/rc.d/terminal-title +++ b/rc.d/terminal-title @@ -6,14 +6,14 @@ _update_terminal_title() { if [ -n "${KUBECONFIG}" ]; then if command -v kubectl >/dev/null 2>&1; then kubecontext=$(kubectl config current-context 2>/dev/null) - if [ -n "$kubecontext" ]; then + if [ -n "${kubecontext}" ]; then title="󱃾 ${kubecontext}" fi fi fi - # If no title is already set, check if we're in $HOME - if [ -z "${title}" ] && [ "$PWD" = "$HOME" ]; then + # If no title is already set, check if we're in ${HOME} + if [ -z "${title}" ] && [ "${PWD}" = "${HOME}" ]; then title="󱂵 ~" fi @@ -35,7 +35,7 @@ _update_terminal_title() { # Set the title in tmux or terminal window if [ -n "${title}" ]; then - if [ -n "$TMUX" ]; then + if [ -n "${TMUX}" ]; then tmux rename-window "${title}" else printf '\033]0;%s\007' "${title}" @@ -44,4 +44,4 @@ _update_terminal_title() { } # Add the function to the PROMPT_COMMAND variable to have regular updates -if [ "$TERM" != "linux" ]; then _prompt_command_add "_update_terminal_title"; fi +if [ "${TERM}" != "linux" ]; then _prompt_command_add "_update_terminal_title"; fi diff --git a/rc.d/tmux b/rc.d/tmux index 9d73a85..634ad0d 100644 --- a/rc.d/tmux +++ b/rc.d/tmux @@ -1,7 +1,7 @@ # GNU Screen stuff if (command -v tmux &>/dev/null); then - if [ "$(pgrep -u "$UID" "tmux" | wc -l)" -gt 0 ]; then - if [[ $TERM != screen* ]]; then + if [ "$(pgrep -u "${UID}" "tmux" | wc -l)" -gt 0 ]; then + if [[ ${TERM} != screen* ]]; then nb_sessions=$(tmux list-session | wc -l) nb_sessions_attached=$(tmux list-session | grep -c "attached") nb_sessions_detached=$(tmux list-session | grep -c -v "attached") diff --git a/rc.d/urxvt b/rc.d/urxvt index ddb6ffb..ab4806d 100644 --- a/rc.d/urxvt +++ b/rc.d/urxvt @@ -6,16 +6,16 @@ ## Quick functions # #zp() { -# URXVT_FONT_SIZE=$(echo "$URXVT_FONT_SIZE+$URXVT_FONT_INCREMENT" | bc ) +# URXVT_FONT_SIZE=$(echo "${URXVT_FONT_SIZE}+${URXVT_FONT_INCREMENT}" | bc ) # urxvt_set_font "${URXVT_FONT_NAME}:size=${URXVT_FONT_SIZE}" #} # #zm() { -# URXVT_FONT_SIZE=$(echo "$URXVT_FONT_SIZE-$URXVT_FONT_INCREMENT" | bc ) +# URXVT_FONT_SIZE=$(echo "${URXVT_FONT_SIZE}-${URXVT_FONT_INCREMENT}" | bc ) # urxvt_set_font "${URXVT_FONT_NAME}:size=${URXVT_FONT_SIZE}" #} # -#if [ -z "$SSH_CONNECTION" ] +#if [ -z "${SSH_CONNECTION}" ] #then # urxvt_set_font "${URXVT_FONT_NAME}:size=${URXVT_FONT_SIZE}" #fi -- 2.43.0 From 55d26070353dd8d8419a26f2178c5c243c155e7b Mon Sep 17 00:00:00 2001 From: Xavier Logerais Date: Sat, 22 Aug 2026 00:55:55 +0200 Subject: [PATCH 04/14] style: Use command -v instead of which for availability checks rc.d/anyenv, rc.d/screen, aliases.d/mc, and rc.d/startx were the last holdouts still using `which` to check tool availability. Every other file in rc.d/* already uses `command -v`, which doesn't depend on an external binary being installed. --- aliases.d/mc | 2 +- rc.d/anyenv | 2 +- rc.d/screen | 2 +- rc.d/startx | 4 ++-- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/aliases.d/mc b/aliases.d/mc index bb6d78f..d1393d5 100644 --- a/aliases.d/mc +++ b/aliases.d/mc @@ -1,4 +1,4 @@ -if (which mc &> /dev/null); then +if (command -v mc &> /dev/null); then if [ "${TERM}" = "rxvt-unicode" ]; then alias mc="TERM=rxvt-unicode-256color mc" fi diff --git a/rc.d/anyenv b/rc.d/anyenv index f9b25ae..582740f 100644 --- a/rc.d/anyenv +++ b/rc.d/anyenv @@ -2,6 +2,6 @@ # git clone https://github.com/riywo/anyenv ${HOME}/.anyenv -if (which anyenv &>/dev/null); then +if (command -v anyenv &>/dev/null); then eval "$(anyenv init -)" fi diff --git a/rc.d/screen b/rc.d/screen index 45dfd9f..9c025be 100644 --- a/rc.d/screen +++ b/rc.d/screen @@ -1,5 +1,5 @@ # GNU Screen stuff -if ( which screen &> /dev/null ) +if ( command -v screen &> /dev/null ) then if [[ ${TERM} != screen* ]] then diff --git a/rc.d/startx b/rc.d/startx index 1a3ad9f..4370d35 100644 --- a/rc.d/startx +++ b/rc.d/startx @@ -13,12 +13,12 @@ if [[ -z "${DISPLAY}" && $(id -u) -ge 1000 ]] ; then 3) VT=vt3 ;; esac - if ( which ck-launch-session &> /dev/null ) + if ( command -v ck-launch-session &> /dev/null ) then EXEC="exec ck-launch-session" fi - if ( which startx &> /dev/null ) + if ( command -v startx &> /dev/null ) then ${EXEC} startx 1> ~/.log/xsession-errors 2>&1 -- "${VT}" fi -- 2.43.0 From 6738296acec405c86eb8c8bde588f1577d0f4a69 Mon Sep 17 00:00:00 2001 From: Xavier Logerais Date: Sat, 22 Aug 2026 00:46:27 +0200 Subject: [PATCH 05/14] fix: Remove dead and broken basedir() from _helpers.bash MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit basedir() had a broken escape ($(dirname \"$-2\") makes no sense) and was never called anywhere in the repo — it's a leftover copy of the already-deprecated libs.deprecated/basedir.bash. bashrc already has its own get_script_dir() for the same need, with proper symlink resolution. --- _helpers.bash | 4 ---- 1 file changed, 4 deletions(-) diff --git a/_helpers.bash b/_helpers.bash index b36ec1d..2e32a80 100644 --- a/_helpers.bash +++ b/_helpers.bash @@ -1,7 +1,3 @@ -function basedir() { - (cd "$(dirname \"$-2\")" && pwd) -} - function _source_file_if_exists() { if [ -r "$1" ]; then test -n "${DEBUG_BASHRC}" && echo "-- Sourcing file $1" -- 2.43.0 From 6968a933439036e7cc4f5540f0ec40e0fd346a1f Mon Sep 17 00:00:00 2001 From: Xavier Logerais Date: Sat, 22 Aug 2026 00:47:14 +0200 Subject: [PATCH 06/14] style: Normalize variable expansions in libs.deprecated/* These files stay deprecated and out of the sourcing path for now, but apply the same ${var} notation cleanup as the rest of the repo where it's a pure notation fix. basedir.bash is left untouched: its bug is a broken escape, not a notation issue, and it mirrors the one already removed from _helpers.bash. --- libs.deprecated/grepp.bash | 2 +- libs.deprecated/ldif.bash | 2 +- libs.deprecated/path.bash | 4 ++-- libs.deprecated/prompt_command.bash | 4 ++-- libs.deprecated/virtualization.bash | 4 ++-- 5 files changed, 8 insertions(+), 8 deletions(-) diff --git a/libs.deprecated/grepp.bash b/libs.deprecated/grepp.bash index 6e773e7..1cb57d5 100755 --- a/libs.deprecated/grepp.bash +++ b/libs.deprecated/grepp.bash @@ -1 +1 @@ -grepp() { x=$1; shift; perl -00ne ' print if /'"$x"'/i ' "$*" ; } +grepp() { x=$1; shift; perl -00ne ' print if /'"${x}"'/i ' "$*" ; } diff --git a/libs.deprecated/ldif.bash b/libs.deprecated/ldif.bash index 6839f53..9bfde65 100644 --- a/libs.deprecated/ldif.bash +++ b/libs.deprecated/ldif.bash @@ -12,5 +12,5 @@ function ldifparse () if (length) print next } - {print}' "$FILE" + {print}' "${FILE}" } diff --git a/libs.deprecated/path.bash b/libs.deprecated/path.bash index 2fa4c10..ea34809 100644 --- a/libs.deprecated/path.bash +++ b/libs.deprecated/path.bash @@ -1,8 +1,8 @@ #!/bin/bash _path_add() { - if [ -d "$1" ] && [[ ":$PATH:" != *":$1:"* ]]; then - PATH="${PATH:+"$PATH:"}$1" + if [ -d "$1" ] && [[ ":${PATH}:" != *":$1:"* ]]; then + PATH="${PATH:+"${PATH}:"}$1" fi } diff --git a/libs.deprecated/prompt_command.bash b/libs.deprecated/prompt_command.bash index ebc0d31..692c99a 100644 --- a/libs.deprecated/prompt_command.bash +++ b/libs.deprecated/prompt_command.bash @@ -1,8 +1,8 @@ #!/bin/bash _prompt_command_add() { - if [ -n "$1" ] && [[ ":$PROMPT_COMMAND:" != *":$1:"* ]]; then - PROMPT_COMMAND="${PROMPT_COMMAND:+"$PROMPT_COMMAND;"}$1" + if [ -n "$1" ] && [[ ":${PROMPT_COMMAND}:" != *":$1:"* ]]; then + PROMPT_COMMAND="${PROMPT_COMMAND:+"${PROMPT_COMMAND};"}$1" fi } diff --git a/libs.deprecated/virtualization.bash b/libs.deprecated/virtualization.bash index bf8b5c0..5593ab5 100755 --- a/libs.deprecated/virtualization.bash +++ b/libs.deprecated/virtualization.bash @@ -188,7 +188,7 @@ vm_create_magick2() { template=${3} # Define ressources based on template - case $template in + case ${template} in small) vcpus="1,maxvcpus=2" memory="1024,maxmemory=2048" @@ -262,7 +262,7 @@ _hypervisors() { if [ -e ~/.ssh/known_hosts ]; then known_hypervisors=$(cat ~/.ssh/known_hosts | cut -f 1 -d ' ' | sed -e 's/,.*//g' | grep -v "\[" | grep -i hypervisor | uniq) fi - echo $configured_hypervisors $known_hypervisors + echo "${configured_hypervisors}" "${known_hypervisors}" } #complete -W "$(cat ~/.ssh/config | egrep -i "^\s*host\s+[a-zA-Z]" | sed -e "s/^host\s*//i" | grep -i hypervisor)" hypervisor_connect -- 2.43.0 From d94d9177d3f0341b9028bc07cf215342fbc325c6 Mon Sep 17 00:00:00 2001 From: Xavier Logerais Date: Sat, 22 Aug 2026 00:47:34 +0200 Subject: [PATCH 07/14] chore: Remove orphaned z submodule reference from .gitmodules MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 3rd-party/z (rupa/z) was declared but the directory doesn't exist on disk, isn't in the git index, and nothing sources it — zoxide replaced it as the cd-frecency tool (see rc.d/zoxide). complete-alias and fzf-git.sh are left as-is; they still need to be initialized via the chezmoi-managed external config that clones this repo (separate task). --- .gitmodules | 3 --- 1 file changed, 3 deletions(-) diff --git a/.gitmodules b/.gitmodules index 412e75a..5e46db8 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,6 +1,3 @@ -[submodule "3rd-party/z"] - path = 3rd-party/z - url = https://github.com/rupa/z.git [submodule "3rd-party/complete-alias"] path = 3rd-party/complete-alias url = https://github.com/cykerway/complete-alias.git -- 2.43.0 From 5653b8caf0f7ae46044d48e24a5233abb098f90b Mon Sep 17 00:00:00 2001 From: Xavier Logerais Date: Sat, 22 Aug 2026 00:47:49 +0200 Subject: [PATCH 08/14] fix(rc): Prevent double-sourcing asdf when both native and Nix installs exist MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit rc.d/asdf tested native (~/.asdf) and Nix-profile asdf independently, so if both were present on a machine, asdf would be sourced twice — duplicate PATH entries and redefined completions/functions. Make the Nix branch an elif so at most one is sourced. --- rc.d/asdf | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/rc.d/asdf b/rc.d/asdf index e290032..74dcf54 100644 --- a/rc.d/asdf +++ b/rc.d/asdf @@ -6,9 +6,7 @@ if [ -f ~/.asdf/asdf.sh ]; then # activate completion source ~/.asdf/completions/asdf.bash -fi - -if [ -f "${HOME}/.nix-profile/share/asdf-vm/asdf.sh" ]; then +elif [ -f "${HOME}/.nix-profile/share/asdf-vm/asdf.sh" ]; then . "${HOME}/.nix-profile/share/asdf-vm/asdf.sh" . "${HOME}/.nix-profile/share/bash-completion/completions/asdf.bash" fi -- 2.43.0 From 6e01d0308eab27b9b59b49888fd9e135bc98620c Mon Sep 17 00:00:00 2001 From: Xavier Logerais Date: Sat, 22 Aug 2026 01:59:44 +0200 Subject: [PATCH 09/14] fix: Use _path_add for PATH entries appended at the end MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit profile.d/path and rc.d/rvm concatenated onto PATH directly, so re-sourcing them in the same shell (source ~/.bashrc, a resourced tmux pane, etc.) would duplicate entries. _path_add already guards against that and tests directory existence itself. profile.d/krew and profile.d/anyenv are left untouched: they prepend to PATH (to take priority over other entries), while _path_add always appends — converting them would silently change resolution order. --- profile.d/path | 8 ++++---- rc.d/rvm | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/profile.d/path b/profile.d/path index 3f8db46..f4465e4 100644 --- a/profile.d/path +++ b/profile.d/path @@ -1,6 +1,6 @@ # Customize PATH -if [ -d "${HOME}/.bin" ] ; then export PATH="${PATH}:${HOME}/.bin" ; fi -if [ -d "${HOME}/.local/bin" ] ; then export PATH="${PATH}:${HOME}/.local/bin" ; fi +_path_add "${HOME}/.bin" +_path_add "${HOME}/.local/bin" -if [ -d "${HOME}/bin" ] ; then export PATH="${PATH}:${HOME}/bin" ; fi -if [ -d "${HOME}/scripts" ] ; then export PATH="${PATH}:${HOME}/scripts" ; fi +_path_add "${HOME}/bin" +_path_add "${HOME}/scripts" diff --git a/rc.d/rvm b/rc.d/rvm index a14fc24..b270f08 100644 --- a/rc.d/rvm +++ b/rc.d/rvm @@ -5,4 +5,4 @@ [[ -r "${HOME}/.rvm/scripts/completion" ]] && source "${HOME}/.rvm/scripts/completion" # Add RVM to PATH for scripting -[[ -r "${HOME}/.rvm/bin" ]] && PATH="${PATH}:${HOME}/.rvm/bin" +[[ -r "${HOME}/.rvm/bin" ]] && _path_add "${HOME}/.rvm/bin" -- 2.43.0 From a92c1c340f11a5e044f91c766430b31910a05fde Mon Sep 17 00:00:00 2001 From: Xavier Logerais Date: Sat, 22 Aug 2026 02:03:17 +0200 Subject: [PATCH 10/14] fix(bashrc): Stop manually re-sourcing system bash completion MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The removed loop tried to source /etc/bash*completion and /etc/profile.d/bash*completion* by hand, with two real problems: nullglob wasn't enabled for it (unlike everywhere else via _source_dir_files), so an empty match sourced the literal glob pattern and errored — the TODO already flagged this. It also re-sourced /etc/profile.d/bash_completion.sh, a script meant for /etc/profile on login shells, not for being re-run from an interactive-only ~/.bashrc. On a properly packaged system, bash-completion wires itself up already (confirmed here via /etc/profile.d/bash_completion.sh and progcomp being on by default) — this loop was dead weight at best and a source of environment-dependent breakage at worst (seen previously on Termux, where /etc doesn't have the same layout). --- bashrc | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/bashrc b/bashrc index 96d5a05..58e4b1b 100644 --- a/bashrc +++ b/bashrc @@ -79,8 +79,10 @@ _source_dir_files "${BASH_CONFIG_DIR}"/aliases _source_dir_files "${BASH_CONFIG_DIR}"/aliases.d # Source bash completion definitions -# TODO: Améliorer cette partie pour éviter les erreurs quand aucun fichier n'existe -for file in /etc/bash*completion /etc/profile.d/bash*completion*; do source "${file}"; done +# System-wide bash completion (bash-completion package) is expected to +# already be wired by the distro itself, typically via +# /etc/profile.d/bash_completion.sh for login shells and the package's +# own non-login hook — no need to re-source it manually here. _source_file_if_exists ~/.bash_completion _source_file_if_exists "${BASH_CONFIG_DIR}"/completion -- 2.43.0 From bbcf389acee3dd5f23ae7a90395b056509a16ae3 Mon Sep 17 00:00:00 2001 From: Xavier Logerais Date: Sat, 22 Aug 2026 02:10:04 +0200 Subject: [PATCH 11/14] feat: Split _path_add into _path_append and _path_prepend MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit _path_add only ever appended to PATH, which didn't fit profile.d/krew and profile.d/anyenv (they prepend, to take priority). Rename it to _path_append for clarity and add _path_prepend alongside it, so both orderings get the same dedup guard when needed — krew and anyenv aren't converted yet, kept as plain PATH concatenation until then. --- _helpers.bash | 8 +++++++- profile.d/path | 8 ++++---- rc.d/rvm | 2 +- 3 files changed, 12 insertions(+), 6 deletions(-) diff --git a/_helpers.bash b/_helpers.bash index 2e32a80..aa3970c 100644 --- a/_helpers.bash +++ b/_helpers.bash @@ -25,12 +25,18 @@ function _source_dir_files() { } # Source : https://superuser.com/questions/39751/add-directory-to-path-if-its-not-already-there -_path_add() { +_path_append() { if [ -d "$1" ] && [[ ":${PATH}:" != *":$1:"* ]]; then PATH="${PATH:+"${PATH}:"}$1" fi } +_path_prepend() { + if [ -d "$1" ] && [[ ":${PATH}:" != *":$1:"* ]]; then + PATH="$1${PATH:+":${PATH}"}" + fi +} + _prompt_command_add() { if [ -n "$1" ] && [[ ":${PROMPT_COMMAND}:" != *":$1:"* ]]; then PROMPT_COMMAND="${PROMPT_COMMAND:+"${PROMPT_COMMAND};"}$1" diff --git a/profile.d/path b/profile.d/path index f4465e4..b5e1bba 100644 --- a/profile.d/path +++ b/profile.d/path @@ -1,6 +1,6 @@ # Customize PATH -_path_add "${HOME}/.bin" -_path_add "${HOME}/.local/bin" +_path_append "${HOME}/.bin" +_path_append "${HOME}/.local/bin" -_path_add "${HOME}/bin" -_path_add "${HOME}/scripts" +_path_append "${HOME}/bin" +_path_append "${HOME}/scripts" diff --git a/rc.d/rvm b/rc.d/rvm index b270f08..b0ed113 100644 --- a/rc.d/rvm +++ b/rc.d/rvm @@ -5,4 +5,4 @@ [[ -r "${HOME}/.rvm/scripts/completion" ]] && source "${HOME}/.rvm/scripts/completion" # Add RVM to PATH for scripting -[[ -r "${HOME}/.rvm/bin" ]] && _path_add "${HOME}/.rvm/bin" +[[ -r "${HOME}/.rvm/bin" ]] && _path_append "${HOME}/.rvm/bin" -- 2.43.0 From f24e250f77a90d3c5ef4a62556cf32ddd367c381 Mon Sep 17 00:00:00 2001 From: Xavier Logerais Date: Sat, 22 Aug 2026 02:10:52 +0200 Subject: [PATCH 12/14] fix: Use _path_prepend in profile.d/krew and profile.d/anyenv MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Both prepended to PATH directly, so re-sourcing them in the same shell would duplicate entries — same issue _path_append already fixed for profile.d/path and rc.d/rvm. _path_prepend keeps the same priority ordering (these paths still take precedence over the rest of PATH) while adding the dedup guard. --- profile.d/anyenv | 5 +---- profile.d/krew | 2 +- 2 files changed, 2 insertions(+), 5 deletions(-) diff --git a/profile.d/anyenv b/profile.d/anyenv index 4d9808a..2798166 100644 --- a/profile.d/anyenv +++ b/profile.d/anyenv @@ -2,7 +2,4 @@ # git clone https://github.com/riywo/anyenv ${HOME}/.anyenv -if [ -d "${HOME}/.anyenv/bin" ] -then - export PATH="${HOME}/.anyenv/bin:${PATH}" -fi +_path_prepend "${HOME}/.anyenv/bin" diff --git a/profile.d/krew b/profile.d/krew index 3497bbf..e570dfb 100644 --- a/profile.d/krew +++ b/profile.d/krew @@ -1,3 +1,3 @@ if (command -v krew &>/dev/null); then - export PATH="${KREW_ROOT:-${HOME}/.krew}/bin:${PATH}" + _path_prepend "${KREW_ROOT:-${HOME}/.krew}/bin" fi -- 2.43.0 From 1a7a850efaff3d95e6ec6c7fcf92280494bcca09 Mon Sep 17 00:00:00 2001 From: Xavier Logerais Date: Sat, 22 Aug 2026 02:16:49 +0200 Subject: [PATCH 13/14] fix: Simplify create-links.bash path resolution MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Replace the ~30-line get_script_dir() copy (duplicated a third time from bashrc/bash_profile) with a one-liner. This script is always executed directly, never sourced from another file, so BASH_SOURCE[0] reliably points to itself — the extra logic in get_script_dir() for the sourced-from-elsewhere case doesn't apply here. --- create-links.bash | 32 +------------------------------- 1 file changed, 1 insertion(+), 31 deletions(-) diff --git a/create-links.bash b/create-links.bash index 092be28..04a2653 100755 --- a/create-links.bash +++ b/create-links.bash @@ -2,37 +2,7 @@ # Define the path to the directory of this file if not already set if [ -z "${BASH_CONFIG_DIR}" ]; then - # Define a function to get the real path of a script - # (works for most cases : either sourced script or executed script, posix shells) - get_script_dir() { - local target - # Si appelé depuis un script (Bash), on regarde qui a appelé la fonction (${BASH_SOURCE[1]}) - # Si la fonction est exécutée directement dans le terminal, on se rabat sur ${BASH_SOURCE[0]} ou ${0} - if [ -n "${BASH_SOURCE}" ]; then - if [ "${#BASH_SOURCE[@]}" -gt 1 ]; then - target="${BASH_SOURCE[1]}" - else - target="${BASH_SOURCE[0]}" - fi - elif [ -n "${ZSH_VERSION}" ]; then - target="${(%):-%x}" - else - target="${0}" - fi - - # Résolution des liens symboliques POSIX - while [ -L "${target}" ]; do - local link - link=$(readlink "${target}") - case "${link}" in - /*) target="${link}" ;; - *) target="$(dirname "${target}")/${link}" ;; - esac - done - - (cd "$(dirname "${target}")" && pwd -P) - } - BASH_CONFIG_DIR=$(get_script_dir) + BASH_CONFIG_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd -P)" fi cd "${HOME}" || exit 1 -- 2.43.0 From 874d55625ce37e18e8943ef1d8f69ba2b09ec725 Mon Sep 17 00:00:00 2001 From: Xavier Logerais Date: Sun, 23 Aug 2026 16:17:05 +0200 Subject: [PATCH 14/14] fix: Try to fix completion --- bashrc | 13 +++++++++++++ completion.d/mise | 2 +- 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/bashrc b/bashrc index 58e4b1b..eaf82b1 100644 --- a/bashrc +++ b/bashrc @@ -84,6 +84,19 @@ _source_dir_files "${BASH_CONFIG_DIR}"/aliases.d # /etc/profile.d/bash_completion.sh for login shells and the package's # own non-login hook — no need to re-source it manually here. +# Use bash-completion, if available, and avoid double-sourcing +[[ $PS1 && + ! ${BASH_COMPLETION_VERSINFO:-} && + -f /usr/share/bash-completion/bash_completion ]] && + . /usr/share/bash-completion/bash_completion + +# Location for user bash completion +# ${BASH_COMPLETION_USER_DIR:-${XDG_DATA_HOME:-$HOME/.local/share}/bash-completion}/completions + +# See https://serverfault.com/questions/506612/standard-place-for-user-defined-bash-completion-d-scripts +# Recommended dirs +# - ~/.bash_completion.d -> ${XDG_DATA_HOME:-$HOME/.local/share}/bash-completion +# - ~/.bash_completion -> ${XDG_CONFIG_HOME:-$HOME/.config}/bash_completion _source_file_if_exists ~/.bash_completion _source_file_if_exists "${BASH_CONFIG_DIR}"/completion _source_dir_files "${BASH_CONFIG_DIR}"/completion diff --git a/completion.d/mise b/completion.d/mise index 93344fb..36f824d 100644 --- a/completion.d/mise +++ b/completion.d/mise @@ -1,3 +1,3 @@ if (command -v mise &>/dev/null); then - source <(mise completion bash --include-bash-completion-lib) + source <(mise completion bash) fi -- 2.43.0