-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.zshrc
104 lines (71 loc) · 2.09 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
# Created by newuser for 4.3.6
#
#
# auto correct spelling mistake
setopt CORRECT
setopt CORRECT_ALL
setopt NO_BEEP
setopt AUTO_CD
setopt EXTENDED_GLOB
setopt MULTIOS
setopt PUSHD_IGNORE_DUPS
#setopt AUTO_PUSHD
# use vi-mode for input
bindkey -v
#----------------------------------------------------------------------------------------
# History
#----------------------------------------------------------------------------------------
HISTSIZE=50000
SAVEHIST=50000
HISTFILE=~/.zsh.d/history
setopt APPEND_HISTORY
setopt INC_APPEND_HISTORY
setopt SHARE_HISTORY
setopt EXTENDED_HISTORY
setopt HIST_IGNORE_DUPS
setopt HIST_FIND_NO_DUPS
setopt HIST_IGNORE_SPACE
setopt NO_HIST_BEEP
#----------------------------------------------------------------------------------------
# Prompt
#----------------------------------------------------------------------------------------
#%D{%L:%M}
setopt PROMPT_SUBST
# get the colors
autoload colors zsh/terminfo
if [[ "$terminfo[colors]" -ge 8 ]]; then
colors
fi
for color in RED GREEN YELLOW BLUE MAGENTA CYAN WHITE GREY; do
eval C_$color='%{$terminfo[bold]$fg[${(L)color}]%}'
eval C_L_$color='%{$fg[${(L)color}]%}'
done
C_OFF="%{$terminfo[sgr0]%}"
# set the prompt
set_prompt()
{
mypath="$C_OFF$C_L_GREEN%~"
myjobs=()
for a (${(k)jobstates})
{
j=$jobstates[$a];i="${${(@s,:,)j}[2]}"
myjobs+=($a${i//[^+-]/})
}
myjobs=${(j:,:)myjobs}
((MAXMID=$COLUMNS / 2)) # truncate to this value
RPS1="$RPSL$C_L_GREEN%$MAXMID<...<$mypath$RPSR"
rehash
}
RPSL=$'$C_OFF'
RPSR=$'$C_OFF$C_L_RED%(0?.$C_L_GREEN. (%?%))$C_OFF'
RPS2='%^'
# load prompt functions
setopt promptsubst
unsetopt transient_rprompt # leave the pwd
precmd() {
set_prompt
print -Pn "\e]0;%n@$__IP:%l\a"
}
PS1=$'$C_L_BLUE%(1j.[$myjobs]% $C_OFF .$C_OFF)%m.%B%n%b$C_OFF$C_L_RED%#$C_OFF'
# add the feature of showing current vi mode: insert? normal?
source ~/.zsh.d/prompt-current-vi-mode.zsh