about summary refs log tree commit diff stats
path: root/bash
diff options
context:
space:
mode:
Diffstat (limited to 'bash')
-rw-r--r--bash/aliases.bash2
-rw-r--r--bash/completion.bash4
-rw-r--r--bash/emacs.bash2
-rw-r--r--bash/functions.bash2
-rw-r--r--bash/prompt.bash25
-rw-r--r--bash/z.bash2
6 files changed, 22 insertions, 15 deletions
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'
20alias tree='tree -F' 20alias tree='tree -F'
21 21
22# make locally 22# make locally
23alias lake='make PREFIX=$LOCAL_PATH ' 23alias lake='make PREFIX=$LOCAL_PREFIX '
24 24
25# bash meta 25# bash meta
26alias rebash='source ~/.bash_profile' 26alias 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 @@
2# Source bash completion libraries 2# Source bash completion libraries
3 3
4POSSIBLE_COMPLETION_FILES=( 4POSSIBLE_COMPLETION_FILES=(
5 /etc/bash_completion # Debian 5 /etc/bash_completion # Debian
6 /etc/profile.d/bash_completion.sh # Alpine 6 /etc/profile.d/bash_completion.sh # Alpine
7 # I'm sure there are many more 7 # I'm sure there are many more
8 /usr/share/bash-completion/bash_completion
8) 9)
9 10
10for candidate in "${POSSIBLE_COMPLETION_FILES[@]}"; do 11for candidate in "${POSSIBLE_COMPLETION_FILES[@]}"; do
11 if [[ -r "$candidate" ]]; then 12 if [[ -r "$candidate" ]]; then
12 source "$candidate" 13 source "$candidate"
13 break # XXX: Do I want this?
14 fi 14 fi
15done 15done
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() {
18 18
19setup_emacs_shell() { 19setup_emacs_shell() {
20 export PAGER=cat 20 export PAGER=cat
21 export PS1='\w \$ ' 21 # export PS1='\w \$ '
22} 22}
23 23
24# CONSIDER: Could this go in ~/.profile ? 24# 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() {
81} 81}
82 82
83words() { 83words() {
84 grep "$1" /usr/share/dict/words 84 grep -E "$1" /usr/share/dict/words
85} 85}
86 86
87if ! command -v dict >/dev/null 2>&1; then 87if ! 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...
26 printf '%s\n' "$ec" 26 printf '%s\n' "$ec"
27} 27}
28 28
29two_line_prompt() { 29git_prompt_integration() {
30 PS1=
31
32 # user, host, and cwd
33 PROMPT_DIRTRIM=3 # how many dirs above current to print (rest are '...')
34 PS1+='\[\e[0;46m\]\u@\h \w'
35
36 # git bit 30 # git bit
37 # see https://unix.stackexchange.com/questions/278206 31 # see https://unix.stackexchange.com/questions/278206
38 possible_git_prompt_locations=( 32 possible_git_prompt_locations=(
@@ -45,10 +39,18 @@ two_line_prompt() {
45 for file in "${possible_git_prompt_locations[@]}"; do 39 for file in "${possible_git_prompt_locations[@]}"; do
46 if [[ -f "$file" ]]; then 40 if [[ -f "$file" ]]; then
47 source "$file" && 41 source "$file" &&
48 PS1+='\[\e[0m\]\[\e[35m\]$(__git_ps1)' 42 PS1+='\[\e[35m\]$(__git_ps1) \[\e[0m\]'
49 break 43 break
50 fi 44 fi
51 done 45 done
46}
47
48two_line_prompt() {
49 PS1=
50
51 # user, host, and cwd
52 PROMPT_DIRTRIM=3 # how many dirs above current to print (rest are '...')
53 PS1+='\[\e[0;46m\]\u@\h \w'
52 54
53 # newline 55 # newline
54 PS1+='\[\e[0m\]\n' 56 PS1+='\[\e[0m\]\n'
@@ -62,7 +64,12 @@ two_line_prompt() {
62 64
63smiley_prompt() { 65smiley_prompt() {
64 __prompt_ec() { case $? in 0) echo '^_^' ;; *) echo ';_;' ;; esac } 66 __prompt_ec() { case $? in 0) echo '^_^' ;; *) echo ';_;' ;; esac }
65 PS1='\[\e[1m\]$(__prompt_exit_code "ok=^_^" "fail=;_;") \w\[\e[0m\] ' 67
68 PS1='\[\e[33m\]$(__prompt_exit_code "ok=^_^" "fail=;_;")'
69 PS1+=' \w\[\e[0m\]'
70
71 git_prompt_integration
72
66 PS1+='\[$(__prompt_term_title "$USER@$(hostname): $PWD")\]' 73 PS1+='\[$(__prompt_term_title "$USER@$(hostname): $PWD")\]'
67 PS1+='\$ ' 74 PS1+='\$ '
68} 75}
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 @@
3 3
4zlua="$HOME/misc/z.lua/z.lua" 4zlua="$HOME/misc/z.lua/z.lua"
5 5
6if [ -f "$zlua" ]; then 6if [ -x "$zlua" ]; then
7 export _ZL_DATA="${XDG_DATA_HOME:-$LOCAL_PREFIX/share}/zlua" 7 export _ZL_DATA="${XDG_DATA_HOME:-$LOCAL_PREFIX/share}/zlua"
8 eval "$(lua "$zlua" --init bash enhanced once)" 8 eval "$(lua "$zlua" --init bash enhanced once)"
9fi 9fi