X-Git-Url: https://git.madduck.net/etc/zsh.git/blobdiff_plain/0a03dffac6c1304d4bf57f54bbd0c36ea1e337c8..ad8b383d21775f621bab9a72a76413fc9fdd00ef:/.zsh/zshrc/40_tempfuncs?ds=sidebyside diff --git a/.zsh/zshrc/40_tempfuncs b/.zsh/zshrc/40_tempfuncs new file mode 100644 index 0000000..1c1d551 --- /dev/null +++ b/.zsh/zshrc/40_tempfuncs @@ -0,0 +1,23 @@ +# zshrc/25_tempfiles +# +# Helper functions to create temporary files and directories +# +# Copyright © 1994–2008 martin f. krafft +# Released under the terms of the Artistic Licence 2.0 +# +# Source repository: http://git.madduck.net/v/etc/zsh.git +# + +cdt () { + cd $(mktemp -td cdt.XXXXXXXX) + pwd +} + +vit () { + local tmpfile=$(mktemp -t vit.XXXXXXXX) + [ "$1" = '-' ] && cat >| $tmpfile + sensible-editor $tmpfile /dev/tty + echo $tmpfile +} + +# vim:ft=zsh