-
Notifications
You must be signed in to change notification settings - Fork 0
/
.kshrc
120 lines (98 loc) · 2.66 KB
/
.kshrc
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
[[ -f /etc/ksh.kshrc ]] && . /etc/ksh.kshrc
export LANG=en_US.UTF-8
export LC_CTYPE=en_US.UTF-8
# Sets extra paths
set -A paths /usr/games \
~/go/bin \
/usr/ports/infrastructure/bin \
~/bin \
~/.cargo/bin \
~/.node_modules/bin
for d in "${paths[@]}"; do
[[ -d "${d}" ]] && PATH="${PATH}:$d"
done
EDITOR="nvim"
LSCOLORS="exgxfxdxcxegedabagacad"
TZ="US/Pacific"
VISUAL="nvim"
HISTFILE=~/.ksh_history
HISTSIZE=1000
OS=$(uname)
set -o vi
LPREFIX=/usr/local
if [ "$OS" = "OpenBSD" ]; then
if [ ! -f ~/.cvsrc ]; then
export CVSROOT="anoncvs@anoncvs4.usa.openbsd.org:/cvs"
fi
else
LPREFIX=/usr
fi
# Disabled until i figure out how to make it work with ksh
#if [ -e ~/.git-prompt ]; then
# shellcheck source=/home/qbit/.git-prompt
# . ~/.git-prompt
# export GIT_PS1_SHOWDIRTYSTATE=true
# export GIT_PS1_SHOWUNTRACKEDFILES=true
# export GIT_PS1_SHOWCOLORHINTS=true
# export GIT_PS1_SHOWUPSTREAM="auto"
#fi
# Colors for use in the prompt and elsewere.
white_bg="\[\e[48;5;255m\]"
white_fg="\[\e[38;5;255m\]"
blue_fg="\[\e[38;5;75m\]"
grey_bg="\[\e[48;5;239m\]"
grey_fg="\[\e[38;5;239m\]"
reset="\[\e[m\]"
prompt=""
# TODO Set term to ansi on OpenBSD to get colors
# If we're using ansi, use 8 bit colors.
if [ $TERM = "vt220" ]; then
prompt="\$"
export TERM=ansi
fi
# Show user@host if we're on a remote ssh session.
if [ "$SSH_CONNECTION" ]; then
ssh_prompt="${white_bg} ${blue_fg}\u@\h ${grey_bg}${white_fg}${prompt}"
fi
PS1="${grey_bg}${bright_blue}${ssh_prompt} \w $reset$grey_fg$prompt$reset "
alias df='df -h'
alias dot='git --git-dir=$HOME/.dotfiles/ --work-tree=$HOME'
alias dotls='dot ls-tree --full-tree -r --name-only HEAD'
alias du='du -h'
alias gpg='gpg2'
alias ls='colorls -GF'
alias mutt='neomutt'
alias sudo='doas'
alias vi=nvim
alias view='nvim -R'
# TODO make this do something nicer
cd() { command cd "$@"; echo -ne "\033]0;${PWD##*/}\007"; }
src() {
cd /usr/src/*/$1 || return
}
port() {
cd /usr/ports/*/$1 2>/dev/null || \
cd /usr/ports/*/*/$1 2>/dev/null || \
return
}
dotc() {
_branch=$(dot branch | grep \* | cut -d ' ' -f2)
dot stash
dot checkout master
dot stash pop
}
dotb() {
dot checkout $_branch
dot merge master -m "Merge branch 'master' into $_branch"
}
if [ -e ${LPREFIX}/bin/keychain ]; then
#${LPREFIX}/bin/keychain --gpg2 --inherit any --agents ssh,gpg -q -Q
${LPREFIX}/bin/keychain --inherit any --agents ssh -q -Q
keychain_conf="$HOME/.keychain/$(uname -n)-sh"
[ -e "${keychain_conf}" ] && . ${keychain_conf}
[ -e "${keychain_conf}-gpg" ] && . ${keychain_conf}-gpg
fi
if [ -e ~/.ksh_completions ]; then
. ~/.ksh_completions
fi
export EDITOR HISTFILE HISTSIZE HOME LSCOLORS PATH PS1 TERM TZ VISUAL