diff --git a/cmd/fmt/main.go b/cmd/fmt/main.go index 1b9290b4..f89250eb 100644 --- a/cmd/fmt/main.go +++ b/cmd/fmt/main.go @@ -16,7 +16,7 @@ func main() { } fsys := os.DirFS(wd) - bashPaths, err := doublestar.Glob(fsys, "./**/*.bash") + bashPaths, err := doublestar.Glob(fsys, "./**/{*.bash,.bash*}") if err != nil { log.Fatalln(err) } diff --git a/cmd/lint/main.go b/cmd/lint/main.go index eeae2fcf..b3956d92 100644 --- a/cmd/lint/main.go +++ b/cmd/lint/main.go @@ -16,7 +16,7 @@ func main() { } fsys := os.DirFS(wd) - bashPaths, err := doublestar.Glob(fsys, "./**/*.bash") + bashPaths, err := doublestar.Glob(fsys, "./**/{*.bash,.bash*}") if err != nil { log.Fatalln(err) } diff --git a/home/.bash_logout b/home/.bash_logout index de4f5f75..757de801 100644 --- a/home/.bash_logout +++ b/home/.bash_logout @@ -1,7 +1,8 @@ +#!/usr/bin/env bash # ~/.bash_logout: executed by bash(1) when login shell exits. # when leaving the console clear the screen to increase privacy if [ "$SHLVL" = 1 ]; then - [ -x /usr/bin/clear_console ] && /usr/bin/clear_console -q + [ -x /usr/bin/clear_console ] && /usr/bin/clear_console -q fi diff --git a/home/.bashrc b/home/.bashrc index 6676c335..9b02d387 100644 --- a/home/.bashrc +++ b/home/.bashrc @@ -46,7 +46,7 @@ HISTFILESIZE=4200000 # nix develop # the executed nix-shell does NOT have problems, so you can wrap as starship # bash # this nested bash HAS problems without following ps... condition. if [[ -n "$IN_NIX_SHELL" && "$(ps -o uid= $PPID)" -eq "$UID" ]]; then - in_nested_nix_bash="true" + in_nested_nix_bash="true" fi # check the window size after each command and, if necessary, @@ -62,7 +62,7 @@ shopt -s checkwinsize # set variable identifying the chroot you work in (used in the prompt below) if [ -z "${debian_chroot:-}" ] && [ -r /etc/debian_chroot ]; then - debian_chroot=$(cat /etc/debian_chroot) + debian_chroot=$(cat /etc/debian_chroot) fi # set a fancy prompt (non-color, unless we know we "want" color) @@ -76,44 +76,44 @@ esac #force_color_prompt=yes if [ -n "$force_color_prompt" ]; then - if [ -x /usr/bin/tput ] && tput setaf 1 >&/dev/null; then - # We have color support; assume it's compliant with Ecma-48 - # (ISO/IEC-6429). (Lack of such support is extremely rare, and such - # a case would tend to support setf rather than setaf.) - color_prompt=yes - else - color_prompt= - fi + if [ -x /usr/bin/tput ] && tput setaf 1 >&/dev/null; then + # We have color support; assume it's compliant with Ecma-48 + # (ISO/IEC-6429). (Lack of such support is extremely rare, and such + # a case would tend to support setf rather than setaf.) + color_prompt=yes + else + color_prompt= + fi fi if [ "$color_prompt" = yes ] && [ -z "$in_nested_nix_bash" ]; then - PS1='${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\[\033[01;34m\]\w\[\033[00m\]\$ ' + PS1='${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\[\033[01;34m\]\w\[\033[00m\]\$ ' else - PS1='${debian_chroot:+($debian_chroot)}\w\$ ' + PS1='${debian_chroot:+($debian_chroot)}\w\$ ' fi unset color_prompt force_color_prompt if [ -z "$in_nested_nix_bash" ]; then - # If this is an xterm set the title to user@host:dir - case "$TERM" in - xterm* | rxvt*) - PS1="\[\e]0;${debian_chroot:+($debian_chroot)} \w\a\]$PS1" - ;; - *) ;; - - esac + # If this is an xterm set the title to user@host:dir + case "$TERM" in + xterm* | rxvt*) + PS1="\[\e]0;${debian_chroot:+($debian_chroot)} \w\a\]$PS1" + ;; + *) ;; + + esac fi # enable color support of ls and also add handy aliases if [ -x /usr/bin/dircolors ]; then - (test -r ~/.dircolors && eval "$(dircolors -b ~/.dircolors)") || eval "$(dircolors -b)" - alias ls='ls --color=auto' - #alias dir='dir --color=auto' - #alias vdir='vdir --color=auto' - - alias grep='grep --color=auto' - alias fgrep='fgrep --color=auto' - alias egrep='egrep --color=auto' + (test -r ~/.dircolors && eval "$(dircolors -b ~/.dircolors)") || eval "$(dircolors -b)" + alias ls='ls --color=auto' + #alias dir='dir --color=auto' + #alias vdir='vdir --color=auto' + + alias grep='grep --color=auto' + alias fgrep='fgrep --color=auto' + alias egrep='egrep --color=auto' fi # colored GCC warnings and errors @@ -134,46 +134,46 @@ alias alert='notify-send --urgency=low -i "$([ $? = 0 ] && echo terminal || echo # See /usr/share/doc/bash-doc/examples in the bash-doc package. if [ -f ~/.bash_aliases ]; then - . ~/.bash_aliases + . ~/.bash_aliases fi # enable programmable completion features (you don't need to enable # this, if it's already enabled in /etc/bash.bashrc and /etc/profile # sources /etc/bash.bashrc). if ! shopt -oq posix && [ -z "$in_nested_nix_bash" ]; then - if [ -f /usr/share/bash-completion/bash_completion ]; then - . /usr/share/bash-completion/bash_completion - elif [ -f /etc/bash_completion ]; then - . /etc/bash_completion - fi + if [ -f /usr/share/bash-completion/bash_completion ]; then + . /usr/share/bash-completion/bash_completion + elif [ -f /etc/bash_completion ]; then + . /etc/bash_completion + fi fi if [ -e "$HOME/.nix-profile/etc/profile.d/hm-session-vars.sh" ]; then . "$HOME/.nix-profile/etc/profile.d/hm-session-vars.sh"; fi # https://github.com/Bash-it/bash-it/blob/00062bfcb6c6a68cd2c9d2c76ed764e01e930e87/plugins/available/history-substring-search.plugin.bash if [[ ${SHELLOPTS} =~ (vi|emacs) ]]; then - bind '"\e[A":history-substring-search-backward' - bind '"\e[B":history-substring-search-forward' + bind '"\e[A":history-substring-search-backward' + bind '"\e[B":history-substring-search-forward' fi if command -v fzf-share >/dev/null && [ -z "$in_nested_nix_bash" ]; then - source "$(fzf-share)/key-bindings.bash" - source "$(fzf-share)/completion.bash" + source "$(fzf-share)/key-bindings.bash" + source "$(fzf-share)/completion.bash" fi # # Delegate history search with "Up arrow key" to fzf # bind '"\C-\e[A":"\C-r"' if [ -n "$in_nested_nix_bash" ]; then - # readlink - https://iww.hateblo.jp/entry/20131108/dash - PS1="${IN_NIX_SHELL} - $(readlink /proc/$$/exe)\n$PS1" + # readlink - https://iww.hateblo.jp/entry/20131108/dash + PS1="${IN_NIX_SHELL} - $(readlink /proc/$$/exe)\n$PS1" else - eval "$(starship init bash)" + eval "$(starship init bash)" fi # https://github.com/starship/starship/blob/0d98c4c0b7999f5a8bd6e7db68fd27b0696b3bef/docs/uk-UA/advanced-config/README.md#change-window-title function set_win_title() { - echo -ne "\033]0; $(basename "$PWD") \007" + echo -ne "\033]0; $(basename "$PWD") \007" } # shellcheck disable=SC2034 starship_precmd_user_func="set_win_title"