Skip to content

Commit

Permalink
chore!: Switch rr from function to alias
Browse files Browse the repository at this point in the history
More flexible
  • Loading branch information
alexpovel committed Sep 8, 2023
1 parent 5a5c403 commit dd744e5
Showing 1 changed file with 3 additions and 11 deletions.
14 changes: 3 additions & 11 deletions home/.zshrc
Original file line number Diff line number Diff line change
Expand Up @@ -31,17 +31,9 @@ export ZSH_COLORIZE_STYLE="dracula"
# Custom functions
# =====================================================================================

# Switches to current git repository's root directory, if possible.
function rr() {
dir="$(git rev-parse --show-toplevel 2>/dev/null || pwd)"

if command -v z 1>/dev/null 2>&1; then
# Use zoxide if available
__zoxide_z "$dir"
else
cd "$dir"
fi
}
# Gets current git repository's root directory, if possible. Use as `z `rr``, for
# example. Works with Tab completion.
alias rr="$(git rev-parse --show-toplevel 2>/dev/null || pwd)"

# =====================================================================================
# Custom aliases
Expand Down

0 comments on commit dd744e5

Please sign in to comment.