From b21b00a88545938f36f69aefadc058bd6b26e5e8 Mon Sep 17 00:00:00 2001 From: Anthony Cicchetti Date: Thu, 18 Feb 2021 13:26:01 -0500 Subject: [PATCH] Add root() function --- zsh/zshrc | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/zsh/zshrc b/zsh/zshrc index 0b5ea99..6658eec 100644 --- a/zsh/zshrc +++ b/zsh/zshrc @@ -142,6 +142,14 @@ function edit() { eval "${editor}" } +function root() { + if [[ -n $(git rev-parse --show-toplevel) ]] + then + cd "$(git rev-parse --show-toplevel)" + fi +} + + if [[ -d $HOME/.anyenv ]]; then path+=($HOME/.anyenv/bin) if [[ ( $ZNAP_USED = 1 ) ]]; then