From 7de3287d7f566fa2323ae01ac5d4792295c40c6e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Chlo=C3=A9=20Vulquin?= Date: Mon, 19 Jan 2026 18:43:41 +0100 Subject: zsh: change implementation of tt In zsh, an EXIT trap defined in a function runs on that function's execution end. Unfortunately, that's not what I want! Instead, there's the zsh hook zshexit, but that takes a function. This changes tt to add the generated directories to a deduplicated array, which is cleaned up on exit, as long as the function has been loaded. --- dot_config/zsh/zshrc | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) (limited to 'dot_config/zsh/zshrc') diff --git a/dot_config/zsh/zshrc b/dot_config/zsh/zshrc index f7d4cc2..f0c99e2 100644 --- a/dot_config/zsh/zshrc +++ b/dot_config/zsh/zshrc @@ -41,16 +41,11 @@ if [[ -x =luarocks ]] { } ## Functions +autoload -Uz tt t() { mkdir -p /tmp/t cd /tmp/t } -tt() { - local dir=$(mktemp -d) - [ -d "$dir" ] || return 1 - cd "$dir" - trap "rm -rf '$dir'" EXIT -} # you may want to: # set up jump/zoxide/etc -- cgit v1.2.3