X-Git-Url: https://git.madduck.net/etc/zsh.git/blobdiff_plain/f157c04d1fd31400e0d793914ec84d0498f0a315..653030190096887a4084c50ab96dd74eaa928368:/.zsh/zshrc/39_tempfuncs?ds=inline diff --git a/.zsh/zshrc/39_tempfuncs b/.zsh/zshrc/39_tempfuncs index 4b46a17..d3391f6 100644 --- a/.zsh/zshrc/39_tempfuncs +++ b/.zsh/zshrc/39_tempfuncs @@ -9,13 +9,17 @@ # cdt () { - builtin cd $(mktemp -td ${1:-cdt}.XXXXXX) + local tmpdir + tmpdir=$(mktemp -td ${1:-cdt}.XXXXXX) + builtin cd $tmpdir pwd + rm -f ${TMPDIR:-/tmp}/cdt.latest + ln -s $tmpdir ${TMPDIR:-/tmp}/cdt.latest } vit () { local prefix - for i in "$@"; do + for i in "$@"; do case "$i" in -) local stdin=1; shift;; *) if [ -z "${prefix:-}" ]; then @@ -31,6 +35,7 @@ vit () { [ -n "$stdin" ] && cat >| $tmpfile sensible-editor $tmpfile /dev/tty echo $tmpfile + ln -sf $tmpfile ${TMPDIR:-/tmp}/vit.latest } # vim:ft=zsh