2013-06-28 05:22:14 -07:00
|
|
|
[ -z "$PS1" ] && return
|
2021-10-29 06:03:39 -07:00
|
|
|
. ~/.prep # handle boring stuff like /etc/profile and $PATH
|
2021-07-29 00:37:35 -07:00
|
|
|
|
2013-06-28 05:22:14 -07:00
|
|
|
HISTCONTROL=erasedups
|
|
|
|
HISTSIZE=1000
|
|
|
|
HISTFILESIZE=2000
|
|
|
|
|
|
|
|
shopt -s histappend
|
|
|
|
shopt -s checkwinsize
|
|
|
|
#shopt -s physical # chaselinks (doesn't exist?)
|
2020-12-29 08:38:07 -08:00
|
|
|
set -o hashall # enable hash command
|
2024-02-23 22:29:55 -08:00
|
|
|
set +o histexpand # disable expansion of ! characters
|
2013-06-28 05:22:14 -07:00
|
|
|
|
2024-07-12 01:31:40 -07:00
|
|
|
#[ "$TERM" != rxvt-unicode-256color ] || export TERM=xterm-256color
|
2021-10-14 00:08:47 -07:00
|
|
|
|
2022-09-30 16:47:21 -07:00
|
|
|
_temporary_scope_() {
|
|
|
|
local t="${TERM%%-*}" title=
|
2024-04-03 17:40:07 -07:00
|
|
|
local hide='\\[' show='\\]' prompt='\\$' cwd='\\w' host='\\H'
|
|
|
|
local ESC='\E' BEL='\a' SI='\017' SO='\016' # SI/SO: switch to G0/G1 charset
|
|
|
|
local CSI="$ESC[" OSC="$ESC]"
|
|
|
|
local G0="(" G1=")" # change G0/G1 charset
|
|
|
|
local USASCII="B" SPECIAL="0" # charsets: sane default & line drawing
|
2024-04-02 22:22:51 -07:00
|
|
|
local DECTCEM="25"
|
2024-04-03 17:40:07 -07:00
|
|
|
local DECSET="h" SGR="m" # final characters of a command sequence
|
2024-07-12 01:31:02 -07:00
|
|
|
local sanity="$CSI?$DECTCEM$DECSET"
|
2024-04-03 17:40:07 -07:00
|
|
|
local color1="$CSI;--$SGR" color2="$CSI--;97$SGR" reset="$hide$CSI$SGR$show"
|
|
|
|
if [ "$t" = xterm ] || [ "$t" = screen ] || [ "$t" = tmux ]; then
|
|
|
|
[ "$t" = tmux ] && title="$cwd" || title="$host: $cwd"
|
|
|
|
title="${OSC}2;$title$BEL"
|
2024-07-12 01:31:02 -07:00
|
|
|
sanity="$ESC$G0$USASCII$SI$sanity"
|
2024-04-03 17:40:07 -07:00
|
|
|
fi
|
2024-07-21 09:25:28 -07:00
|
|
|
local line1="$hide$title$sanity$color1$show $reset"
|
|
|
|
local line2="$hide$color2$show$prompt$reset "
|
|
|
|
local ret="$line1\\n$line2"
|
|
|
|
local ret_okay="${ret//--/42}" ret_fail="${ret//--/41}" # green/red bg
|
2022-09-30 16:47:21 -07:00
|
|
|
PROMPT_COMMAND="[ \$? = 0 ] && PS1=\$'$ret_okay' || PS1=\$'$ret_fail'"
|
2024-04-02 22:22:51 -07:00
|
|
|
}; _temporary_scope_; unset -f _temporary_scope_
|
2013-06-28 05:22:14 -07:00
|
|
|
|
2024-07-21 12:22:05 -07:00
|
|
|
#ADDPATH "$HOME/sh" # this doesn't work for all scripts at the moment
|
|
|
|
dummy() { :; } ### @- return 0, ignoring arguments.
|
2024-07-21 13:05:32 -07:00
|
|
|
. ~/.shrc
|
2021-07-29 07:26:45 -07:00
|
|
|
|
2021-07-30 17:57:08 -07:00
|
|
|
alias reload='cd; exec bash' ### @- **TODO:** respect initctl like in `.zshrc`.
|
2021-10-18 17:34:10 -07:00
|
|
|
[ ! -e ~/.lol ] || . ~/.lol
|
2022-09-30 16:47:21 -07:00
|
|
|
|
|
|
|
true
|