From 9d300c3a4c26acfa2efc1f51caea35c5365eddba Mon Sep 17 00:00:00 2001 From: "martin f. krafft" Date: Thu, 1 Mar 2018 15:48:59 +1300 Subject: [PATCH] improve TS typescript handler --- .zsh/zshrc/20-tempfile+dir_functions | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) 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 } -- 2.39.2