X-Git-Url: https://git.madduck.net/etc/zsh.git/blobdiff_plain/1918b63567401917a02af7deb8f999432ea605a7..d1a7abb4d44890ae6605a73d246b2eaa20a09c08:/.zsh/zshrc/39_tempfuncs 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