refactored some stuff
This commit is contained in:
parent
e007eb5a58
commit
5f3ecf6090
29 changed files with 91 additions and 666 deletions
44
zsh/files/termsupport.zsh
Normal file
44
zsh/files/termsupport.zsh
Normal file
|
@ -0,0 +1,44 @@
|
|||
function title {
|
||||
emulate -L zsh
|
||||
setopt prompt_subst
|
||||
|
||||
[[ "$EMACS" == *term* ]] && return
|
||||
|
||||
: ${2=$1}
|
||||
|
||||
case "$TERM" in
|
||||
cygwin|xterm*|putty*|rxvt*|ansi)
|
||||
print -Pn "\e]2;$2:q\a"
|
||||
print -Pn "\e]1;$1:q\a"
|
||||
;;
|
||||
screen*|tmux*)
|
||||
print -Pn "\ek$1:q\e\\"
|
||||
;;
|
||||
*)
|
||||
if [[ -n "$terminfo[fsl]" ]] && [[ -n "$terminfo[tsl]" ]]; then
|
||||
echoti tsl
|
||||
print -Pn "$1"
|
||||
echoti fsl
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
function omz_termsupport_precmd {
|
||||
emulate -L zsh
|
||||
|
||||
title '%15<..<%~%<<' '%n@%m: %~'
|
||||
}
|
||||
|
||||
function omz_termsupport_preexec {
|
||||
emulate -L zsh
|
||||
setopt extended_glob
|
||||
|
||||
local CMD=${1[(wr)^(*=*|sudo|ssh|mosh|rake|-*)]:gs/%/%%}
|
||||
local LINE="${2:gs/%/%%}"
|
||||
|
||||
title '$CMD' '%100>...>$LINE%<<'
|
||||
}
|
||||
|
||||
precmd_functions+=(omz_termsupport_precmd)
|
||||
preexec_functions+=(omz_termsupport_preexec)
|
Loading…
Add table
Add a link
Reference in a new issue