From 954587da2beecd1bf0a931b3c44a6b9c2b54a82f Mon Sep 17 00:00:00 2001 From: Spenser Truex Date: Mon, 25 Jan 2021 15:45:04 +0000 Subject: [PATCH] Actually cache the experimental mode stuff --- Cache-aliases-Startup.md | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/Cache-aliases-Startup.md b/Cache-aliases-Startup.md index 6b5158b..52a862e 100644 --- a/Cache-aliases-Startup.md +++ b/Cache-aliases-Startup.md @@ -25,10 +25,13 @@ Doing this with `--enable-experimental-instant-mode` requires some care, because This is a zsh script. To check for the login shell in bash, use `shopt -q login_shell` instead of setopt. ```zsh #!/bin/zsh +thefuck_experimental_cache="$XDG_RUNTIME_DIR"/thefuck_experimental_cache THEFUCK_EXPERIMENTAL_LOCK_KLUDGE="$XDG_RUNTIME_DIR"/thefuck_experimental_lock_kludge experimentallyinstantlylockkludginglyverylongname () { printf %s " $$ " >>"$THEFUCK_EXPERIMENTAL_LOCK_KLUDGE" - eval "$(thefuck --enable-experimental-instant-mode --alias noop)" + [[ ! -f "$thefuck_experimental_cache" ]] \ + && thefuck --enable-experimental-instant-mode --alias noop >"$thefuck_experimental_cache" \ + && source "$thefuck_experimental_cache" } [[ ! -e "$THEFUCK_EXPERIMENTAL_LOCK_KLUDGE" ]] \ @@ -43,3 +46,5 @@ else rm "$THEFUCK_EXPERIMENTAL_LOCK_KLUDGE" fi ``` + +```