# zshrc/40_tempfuncs
#
# Helper functions to create temporary files and directories
#
# Copyright © 1994–2008 martin f. krafft <madduck@madduck.net>
# Released under the terms of the Artistic Licence 2.0
#
# Source repository: http://git.madduck.net/v/etc/zsh.git
#

cdt () {
  builtin cd $(mktemp -td cdt.XXXXXXXX)
  pwd
}

vit () {
  local tmpfile=$(mktemp -t vit.XXXXXXXX)
  [ "$1" = '-' ] && cat >| $tmpfile
  sensible-editor $tmpfile </dev/tty >/dev/tty
  echo $tmpfile
}

# vim:ft=zsh