-
Notifications
You must be signed in to change notification settings - Fork 0
/
init.zsh
60 lines (52 loc) · 1.34 KB
/
init.zsh
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
autoload -U compinit
compinit
zstyle ':completion:*:descriptions' format '%U%B%d%b%u'
zstyle ':completion:*:warnings' format '%BSorry, no matches for: %d%b'
setopt PROMPT_SUBST
if [ -n "$SSH_CLIENT" ] || [ -n "$SSH_TTY" ]; then
if (( ${+HOSTNAME} )); then
else
HOSTNAME=$(hostname)
fi
HSTNAME="🖥 ssh://$HOSTNAME/"
# many other tests omitted
else
case $(ps -o comm= -p $PPID) in
sshd|*/sshd) "🖥 ssh://$HOSTNAME/";;
esac
HSTNAME=""
fi
function rpromptf(){
if [[ $(print -P '%?') == "0" ]]; then
print " 😺 "
else
print " 😾 "
fi
}
function lpromptf(){
if [[ $? == "0" ]]; then
print -P ""
else
print -P "\n"
fi
}
source "${HOME}/.zgen/zgen.zsh"
if ! zgen saved; then
# specify plugins here
zgen oh-my-zsh
zgen oh-my-zsh plugins/git
zgen oh-my-zsh plugins/sudo
zgen oh-my-zsh plugins/command-not-found
zgen oh-my-zsh plugins/pip
zgen oh-my-zsh plugins/virtualenv
zgen oh-my-zsh plugins/cargo
# generate the init script from plugins above
zgen load zsh-users/zsh-autosuggestions
zgen save
fi
export PROMPT='%F{green}╭╴%f $(lpromptf)%F{green}[%F{blue}$HSTNAME%f %F{red}|%f%F{green} %~ ]%f $(is_git)
%F{green}╰➤%f [%F{green}%*%f] %F{red}•%f '
export RPROMPT='$(rpromptf)'
bindkey -r "^[^["
bindkey "^[^[[D" backward-word
bindkey "^[^[[C" forward-word