]> git.madduck.net Git - etc/zsh.git/commitdiff

madduck's git repository

Every one of the projects in this repository is available at the canonical URL git://git.madduck.net/madduck/pub/<projectpath> — see each project's metadata for the exact URL.

All patches and comments are welcome. Please squash your changes to logical commits before using git-format-patch and git-send-email to patches@git.madduck.net. If you'd read over the Git project's submission guidelines and adhered to them, I'd be especially grateful.

SSH access, as well as push access can be individually arranged.

If you use my repositories frequently, consider adding the following snippet to ~/.gitconfig and using the third clone URL listed for each project:

[url "git://git.madduck.net/madduck/"]
  insteadOf = madduck:

improve TS typescript handler
authormartin f. krafft <madduck@madduck.net>
Thu, 1 Mar 2018 02:48:59 +0000 (15:48 +1300)
committermartin f. krafft <madduck@madduck.net>
Thu, 1 Mar 2018 02:48:59 +0000 (15:48 +1300)
.zsh/zshrc/20-tempfile+dir_functions

index b887ba64030017f38a783eee09acdc553b4be16a..f44c0582bf36edbd47b379ac5833146b8eb9bf8d 100644 (file)
@@ -86,14 +86,21 @@ zle -N _copy_reply
 bindkey '\ec' _copy_reply
 
 TS() {
 bindkey '\ec' _copy_reply
 
 TS() {
-  local topic ret quiet
-  typeset -g REPLY
+  local topic ts ret script
   topic="${(j:_:)@}"
   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="
   PS1="
-%# " RPS1= script -qe -c "zsh -f" -f "$REPLY"
+%# " RPS1= script -qe -c "zsh -f" -f "$script"
   ret=$?
   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
 }
 
   return $ret
 }