forked from camillescott/dotfiles
-
Notifications
You must be signed in to change notification settings - Fork 0
/
zshrc
152 lines (126 loc) · 3.43 KB
/
zshrc
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
export PATH=$HOME/.local/bin:/usr/local/bin:$PATH
zstyle :omz:plugins:ssh-agent agent-forwarding on
export ZSH_DISABLE_COMPFIX=true
source $HOME/.local/share/zsh/zsh-snap/znap.zsh
source ~znap/dotfiles/site.zsh
znap source ohmyzsh/ohmyzsh lib/{git,prompt_info_functions,theme-and-appearance,history}
znap source tonyseek/oh-my-zsh-virtualenv-prompt
ZSH_THEME_CONDA_ENV_PROMPT_PREFIX="‹"
ZSH_THEME_CONDA_ENV_PROMPT_SUFFIX="› "
ZSH_THEME_PY_PROMPT_PREFIX="⟮py"
ZSH_THEME_PY_PROMPT_SUFFIX="⟯ "
export EDITOR='vim'
export VIRTUAL_ENV_DISABLE_PROMPT=1
export GCC_COLORS='error=01;31:warning=01;35:note=01;36:caret=01;32:locus=01:quote=01'
export TIMEFORMAT=$'\nreal %3R\tuser %3U\tsys %3S\tpcpu %P\n'
export HISTTIMEFORMAT="%H:%M > "
# automatically cd'ing into directories is annoying
unsetopt AUTO_CD
# save more history
export HISTFILESIZE=1000000000
export HISTSIZE=1000000000
alias ..="cd .."
alias vim="nvim"
alias sudo="sudo -E"
HOSTNAME="$(hostname)" # Conda clobbers HOST, so we save the real hostname into another variable.
precmd() {
OLDHOST="${HOST}"
HOST="${HOSTNAME}"
}
preexec() {
HOST="${OLDHOST}"
}
centerf() {
if [[ -n "$2" ]]
then
pad="$2"
else
pad=" "
fi
var=" ${1} "
print -r - ${(l[COLUMNS/2][ ]r[COLUMNS-COLUMNS/2][ ])var}
}
acenterf() {
local IFS=$'\n'
for line ($=1) centerf "$line" $2
}
motd_welcome() {
centerf "$USER @ $HOSTNAME"
}
motd_unames() {
if [[ `uname -s` == 'Darwin' ]]; then
centerf "`uname -srm`"
else
centerf "`uname -o`"
centerf "`uname -r`"
centerf "`uname -m`"
fi
}
motd_cpuinfo() {
if [[ `uname -s` == 'Darwin' ]]; then
centerf "`hostinfo | grep physically`"
centerf "`hostinfo | grep logically`"
else
centerf "`cat /proc/cpuinfo | grep -m 1 "model name" | awk -F":" '{print $2}'`"
fi
}
motd_meminfo() {
if [[ `uname -s` == 'Darwin' ]]; then
centerf "`hostinfo | grep memory`"
else
centerf "`free -m | grep Mem | awk '{print $3 "M of "$2"M RAM used ("$7"M cached)"}'`"
fi
}
motd_dfinfo() {
if [[ `uname -s` == 'Darwin' ]]; then
acenterf "`df -h | grep /dev/disk1s1 | awk '{print $3,"of",$2,"("$5") used on "$9}'`"
else
acenterf "`df -h | grep "data\|home\|\s\/$" | awk '{print $3 " of "$2 " ("$5") on "$6}'`"
fi
}
div() {
tput sgr 0; tput bold; tput setaf 4; printf '%*s\n' "${COLUMNS:-$(tput cols)}" '' | tr ' ' =; tput sgr 0
}
smalldiv() {
tput bold; tput setaf 4; centerf '********************'; tput sgr 0
}
short_motd() {
div
tput setaf 5
tput sgr 0
echo
tput sitm
tput setaf 6
motd_welcome
tput sgr 0
echo
centerf "`date`"
echo
motd_unames
echo
smalldiv
echo
motd_cpuinfo
motd_meminfo
echo
div
tput sgr 0
echo
}
short_motd
znap prompt ~znap/dotfiles camillescott
export NVM_LAZY_LOAD_EXTRA_COMMANDS=('vim', 'nvim')
znap source lukechilds/zsh-nvm
znap source ohmyzsh/ohmyzsh plugins/git
znap source ohmyzsh/ohmyzsh plugins/colored-man-pages
znap source ohmyzsh/ohmyzsh plugins/colorize
znap source ohmyzsh/ohmyzsh plugins/catimg
znap source ohmyzsh/ohmyzsh plugins/extract
znap source ohmyzsh/ohmyzsh plugins/git-extras
znap source ohmyzsh/ohmyzsh plugins/pip
znap source ohmyzsh/ohmyzsh plugins/ssh-agent
znap source ohmyzsh/ohmyzsh plugins/fzf
znap source zsh-users/zsh-syntax-highlighting
znap source unixorn/fzf-zsh-plugin
echo
# vim: set filetype=zsh: