summaryrefslogtreecommitdiff
path: root/02_Zsh.zsh
blob: 54f4561d038621f17173707a1022e0621feec734 (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
## No more core dumps :)
ulimit -c 0
umask 077

export BC_ENV_ARGS="-q"

##chmod 700 ~/tmp
##find ~ \( -name '#*#' -o -name '.*~' -o -name '*~' \) -exec rm -f {} \;

##
## exports && aliases
##

if [ -f ~/.zsh/.exports.zsh ]; then
    source ~/.zsh/.exports.zsh
fi

if [ -f ~/.zsh/.aliases.zsh ]; then
    source ~/.zsh/.aliases.zsh
fi


##
##  sanity
##
[[ -t 0 ]] && /bin/stty erase  "^H" intr  "^C" susp "^Z" dsusp "^Y" stop "^S" start "^Q" kill "^U"  >& /dev/null


case $SHLVL in
    *2)	CLR_SHLVL="%{%}";;
    *3)	CLR_SHLVL="%{%}";;
    *4)	CLR_SHLVL="%{%}";;
    *5)	CLR_SHLVL="%{%}";;
    *6)	CLR_SHLVL="%{%}";;
esac


##
##  basic setup
##
LOGCHECK=13
WATCHFMT=$COLOR_BLUECLAIR"%n"$COLOR_END
WATCHFMT=$WATCHFMT" has "$COLOR_YELLOW"%a %l from %M"
WATCH=notme
NULLCMD="less -f"
WORDCHARS="*?-._[]~=&;!#$%^(){}<>"	# I suppressed the '/'
TIMEFMT="\`%J': %U user %S system %*E total (%P cpu)"

HISTFILE=$ZDOTDIR/.history
HISTSIZE=42000
SAVEHIST=42000

##
## Prompts
##
#  For more info on PROMPT expansion, see 'man zshmisc'
##

PS1_ROOT=${PS1_ROOT:-31}
if ( [ "$SSH_TTY" = "" ] )
then
	PS1_USER=${PS1_USER:-34}
else
	PS1_USER=${PS1_USER_SSH:-35}
fi

PS1="%{[%(!."$PS1_ROOT"."$PS1_USER")m%}%n%{[1;%(!."$PS1_ROOT"."$PS1_USER")m%}@%{[0;%(!."$PS1_ROOT"."$PS1_USER")m%}%m%{%} (%{%}%y%{%}) [%(!.%{["$PS1_ROOT"m%}%d%{%}.%{["$PS1_USER"m%}%(5~:../:)%4~%{%})]"${LD_PRELOAD:t:s/lib//:r}" %h%{[%(!."$PS1_ROOT";1."$PS1_USER")m%}#%{%} "

RPS1="%(?;;%{%}%?%{%}) %{[0;%(!."$PS1_ROOT"."$PS1_USER")m%}%D{%a%d%b|%H:%M'%S}%{%}"

PS2="%{%}%B%_%b%{%}%B>%b%{%} "

SPROMPT="zsh: %{%}%B«%R»%b%{%} ? Ce ne serait pas plutôt %{%}%B«%r»%b%{%} ? [nyae] "

##
# PS3="?# "
# 
# PS4="+%N:%i> "
##


##
## Options
##
setopt correct
#setopt correctall
setopt inc_append_history
setopt histignorealldups
setopt histexpiredupsfirst
setopt alwayslastprompt
setopt always_to_end
setopt auto_cd
setopt _auto_list
setopt auto_menu
setopt auto_param_keys
#setopt auto_param_slash
setopt no_bg_nice
setopt complete_aliases
setopt hash_cmds
setopt hash_dirs
setopt no_hup
setopt mail_warning
setopt magic_equal_subst
setopt numericglobsort
setopt mark_dirs
setopt no_prompt_cr
#setopt equals
#setopt extended_glob
unsetopt promptcr

##
## bindkey
##

bindkey "\e[3~" delete-char		# delete
bindkey "\e[2~" overwrite-mode		# insert
bindkey "\e[A" up-line-or-history	# up
bindkey "\e[B" down-line-or-history	# down
bindkey "\e\e[C" forward-word		# ESC right
bindkey "\e\e[D" backward-word		# ESC left
bindkey "\e[5~" up-line-or-history	# page up	# c'est ultime
bindkey "\e[6~" down-line-or-history	# page down
bindkey "\e\e[3~" kill-region		# ESC del
#aterm
test $TERM = "rxvt" -o $TERM = "xterm" &&
{
    bindkey "\e[1~" beginning-of-line	# home
    bindkey "\e[4~" end-of-line		# end-of-line
    bindkey "\eOc" forward-word		# CTRL right
    bindkey "\eOd" backward-word	# CTRL left
    bindkey "\e[3$" vi-set-buffer		# SHIFT del
    bindkey "\eOa" history-search-backward	# CTRL UP
    bindkey "\eOb" history-search-forward	# CTRL DOWN
}
# (gnome-terminal)
#test $TERM = "xterm" &&
#{
#    bindkey "\eOH" beginning-of-line	# home
#    bindkey "\eOF" end-of-line		# end-of-line
#}
#bindkey "\C-t" gosmacs-transpose-chars	# J, ca c'est un truc pour toi
# ne pas oublier de s'en servir :
# vi-match-bracket est sur ^X^B par defaut
# npo : quote-region est sur ESC-" par defaut
# npo : which-command est sur ESC-? par defaut


##
## functions
##
##[[ -t 1 ]] &&
chpwd()
{
    case $TERM in
      sun-cmd) print -Pn "\e]l%n@%m %~\e\\" ;;
      *xterm*|rxvt|(k|E|dt)term|gnome-terminal) print -Pn "\e]0;%n@%m (%l) %~\a" ;;
    esac
#    print -P "%(/,%78>...>%/,%//)%b"
}

precmd ()
{
#    print -nP "%(?,,%{%}Foirage n°%{%}%?\n)%{%}"
}

##
## misc commands
##
chpwd
#(/bin/rm -f ~/.saves-*) 2>/dev/null