This commit is contained in:
@@ -64,7 +64,6 @@
|
|||||||
!/.config/zsh/lib/systemd.zsh
|
!/.config/zsh/lib/systemd.zsh
|
||||||
!/.config/zsh/lib/term.zsh
|
!/.config/zsh/lib/term.zsh
|
||||||
!/.config/zsh/lib/time.zsh
|
!/.config/zsh/lib/time.zsh
|
||||||
!/.config/zsh/lib/title.zsh
|
|
||||||
!/.config/zsh/local.zsh.example
|
!/.config/zsh/local.zsh.example
|
||||||
!/.config/zsh/local/.keep
|
!/.config/zsh/local/.keep
|
||||||
!/.config/zsh/local/completion/.keep
|
!/.config/zsh/local/completion/.keep
|
||||||
@@ -78,7 +77,8 @@
|
|||||||
!/.config/zsh/rc.zsh
|
!/.config/zsh/rc.zsh
|
||||||
!/.config/zsh/rc/completion.zsh
|
!/.config/zsh/rc/completion.zsh
|
||||||
!/.config/zsh/rc/gpg-agent.zsh
|
!/.config/zsh/rc/gpg-agent.zsh
|
||||||
!/.config/zsh/rc/keyboard.zsh
|
!/.config/zsh/rc/keyboard-base.zsh
|
||||||
|
!/.config/zsh/rc/keyboard-extras.zsh
|
||||||
!/.config/zsh/rc/pager.zsh
|
!/.config/zsh/rc/pager.zsh
|
||||||
!/.config/zsh/rc/prompt.zsh
|
!/.config/zsh/rc/prompt.zsh
|
||||||
!/.config/zsh/rc/ssh-agent.zsh
|
!/.config/zsh/rc/ssh-agent.zsh
|
||||||
|
@@ -1,10 +1,12 @@
|
|||||||
#!/bin/zsh
|
#!/bin/zsh
|
||||||
|
|
||||||
## early module load
|
## early load modules
|
||||||
zmodload -s zsh/zprof
|
zmodload zsh/mathfunc zsh/datetime zsh/zprof
|
||||||
|
|
||||||
typeset -gA ZSHU
|
typeset -gA ZSHU
|
||||||
|
|
||||||
|
__z_unsupported() { echo "not supported" >&2 ; }
|
||||||
|
|
||||||
ZSHU[t_begin]=${(%):-%D{%s.%6.}}
|
ZSHU[t_begin]=${(%):-%D{%s.%6.}}
|
||||||
|
|
||||||
ZSHU[d_zdot]="${ZDOTDIR}"
|
ZSHU[d_zdot]="${ZDOTDIR}"
|
||||||
|
@@ -7,8 +7,7 @@ z-time() {
|
|||||||
"$@" ; r=$?
|
"$@" ; r=$?
|
||||||
a=$[ EPOCHREALTIME - a ]
|
a=$[ EPOCHREALTIME - a ]
|
||||||
a=$(z-ts-to-human "$a" 6)
|
a=$(z-ts-to-human "$a" 6)
|
||||||
echo >&2
|
printf '\n# time took: %s\n' "$a" >&2
|
||||||
echo "time took: $a" >&2
|
|
||||||
|
|
||||||
return $r
|
return $r
|
||||||
}
|
}
|
||||||
@@ -49,5 +48,7 @@ add-zsh-hook precmd __z_cmdtime_measure
|
|||||||
add-zsh-hook preexec __z_cmdtime_set
|
add-zsh-hook preexec __z_cmdtime_set
|
||||||
|
|
||||||
else
|
else
|
||||||
echo "cmd time measurement is disabled due to missing hook support" >&2
|
|
||||||
|
echo "cmd time measurement is disabled due to missing hook support" >&2
|
||||||
|
|
||||||
fi
|
fi
|
||||||
|
@@ -47,5 +47,7 @@ __z_pwd_hook() {
|
|||||||
add-zsh-hook precmd __z_pwd_hook
|
add-zsh-hook precmd __z_pwd_hook
|
||||||
|
|
||||||
else
|
else
|
||||||
echo "shiny pwd's are disabled due to missing hook support" >&2
|
|
||||||
|
echo "shiny pwd's are disabled due to missing hook support" >&2
|
||||||
|
|
||||||
fi
|
fi
|
||||||
|
@@ -1,5 +1,6 @@
|
|||||||
#!/bin/zsh
|
#!/bin/zsh
|
||||||
|
|
||||||
|
typeset -gA ZSHU_TERM
|
||||||
typeset -Uga ZSHU_TERM_MISSING
|
typeset -Uga ZSHU_TERM_MISSING
|
||||||
|
|
||||||
z-ti-test() {
|
z-ti-test() {
|
||||||
@@ -16,3 +17,136 @@ z-ti-test() {
|
|||||||
|
|
||||||
return $r
|
return $r
|
||||||
}
|
}
|
||||||
|
|
||||||
|
case "${TERM}" in
|
||||||
|
xterm* | putty* | rxvt* | konsole* | mlterm* | alacritty* | foot* | contour* )
|
||||||
|
ZSHU_TERM[has_title_tab]=1
|
||||||
|
ZSHU_TERM[has_title_wnd]=1
|
||||||
|
ZSHU_TERM[want_cwd]=1
|
||||||
|
|
||||||
|
ZSHU_TERM[title_tab]=term
|
||||||
|
ZSHU_TERM[title_wnd]=term
|
||||||
|
;;
|
||||||
|
st* | wezterm* )
|
||||||
|
ZSHU_TERM[has_title_tab]=1
|
||||||
|
ZSHU_TERM[has_title_wnd]=1
|
||||||
|
|
||||||
|
ZSHU_TERM[title_tab]=term
|
||||||
|
ZSHU_TERM[title_wnd]=term
|
||||||
|
;;
|
||||||
|
cygwin | ansi )
|
||||||
|
ZSHU_TERM[has_title_tab]=1
|
||||||
|
ZSHU_TERM[has_title_wnd]=1
|
||||||
|
|
||||||
|
ZSHU_TERM[title_tab]=term
|
||||||
|
ZSHU_TERM[title_wnd]=term
|
||||||
|
;;
|
||||||
|
screen* | tmux* )
|
||||||
|
ZSHU_TERM[has_title_tab]=1
|
||||||
|
ZSHU_TERM[want_cwd]=1
|
||||||
|
|
||||||
|
ZSHU_TERM[title_tab]=mux
|
||||||
|
;;
|
||||||
|
* )
|
||||||
|
if z-ti-test fsl tsl ; then
|
||||||
|
ZSHU_TERM[has_title_tab]=1
|
||||||
|
ZSHU_TERM[want_cwd]=1
|
||||||
|
|
||||||
|
ZSHU_TERM[title_tab]=terminfo
|
||||||
|
fi
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
z-term-title-tab() {
|
||||||
|
# [ "${ZSHU_TERM[has_title_tab]}" = 1 ] || return 1
|
||||||
|
|
||||||
|
case "${ZSHU_TERM[title_tab]:-}" in
|
||||||
|
term )
|
||||||
|
print -Pn "\e]1;${1:q}\a"
|
||||||
|
;;
|
||||||
|
mux )
|
||||||
|
## screen/tmux: hardstatus
|
||||||
|
print -Pn "\ek${1:q}\e\\"
|
||||||
|
;;
|
||||||
|
terminfo )
|
||||||
|
echoti tsl
|
||||||
|
print -Pn "$1"
|
||||||
|
echoti fsl
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
}
|
||||||
|
|
||||||
|
z-term-title-window() {
|
||||||
|
# [ "${ZSHU_TERM[has_title_wnd]}" = 1 ] || return 1
|
||||||
|
|
||||||
|
case "${ZSHU_TERM[title_wnd]:-}" in
|
||||||
|
term )
|
||||||
|
print -Pn "\e]2;${1:q}\a"
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
}
|
||||||
|
|
||||||
|
z-term-title() {
|
||||||
|
## if $2 is unset use $1 as default
|
||||||
|
## if it is set and empty, leave it as is
|
||||||
|
: ${2=$1}
|
||||||
|
|
||||||
|
z-term-title-tab "$1"
|
||||||
|
z-term-title-window "$2"
|
||||||
|
}
|
||||||
|
|
||||||
|
z-term-cwd() {
|
||||||
|
[ "${ZSHU_TERM[want_cwd]}" = 1 ] || return 1
|
||||||
|
|
||||||
|
local host path
|
||||||
|
host=${HOST:-localhost}
|
||||||
|
path=${PWD}
|
||||||
|
|
||||||
|
## Konsole doesn't want ${host}
|
||||||
|
while : ; do
|
||||||
|
[ -n "${KONSOLE_DBUS_SERVICE}" ] || break
|
||||||
|
[ -n "${KONSOLE_DBUS_SESSION}" ] || break
|
||||||
|
[ -n "${KONSOLE_DBUS_WINDOW}" ] || break
|
||||||
|
[ -n "${KONSOLE_PROFILE_NAME}" ] || break
|
||||||
|
host=
|
||||||
|
break ; done
|
||||||
|
|
||||||
|
printf "\e]7;file://%s%s\e\\" "${host}" "${path}"
|
||||||
|
}
|
||||||
|
|
||||||
|
if autoload -Uz add-zsh-hook ; then
|
||||||
|
|
||||||
|
ZSHU[term_title]=1
|
||||||
|
z-term-title-enable() { ZSHU[term_title]=1 ; }
|
||||||
|
z-term-title-disable() { ZSHU[term_title]=0 ; }
|
||||||
|
|
||||||
|
ZSHU[title_tab]='%15<..<%~%<<'
|
||||||
|
ZSHU[title_wnd]='%n@%m:%~'
|
||||||
|
__z_term_title_precmd() {
|
||||||
|
[ "${ZSHU[term_title]}" = 1 ] || return
|
||||||
|
z-term-title "${ZSHU[title_tab]}" "${ZSHU[title_wnd]}"
|
||||||
|
}
|
||||||
|
add-zsh-hook precmd __z_term_title_precmd
|
||||||
|
|
||||||
|
ZSHU[term_cwd]=1
|
||||||
|
z-term-cwd-enable() { ZSHU[term_cwd]=1 ; }
|
||||||
|
z-term-cwd-disable() { ZSHU[term_cwd]=0 ; }
|
||||||
|
|
||||||
|
__z_term_cwd_precmd() {
|
||||||
|
[ "${ZSHU[term_cwd]}" = 1 ] || return
|
||||||
|
z-term-cwd
|
||||||
|
}
|
||||||
|
## "chpwd" doesn't always hook pwd changes
|
||||||
|
add-zsh-hook precmd __z_term_cwd_precmd
|
||||||
|
|
||||||
|
else
|
||||||
|
|
||||||
|
echo "current working directory and tab/window title handling is disabled due to missing hook support" >&2
|
||||||
|
|
||||||
|
z-term-title-enable() { __z_unsupported ; }
|
||||||
|
z-term-title-disable() { __z_unsupported ; }
|
||||||
|
|
||||||
|
z-term-cwd-enable() { __z_unsupported ; }
|
||||||
|
z-term-cwd-disable() { __z_unsupported ; }
|
||||||
|
|
||||||
|
fi
|
||||||
|
@@ -1,58 +0,0 @@
|
|||||||
#!/bin/zsh
|
|
||||||
|
|
||||||
ZSHU[title_tab]='%15<..<%~%<<'
|
|
||||||
ZSHU[title_window]='%n@%m:%~'
|
|
||||||
|
|
||||||
z-title-tab() {
|
|
||||||
emulate -L zsh
|
|
||||||
|
|
||||||
case "${TERM}" in
|
|
||||||
cygwin | xterm* | putty* | rxvt* | konsole* | ansi | mlterm* | alacritty | st* )
|
|
||||||
print -Pn "\e]1;${1:q}\a"
|
|
||||||
;;
|
|
||||||
screen* | tmux* )
|
|
||||||
## hardstatus
|
|
||||||
print -Pn "\ek${1:q}\e\\"
|
|
||||||
;;
|
|
||||||
* )
|
|
||||||
z-ti-test fsl tsl || return
|
|
||||||
|
|
||||||
echoti tsl
|
|
||||||
print -Pn "$1"
|
|
||||||
echoti fsl
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
}
|
|
||||||
|
|
||||||
z-title-window() {
|
|
||||||
emulate -L zsh
|
|
||||||
|
|
||||||
case "${TERM}" in
|
|
||||||
cygwin | xterm* | putty* | rxvt* | konsole* | ansi | mlterm* | alacritty | st* )
|
|
||||||
print -Pn "\e]2;${1:q}\a"
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
}
|
|
||||||
|
|
||||||
z-title() {
|
|
||||||
emulate -L zsh
|
|
||||||
|
|
||||||
## if $2 is unset use $1 as default
|
|
||||||
## if it is set and empty, leave it as is
|
|
||||||
: ${2=$1}
|
|
||||||
|
|
||||||
z-title-tab "$1"
|
|
||||||
z-title-window "$2"
|
|
||||||
}
|
|
||||||
|
|
||||||
if autoload -Uz add-zsh-hook ; then
|
|
||||||
|
|
||||||
__z_title_precmd() {
|
|
||||||
z-title "${ZSHU[title_tab]}" "${ZSHU[title_window]}"
|
|
||||||
}
|
|
||||||
|
|
||||||
add-zsh-hook precmd __z_title_precmd
|
|
||||||
|
|
||||||
else
|
|
||||||
echo "tab/window title handling is disabled due to missing hook support" >&2
|
|
||||||
fi
|
|
@@ -1,13 +1,6 @@
|
|||||||
#!/bin/zsh
|
#!/bin/zsh
|
||||||
|
|
||||||
unsetopt err_exit
|
unsetopt err_exit err_return multios
|
||||||
unsetopt err_return
|
|
||||||
unsetopt multios
|
|
||||||
|
|
||||||
setopt bsd_echo
|
setopt bsd_echo interactive_comments long_list_jobs monitor prompt_subst zle
|
||||||
setopt interactive_comments
|
|
||||||
setopt long_list_jobs
|
|
||||||
setopt monitor
|
|
||||||
setopt prompt_subst
|
|
||||||
setopt zle
|
|
||||||
# setopt magic_equal_subst
|
# setopt magic_equal_subst
|
||||||
|
@@ -1,9 +1,5 @@
|
|||||||
#!/bin/zsh
|
#!/bin/zsh
|
||||||
|
|
||||||
unsetopt flow_control
|
unsetopt flow_control menu_complete
|
||||||
unsetopt menu_complete
|
|
||||||
|
|
||||||
setopt always_to_end
|
setopt always_to_end auto_menu complete_aliases complete_in_word
|
||||||
setopt auto_menu
|
|
||||||
setopt complete_aliases
|
|
||||||
setopt complete_in_word
|
|
||||||
|
@@ -1,7 +1,3 @@
|
|||||||
#!/bin/zsh
|
#!/bin/zsh
|
||||||
|
|
||||||
setopt auto_cd
|
setopt auto_cd auto_pushd cdable_vars pushd_ignore_dups pushd_minus
|
||||||
setopt auto_pushd
|
|
||||||
setopt cdable_vars
|
|
||||||
setopt pushd_ignore_dups
|
|
||||||
setopt pushd_minus
|
|
||||||
|
@@ -1,11 +1,3 @@
|
|||||||
#!/bin/zsh
|
#!/bin/zsh
|
||||||
|
|
||||||
setopt append_history
|
setopt append_history extended_history hist_expire_dups_first hist_ignore_all_dups hist_ignore_dups hist_ignore_space hist_verify inc_append_history share_history
|
||||||
setopt extended_history
|
|
||||||
setopt hist_expire_dups_first
|
|
||||||
setopt hist_ignore_all_dups
|
|
||||||
setopt hist_ignore_dups
|
|
||||||
setopt hist_ignore_space
|
|
||||||
setopt hist_verify
|
|
||||||
setopt inc_append_history
|
|
||||||
setopt share_history
|
|
||||||
|
@@ -1,28 +1,50 @@
|
|||||||
#!/bin/zsh
|
#!/bin/zsh
|
||||||
|
|
||||||
typeset -Ua zshu_modules
|
typeset -a zshu_modules
|
||||||
zshu_modules+=(
|
## DEBUG module load order
|
||||||
|
# typeset -a zshu_m0 zshu_m1
|
||||||
|
zshu_modules=(
|
||||||
|
clone
|
||||||
|
langinfo
|
||||||
|
parameter
|
||||||
|
sched
|
||||||
|
termcap
|
||||||
|
terminfo
|
||||||
|
watch
|
||||||
|
zpty
|
||||||
|
|
||||||
|
zle
|
||||||
|
zleparameter
|
||||||
|
deltochar
|
||||||
complete
|
complete
|
||||||
complist
|
complist
|
||||||
computil
|
computil
|
||||||
datetime
|
|
||||||
langinfo
|
|
||||||
main
|
|
||||||
mathfunc
|
|
||||||
parameter
|
|
||||||
stat
|
|
||||||
system
|
|
||||||
terminfo
|
|
||||||
zle
|
|
||||||
zutil
|
zutil
|
||||||
|
compctl
|
||||||
)
|
)
|
||||||
for i ( ${zshu_modules} ) ; do
|
for i ( ${zshu_modules} ) ; do
|
||||||
case "$i" in
|
i="zsh/$i"
|
||||||
*/* ) ;;
|
## DEBUG module load order
|
||||||
* ) i="zsh/$i" ;;
|
# zshu_m0=( $(zmodload) )
|
||||||
esac
|
# if ((${zshu_m0[(Ie)${i}]})); then
|
||||||
|
# echo "# already loaded: $i" >&2
|
||||||
|
# continue
|
||||||
|
# fi
|
||||||
|
|
||||||
zmodload "$i"
|
zmodload "$i"
|
||||||
|
|
||||||
|
## DEBUG module load order
|
||||||
|
# zshu_m1=( $(zmodload) )
|
||||||
|
# for k ( ${zshu_m1} ) ; do
|
||||||
|
# if [ "$k" = "$i" ] ; then continue ; fi
|
||||||
|
# if ((${zshu_m0[(Ie)${k}]})); then
|
||||||
|
# continue
|
||||||
|
# fi
|
||||||
|
# echo "# new module loaded (with $i): $k" >&2
|
||||||
|
# done
|
||||||
done
|
done
|
||||||
unset i zshu_modules
|
unset i zshu_modules
|
||||||
|
## DEBUG module load order
|
||||||
|
# unset zshu_m0 zshu_m1
|
||||||
|
|
||||||
autoload -Uz +X colors && colors
|
autoload -Uz +X colors && colors
|
||||||
|
@@ -4,10 +4,8 @@ typeset -A ZSHU_TI_KEYS
|
|||||||
typeset -A ZSHU_FB_KEYS
|
typeset -A ZSHU_FB_KEYS
|
||||||
|
|
||||||
if z-ti-test smkx rmkx ; then
|
if z-ti-test smkx rmkx ; then
|
||||||
zle-line-init() { emulate -L zsh ; echoti smkx ; }
|
zle-line-init() { echoti smkx ; }
|
||||||
zle-line-finish() { emulate -L zsh ; echoti rmkx ; }
|
zle-line-finish() { echoti rmkx ; }
|
||||||
# zle-line-init() { echoti smkx ; }
|
|
||||||
# zle-line-finish() { echoti rmkx ; }
|
|
||||||
zle -N zle-line-init
|
zle -N zle-line-init
|
||||||
zle -N zle-line-finish
|
zle -N zle-line-finish
|
||||||
fi
|
fi
|
||||||
@@ -87,7 +85,7 @@ z-bind () {
|
|||||||
case "${widget}" in
|
case "${widget}" in
|
||||||
/* )
|
/* )
|
||||||
widget=${widget:1}
|
widget=${widget:1}
|
||||||
emulate zsh -c "autoload -RUz ${widget}"
|
autoload -RUz "${widget}"
|
||||||
zle -N "${widget}"
|
zle -N "${widget}"
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
@@ -131,8 +129,3 @@ z-bind emacs viins vicmd -- Esc-w kill-region
|
|||||||
|
|
||||||
## use emacs key bindings
|
## use emacs key bindings
|
||||||
bindkey -e
|
bindkey -e
|
||||||
|
|
||||||
for i ( /usr/share/doc/fzf/examples/key-bindings.zsh ) ; do
|
|
||||||
[ -s "$i" ] || continue
|
|
||||||
source $i
|
|
||||||
done ; unset i
|
|
7
.config/zsh/rc/keyboard-extras.zsh
Normal file
7
.config/zsh/rc/keyboard-extras.zsh
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
#!/bin/zsh
|
||||||
|
|
||||||
|
## TODO: more fzf locations
|
||||||
|
for i ( /usr/share/doc/fzf/examples/key-bindings.zsh ) ; do
|
||||||
|
[ -s "$i" ] || continue
|
||||||
|
source $i
|
||||||
|
done ; unset i
|
@@ -84,17 +84,25 @@ z-ps1() {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
local k
|
local k ; k=$1
|
||||||
for k ( "$1" "${1}L" ) ; do
|
case "$k" in
|
||||||
(( ${+ZSHU_PS1[$k]} )) || continue
|
[1-9] )
|
||||||
|
(( ${+ZSHU_PS1[$k]} )) || k="${k}L"
|
||||||
|
;;
|
||||||
|
[1-9][Ll] )
|
||||||
|
(( ${+ZSHU_PS1[$k]} )) || k="${k%?}L"
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
(( ${+ZSHU_PS1[$k]} )) || return 1
|
||||||
|
|
||||||
ZSHU_PS[ps1]=$k
|
ZSHU_PS[ps1]=$k
|
||||||
PS1=${ZSHU_PS1[$k]}
|
PS1=${ZSHU_PS1[$k]}
|
||||||
return
|
|
||||||
done
|
|
||||||
return 1
|
|
||||||
}
|
}
|
||||||
|
|
||||||
z-ps1 3
|
if [ "${ZSHU_RUN[nested1L]}" = 1 ] ; then
|
||||||
[ "${ZSHU_RUN[nested]}" = 1 ] && z-ps1 2
|
z-ps1 1
|
||||||
[ "${ZSHU_RUN[nested1L]}" = 1 ] && z-ps1 1
|
elif [ "${ZSHU_RUN[nested]}" = 1 ] ; then
|
||||||
|
z-ps1 2
|
||||||
|
else
|
||||||
|
z-ps1 3
|
||||||
|
fi
|
||||||
|
Reference in New Issue
Block a user