mirror of
https://github.com/notwa/rc
synced 2024-10-31 17:04:35 -07:00
Connor Olding
a2ae5a212d
the reason for the hyphen is that i was originally concerned about random shells executing the file when i didn't want them to. back then, i was only targetting zsh and bash, and therefore `~/.-shrc` was not yet suitable for any other shells. nowadays, `~/.-shrc` is has better shell compatibility, and i'm not actually aware of any shells that would execute `~/.shrc` by default -- `$ENV` is typically required to be set.
52 lines
1.4 KiB
Bash
52 lines
1.4 KiB
Bash
[ -z "$PS1" ] && return
|
|
. ~/.prep # handle boring stuff like /etc/profile and $PATH
|
|
|
|
HISTCONTROL=erasedups
|
|
HISTSIZE=1000
|
|
HISTFILESIZE=2000
|
|
|
|
shopt -s histappend
|
|
shopt -s checkwinsize
|
|
#shopt -s physical # chaselinks (doesn't exist?)
|
|
set -o hashall # enable hash command
|
|
|
|
[ "$TERM" != rxvt-unicode-256color ] || export TERM=xterm-256color
|
|
|
|
t="${TERM%%-*}"
|
|
if [ "$t" = xterm ] || [ "$t" = screen ] || [ "$t" = tmux ]; then
|
|
_title="\[\033]2;\w\a\]"
|
|
else
|
|
_title=""
|
|
fi
|
|
unset t
|
|
|
|
Csucc=$'\\[\e[42m\\]'
|
|
Cfail=$'\\[\e[41m\\]'
|
|
_line1=$' \\[\e[0m\\]'
|
|
_line2=$'\\[\e[1;37m\\]\\$\\[\e[0m\\] '
|
|
ret_succ="$_title${Csucc}$_line1\n${Csucc}$_line2"
|
|
ret_fail="$_title${Cfail}$_line1\n${Cfail}$_line2"
|
|
|
|
PROMPT_COMMAND='[ $? = 0 ] && PS1=${ret_succ} || PS1=${ret_fail}'
|
|
|
|
. ~/.shrc
|
|
|
|
# this doesn't work for all scripts at the moment, but
|
|
ADDPATH "$HOME/sh"
|
|
|
|
(
|
|
# combine everything matching "YES_BASH" in ~/sh/ into ~/.sh-bash.
|
|
# unlike zsh, we do not check the sha1sum of the output.
|
|
cd ~/sh \
|
|
&& printf "%s\n" '#!/usr/bin/env false' '[ -n "$preload" ] || exit 1' '' \
|
|
| cat - $(grep -lF YES_BASH -- $(find ~/sh/ -maxdepth 1 -type f '!' -name '*.bak')) \
|
|
> ~/.sh-bash
|
|
)
|
|
|
|
dummy() { :; } ### @- return 0, ignoring arguments.
|
|
preload=dummy
|
|
. ~/.sh-bash
|
|
unset preload
|
|
|
|
alias reload='cd; exec bash' ### @- **TODO:** respect initctl like in `.zshrc`.
|
|
[ ! -e ~/.lol ] || . ~/.lol
|