diff --git a/_Sidebar-Cache---alias.md b/_Sidebar-Cache---alias.md deleted file mode 100644 index 6b5158b..0000000 --- a/_Sidebar-Cache---alias.md +++ /dev/null @@ -1,45 +0,0 @@ -Thefuck takes longer to generate aliases than it takes hell to freeze over: -```sh -time thefuck --alias -thefuck --alias 0.12s user 0.04s system 92% cpu 0.172 total -# What the fuck? -``` -This can be cached in your shell's startup script `.bashrc` or whatever: -```sh -[ -n "$XDG_RUNTIME_DIR" ] && thefuck_cache="$XDG_RUNTIME_DIR"/thefuck_cache -[ -z "$XDG_RUNTIME_DIR" ] && thefuck_cache="$HOME"/.local/share/runtime/thefuck_cache -if [ ! -f "$thefuck_cache" ]; then - thefuck --alias k | tee -a "$thefuck_cache" - thefuck --alias fk | tee -a "$thefuck_cache" - thefuck --alias fcuk | tee -a "$thefuck_cache" - thefuck --alias fuc | tee -a "$thefuck_cache" - thefuck --alias fcu | tee -a "$thefuck_cache" - thefuck --alias fuck | tee -a "$thefuck_cache" - thefuck --alias fuk | tee -a "$thefuck_cache" -fi -source "$thefuck_cache" -unset thefuck_cache -``` -Doing this with `--enable-experimental-instant-mode` requires some care, because doing it wrong will cause thefuck to run infinite processes until it fills up your memory and crashes your computer! - -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_LOCK_KLUDGE="$XDG_RUNTIME_DIR"/thefuck_experimental_lock_kludge -experimentallyinstantlylockkludginglyverylongname () { - printf %s " $$ " >>"$THEFUCK_EXPERIMENTAL_LOCK_KLUDGE" - eval "$(thefuck --enable-experimental-instant-mode --alias noop)" -} - -[[ ! -e "$THEFUCK_EXPERIMENTAL_LOCK_KLUDGE" ]] \ - || touch "$THEFUCK_EXPERIMENTAL_LOCK_KLUDGE" - -if [[ -z "$(setopt | grep -i login)" ]]; then - [[ ! $(grep -qF -- " $$ " $THEFUCK_EXPERIMENTAL_LOCK_KLUDGE) ]] \ - && experimentallyinstantlylockkludginglyverylongname - # so here it is, not cached. -else - # Delete this file on startup so it doesn't grow indefinitely. - rm "$THEFUCK_EXPERIMENTAL_LOCK_KLUDGE" -fi -``` diff --git a/_Sidebar-Cache-aliases-and-experimental-mode.md b/_Sidebar-Cache-aliases-and-experimental-mode.md new file mode 100644 index 0000000..b132711 --- /dev/null +++ b/_Sidebar-Cache-aliases-and-experimental-mode.md @@ -0,0 +1 @@ +[Cache aliases Startup](https://github.com/nvbn/thefuck/wiki/Cache-aliases-Startup) \ No newline at end of file