dotfiles

Dash Eclipse's dotfiles
git clone git://ezup.dev/dotfiles.git
Log | Files | Refs | README | LICENSE

commit 8e8cbe9dd6b994851f7cb29b1facc14e13327a26
parent 09f52ba612d54e128919dd618b1cd77bde794442
Author: Dash Eclipse <dashezup@disroot.org>
Date:   Thu, 21 Jul 2022 07:27:20 +0000

feat: .zshrc.local: add cdgit()

Diffstat:
M.zshrc.local | 15+++++++++++++++
1 file changed, 15 insertions(+), 0 deletions(-)

diff --git a/.zshrc.local b/.zshrc.local @@ -82,6 +82,21 @@ speedtest-connection() { printf "%.0fms\n" $((time_seconds * 1000)) } +cdgit() { + REPO_PATH=$(git rev-parse --show-toplevel 2>/dev/null) + if [[ "$1" == / ]]; then + cd "${REPO_PATH}" + return + fi + if [ ! -z $REPO_PATH ]; then + NEW_PATH=$(git ls-tree -d -r --name-only HEAD | fzf --layout=reverse --inline-info --prompt='cd ' --height=20) + test -z $NEW_PATH || cd "$NEW_PATH" + else + echo "not a git repo" + return 1 + fi +} + dict() { /usr/bin/dict $@ \ | GREP_COLORS='ms=00;30;44' grep --color=always -P '(?<=^From\ ).*(?=\ \[)|$' \