From 3b177d8c95f70db8e27fd046711f480e81ea3fa7 Mon Sep 17 00:00:00 2001 From: Case Duckworth Date: Sun, 16 Apr 2023 17:06:22 -0500 Subject: uhhhh --- bash/aliases.bash | 2 +- bash/completion.bash | 4 ++-- bash/emacs.bash | 2 +- bash/functions.bash | 2 +- bash/prompt.bash | 25 ++++++++++++++++--------- bash/z.bash | 2 +- 6 files changed, 22 insertions(+), 15 deletions(-) (limited to 'bash') diff --git a/bash/aliases.bash b/bash/aliases.bash index 0132d33..6515873 100644 --- a/bash/aliases.bash +++ b/bash/aliases.bash @@ -20,7 +20,7 @@ alias ll='ls -l' alias tree='tree -F' # make locally -alias lake='make PREFIX=$LOCAL_PATH ' +alias lake='make PREFIX=$LOCAL_PREFIX ' # bash meta alias rebash='source ~/.bash_profile' diff --git a/bash/completion.bash b/bash/completion.bash index 764463e..2b3ca37 100644 --- a/bash/completion.bash +++ b/bash/completion.bash @@ -2,14 +2,14 @@ # Source bash completion libraries POSSIBLE_COMPLETION_FILES=( - /etc/bash_completion # Debian + /etc/bash_completion # Debian /etc/profile.d/bash_completion.sh # Alpine # I'm sure there are many more + /usr/share/bash-completion/bash_completion ) for candidate in "${POSSIBLE_COMPLETION_FILES[@]}"; do if [[ -r "$candidate" ]]; then source "$candidate" - break # XXX: Do I want this? fi done diff --git a/bash/emacs.bash b/bash/emacs.bash index 188c64f..3b7bb64 100644 --- a/bash/emacs.bash +++ b/bash/emacs.bash @@ -18,7 +18,7 @@ setup_vterm() { setup_emacs_shell() { export PAGER=cat - export PS1='\w \$ ' + # export PS1='\w \$ ' } # CONSIDER: Could this go in ~/.profile ? diff --git a/bash/functions.bash b/bash/functions.bash index 97f89b8..debea2c 100644 --- a/bash/functions.bash +++ b/bash/functions.bash @@ -81,7 +81,7 @@ f() { } words() { - grep "$1" /usr/share/dict/words + grep -E "$1" /usr/share/dict/words } if ! command -v dict >/dev/null 2>&1; then diff --git a/bash/prompt.bash b/bash/prompt.bash index f09d3ab..bee5223 100644 --- a/bash/prompt.bash +++ b/bash/prompt.bash @@ -26,13 +26,7 @@ __prompt_exit_code() { # __prompt_exit_code CODES... printf '%s\n' "$ec" } -two_line_prompt() { - PS1= - - # user, host, and cwd - PROMPT_DIRTRIM=3 # how many dirs above current to print (rest are '...') - PS1+='\[\e[0;46m\]\u@\h \w' - +git_prompt_integration() { # git bit # see https://unix.stackexchange.com/questions/278206 possible_git_prompt_locations=( @@ -45,10 +39,18 @@ two_line_prompt() { for file in "${possible_git_prompt_locations[@]}"; do if [[ -f "$file" ]]; then source "$file" && - PS1+='\[\e[0m\]\[\e[35m\]$(__git_ps1)' + PS1+='\[\e[35m\]$(__git_ps1) \[\e[0m\]' break fi done +} + +two_line_prompt() { + PS1= + + # user, host, and cwd + PROMPT_DIRTRIM=3 # how many dirs above current to print (rest are '...') + PS1+='\[\e[0;46m\]\u@\h \w' # newline PS1+='\[\e[0m\]\n' @@ -62,7 +64,12 @@ two_line_prompt() { smiley_prompt() { __prompt_ec() { case $? in 0) echo '^_^' ;; *) echo ';_;' ;; esac } - PS1='\[\e[1m\]$(__prompt_exit_code "ok=^_^" "fail=;_;") \w\[\e[0m\] ' + + PS1='\[\e[33m\]$(__prompt_exit_code "ok=^_^" "fail=;_;")' + PS1+=' \w\[\e[0m\]' + + git_prompt_integration + PS1+='\[$(__prompt_term_title "$USER@$(hostname): $PWD")\]' PS1+='\$ ' } diff --git a/bash/z.bash b/bash/z.bash index d84fd55..0f644c7 100644 --- a/bash/z.bash +++ b/bash/z.bash @@ -3,7 +3,7 @@ zlua="$HOME/misc/z.lua/z.lua" -if [ -f "$zlua" ]; then +if [ -x "$zlua" ]; then export _ZL_DATA="${XDG_DATA_HOME:-$LOCAL_PREFIX/share}/zlua" eval "$(lua "$zlua" --init bash enhanced once)" fi -- cgit 1.4.1-21-gabe81