aboutsummaryrefslogtreecommitdiff
path: root/.bashrc
diff options
context:
space:
mode:
authorRaul Benencia <rul@kalgan.cc>2023-10-05 15:50:55 -0700
committerRaul Benencia <rul@kalgan.cc>2023-10-05 15:51:07 -0700
commit97feff48540fda9a30b388ab55be615eb7fdf460 (patch)
treea1f3f219327dec33b96475fdbde21ea6662d7048 /.bashrc
parent2439904a6dff5b27de9590028cb5bfd19db6e335 (diff)
bash: support bashrc.post
Diffstat (limited to '.bashrc')
-rw-r--r--.bashrc58
1 files changed, 31 insertions, 27 deletions
diff --git a/.bashrc b/.bashrc
index d170ef9..a9003ee 100644
--- a/.bashrc
+++ b/.bashrc
@@ -7,6 +7,9 @@ if [ -f $HOME/.environment ]; then
. $HOME/.environment
fi
+export HISTFILESIZE=
+export HISTSIZE=
+
eval `dircolors 2>/dev/null`
# don't put duplicate lines in the history
@@ -33,12 +36,12 @@ stty -ixon
# enable completion
if [ -f /etc/bash_completion ]; then
- . /etc/bash_completion
+ . /etc/bash_completion
fi
# enable fzf completion if available
if [ -f /usr/share/bash-completion/completions/fzf ]; then
- . /usr/share/bash-completion/completions/fzf
+ . /usr/share/bash-completion/completions/fzf
fi
if [ -f /usr/share/doc/fzf/examples/key-bindings.bash ]; then
@@ -55,7 +58,7 @@ fi
# aliases
if [ -e ~/.alias.d/ ]; then
for e in $(find ~/.alias.d/ -type l,f | sort); do
- . $e
+ . $e
done
fi
@@ -78,49 +81,50 @@ vterm_prompt_end(){
}
update_title () {
- printf "\e]0;$USER@$HOSTNAME: %s\a" "$1"
+ printf "\e]0;$USER@$HOSTNAME: %s\a" "$1"
}
# Update title before executing a command: set it to the full command
show_command () {
- this_command="`history 1`"
- update_title "${this_command/+([ ])+([0-9])+([ ])/}"
+ this_command="`history 1`"
+ update_title "${this_command/+([ ])+([0-9])+([ ])/}"
}
# Things to do before displaying the command prompt, including printing
# nonzero exit status of the last run command, and setting the git branch.
prompt_command_notitle () {
- local code="$?"
- if [ "$code" -ne 0 ]; then
- echo "- exit $code"
- fi
-
- local fullbranch="$(cat .git/HEAD 2>/dev/null)"
- if [ "$fullbranch" = "" ]; then
- local fullbranch="$(git symbolic-ref HEAD 2>/dev/null)"
- fi
- local branch="${fullbranch##ref: }"
- vcsinfo="${branch:+#${branch##refs/heads/}}"
+ local code="$?"
+ if [ "$code" -ne 0 ]; then
+ echo "- exit $code"
+ fi
+
+ local fullbranch="$(cat .git/HEAD 2>/dev/null)"
+ if [ "$fullbranch" = "" ]; then
+ local fullbranch="$(git symbolic-ref HEAD 2>/dev/null)"
+ fi
+ local branch="${fullbranch##ref: }"
+ vcsinfo="${branch:+#${branch##refs/heads/}}"
}
prompt_command () {
- prompt_command_notitle
- update_title
+ prompt_command_notitle
+ update_title
}
PS1='\u@\h:\w$vcsinfo> '
case "$TERM" in
xterm*|rxvt*|screen)
- PS1="\[\e]0;\u@\h:\w\a\]$PS1"'\[$(vterm_prompt_end)\]'
- trap show_command DEBUG
- PROMPT_COMMAND=prompt_command
- ;;
+ PS1="\[\e]0;\u@\h:\w\a\]$PS1"'\[$(vterm_prompt_end)\]'
+ trap show_command DEBUG
+ PROMPT_COMMAND=prompt_command
+ ;;
*)
PS1=$PS1'\[$(vterm_prompt_end)\]'
- PROMPT_COMMAND=prompt_command_notitle
- ;;
+ PROMPT_COMMAND=prompt_command_notitle
+ ;;
esac
-export HISTFILESIZE=
-export HISTSIZE=
+if [ -e ~/.bashrc.post ]; then
+ . ~/.bashrc.post
+fi
nihil fit ex nihilo