-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathinit.zsh
33 lines (30 loc) · 1.03 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
if (( ! ${+MNML_ERR_COLOR} )) typeset -g MNML_ERR_COLOR=red
typeset -gi MNML_LAST_ERR
_prompt_mnml_precmd() {
MNML_LAST_ERR=${?}
}
_prompt_mnml_buffer-empty() {
if [[ -z ${BUFFER} && ${CONTEXT} == start ]]; then
# draw infoline
if (( MNML_LAST_ERR )) print -Pn '%F{${MNML_ERR_COLOR}}${MNML_LAST_ERR} '
print -Pn '%(1j.%F{244}%j%f& .)%F{244}%n%f@%F{244}%m%f:'
print -Pn %F{244}${${(D)PWD}//\//%f\/%F{244}}
local -i a_files=$(command ls -Aq | command wc -l)
local -i v_files=$(command ls -q | command wc -l)
local -i h_files=$(( a_files - v_files ))
print -Pn " %f[%F{244}${v_files}%f"
if (( h_files )) print -Pn " (%F{244}${h_files}%f)"
print ]
# display magic enter
if (( ${#dirstack} )) print -P %F{244}${${(D)dirstack}//\//%f\/%F{244}}%f
ls -F
command git status -sb 2>/dev/null
print -Pn ${PS1}
zle redisplay
else
zle accept-line
fi
}
autoload -Uz add-zsh-hook && add-zsh-hook precmd _prompt_mnml_precmd
zle -N buffer-empty _prompt_mnml_buffer-empty
bindkey '^M' buffer-empty