From 0204ae8a5d0581c25a3ca0f44181e057f5ba6fdd Mon Sep 17 00:00:00 2001 From: earnest ma Date: Mon, 21 Feb 2022 10:05:25 -0500 Subject: [PATCH] onefetch: display w/ cd --- zsh/.zshrc | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/zsh/.zshrc b/zsh/.zshrc index 73af20d..f407df8 100644 --- a/zsh/.zshrc +++ b/zsh/.zshrc @@ -99,7 +99,22 @@ gpgyeet() { # emacs magit magit() { - emacs --eval "(progn (magit-status) (delete-other-windows))" + emacs --eval "(progn (magit-status) (delete-other-windows))" +} + +# eye candy: auto onefetch (consider if this is really needed lol) +# https://www.reddit.com/r/unixporn/comments/sxa02o/oc_neofetch_for_git_repositories/ +LAST_REPO="" +cd(){ + builtin cd "$@" + git rev-parse 2>/dev/null + + if [ $? -eq 0 ]; then + if [ "$LAST_REPO" != $(basename $(git rev-parse --show-toplevel)) ]; then + onefetch + LAST_REPO=$(basename $(git rev-parse --show-toplevel)) + fi + fi } # PLUGINS!