blob: 9a305c26332304c73feb4c1b3850bf474e84b137 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
|
#!/bin/sh
case $- in
*l*) LOGIN=1 ;;
*) LOGIN=0 ;;
esac
case $- in
*i*) INTERACTIVE=1 ;;
*) INTERACTIVE=0 ;;
esac
if [ "$LOGIN" = 1 ]; then
if [ -z "$XDG_RUNTIME_DIR" ]; then
XDG_RUNTIME_DIR=$(mktemp -d "/tmp/$(id -u)-runtime-dir.XXX")
export XDG_RUNTIME_DIR
fi
export ENV=${HOME}/.profile
fi
########################################################################
if [ "$LOGIN" = 1 ]; then
prepend_path() {
if [ -d "$1" ]; then
case ":$PATH:" in
*:"$1":*) ;;
*) PATH=$1:$PATH ;;
esac
fi
}
prepend_path "$HOME/.ghcup/bin"
prepend_path "$HOME/.cabal/bin"
prepend_path "$HOME/.cargo/bin"
prepend_path "$HOME/.mcabal/bin"
prepend_path "$HOME/.local/musl/bin"
prepend_path "$HOME/.local/bin"
export PATH
fi
########################################################################
if [ "$LOGIN" = 1 ]; then
if [ -d /usr/local/lib/pkgconfig ]; then
if [ -n "$PKG_CONFIG_PATH" ]; then
PKG_CONFIG_PATH=/usr/local/lib/pkgconfig:$PKG_CONFIG_PATH
else
PKG_CONFIG_PATH=/usr/local/lib/pkgconfig
fi
export PKG_CONFIG_PATH
fi
fi
########################################################################
if [ "$LOGIN" = 1 ]; then
export EDITOR=vi
export ALTERNATE_EDITOR=vi
export VISUAL=vi
export MORE=FRX
export LESS=FRX
export EXINIT='set ai ic nu sw=4 ts=4 nofl magic'
if command -v less >/dev/null 2>&1; then
PAGER=less
elif command -v more >/dev/null 2>&1; then
PAGER=more
else
PAGER=cat
fi
export PAGER
fi
########################################################################
if [ "$LOGIN" = 1 ]; then
HISTCONTROL=ignoreboth
HISTSIZE=1000
HISTFILESIZE=2000
export HISTCONTROL HISTSIZE HISTFILESIZE
fi
########################################################################
if [ "$INTERACTIVE" = 1 ]; then
set -o emacs
fi
########################################################################
if [ "$INTERACTIVE" = 1 ]; then
color=no
if command -v tput >/dev/null 2>&1 &&
tput setaf 1 >/dev/null 2>&1
then
color=yes
fi
case "$TERM" in
xterm-color|*-256color)
color=yes
;;
esac
user=$(id -un 2>/dev/null || echo '?')
host=$(hostname 2>/dev/null || uname -n)
if [ "$color" = yes ]; then
PS1="$(printf '\033[1;32m')${user}@${host}$(printf '\033[0m'):$(printf '\033[1;34m')"'$PWD'"$(printf '\033[0m')\$ "
else
PS1="${user}@${host}:\$PWD\$ "
fi
case "$TERM" in
xterm*|rxvt*|st*|alacritty*)
PS1="$(printf '\033]0;%s@%s: %s\007' "$user" "$host" '$PWD')$PS1"
;;
esac
export PS1
fi
########################################################################
if [ "$INTERACTIVE" = 1 ]; then
alias bctl='bluetoothctl'
alias less='less -i'
alias e='emacs'
alias a='emacsclient -n'
alias femacs='fbterm -- fbterm-emacs.sh'
alias demacs='emacs --daemon'
alias ta='tmux attach'
alias gl='git log --graph --all --oneline'
alias glt='git log --graph --all --oneline --simplify-by-decoration'
alias gs='git status'
alias gc='git checkout'
alias gb='git branch'
alias gd='git diff --patch'
alias gds='git diff --patch --cached'
# Only define if supported.
command -v pushd >/dev/null 2>&1 && alias pd=pushd
command -v popd >/dev/null 2>&1 && alias ppd=popd
alias up='cd ..'
alias cdp='cd "$(git worktree list --porcelain | awk '"'"'$1=="worktree"{print $2; exit}'"'"')"'
alias ll='ls -la'
alias l='lk'
ls --color=auto >/dev/null 2>&1 && alias ls='ls --color=auto'
grep --color=auto "" </dev/null >/dev/null 2>&1 && \
alias grep='grep --color=auto'
fi
########################################################################
if [ -n "$BASH_VERSION" ]; then
shopt -s histappend checkwinsize globstar
fi
########################################################################
if [ -n "$EAT_SHELL_INTEGRATION_DIR" ]; then
case "$BASH_VERSION" in
"")
;;
*)
[ -f "$EAT_SHELL_INTEGRATION_DIR/bash" ] &&
. "$EAT_SHELL_INTEGRATION_DIR/bash"
;;
esac
fi
|