From: martin f. krafft Date: Thu, 1 Mar 2018 02:48:59 +0000 (+1300) Subject: improve TS typescript handler X-Git-Url: https://git.madduck.net/etc/zsh.git/commitdiff_plain/9d300c3a4c26acfa2efc1f51caea35c5365eddba?ds=inline improve TS typescript handler --- diff --git a/.zsh/zshrc/20-tempfile+dir_functions b/.zsh/zshrc/20-tempfile+dir_functions index b887ba6..f44c058 100644 --- a/.zsh/zshrc/20-tempfile+dir_functions +++ b/.zsh/zshrc/20-tempfile+dir_functions @@ -86,14 +86,21 @@ zle -N _copy_reply bindkey '\ec' _copy_reply TS() { - local topic ret quiet - typeset -g REPLY + local topic ts ret script topic="${(j:_:)@}" - REPLY="${TMPDIR:-/tmp}/script.${topic:-$LOGNAME}.$$.${(%):-"%D{%Y%m%d.%H%M}"}" + ts=${(%):-%D{%Y-%m-%d-%H%M}} + script="${TMPDIR:-/tmp}/$ts.$$.${topic:-$LOGNAME}.typescript" PS1=" -%# " RPS1= script -qe -c "zsh -f" -f "$REPLY" +%# " RPS1= script -qe -c "zsh -f" -f "$script" ret=$? - zinfo "typescript is in $REPLY ." + zinfo "typescript is in $script ." + typeset -g REPLY + REPLY="$script" + if command -v unterm >/dev/null; then + REPLY="${script}.txt" + unterm "$script" > "$REPLY" + zinfo "plain text transcript is in $REPLY ." + fi return $ret }