From 5341a1914195ae79613af07243633c5a47eded2d Mon Sep 17 00:00:00 2001 From: Jacob Bohanon Date: Tue, 1 Apr 2025 01:00:13 -0400 Subject: [PATCH] puuuuuush --- .gitconfig | 4 +++- init.sh | 2 +- zsh/config.d/fzf.zsh | 29 +++++++++++++++++++++++++++++ zsh/gitclone.sh | 0 4 files changed, 33 insertions(+), 2 deletions(-) create mode 100644 zsh/config.d/fzf.zsh mode change 100644 => 100755 zsh/gitclone.sh diff --git a/.gitconfig b/.gitconfig index 34118cc..d6199c7 100644 --- a/.gitconfig +++ b/.gitconfig @@ -1,9 +1,11 @@ [user] name = Jacob Bohanon - email = jacob.bohanon@solo.io + email = jacobbohanon@gmail.com signingkey = /home/jacob/.ssh/id_ed25519.pub [url "ssh://git@github.com/"] insteadOf = https://github.com/ +[url "ssh://git@git.nonahob.net:30009/"] + insteadOf = https://git.nonahob.net/ [tag] sort = version:refname [init] diff --git a/init.sh b/init.sh index f15ee6c..0d78239 100755 --- a/init.sh +++ b/init.sh @@ -9,7 +9,7 @@ echo "PKGUPD: ${PKGUPD}" echo "PKGINST: ${PKGINST}" # Install zsh, neovim, ripgrep, fd -[[ $PKGINST != '' ]] && $PKGUPD && $PKGINST curl tmux zsh ripgrep fd-find fzf +[[ $PKGINST != '' ]] && $PKGUPD && $PKGINST curl tmux zsh ripgrep fd-find fzf tree # Install neovim pushd /tmp || true diff --git a/zsh/config.d/fzf.zsh b/zsh/config.d/fzf.zsh new file mode 100644 index 0000000..e66c240 --- /dev/null +++ b/zsh/config.d/fzf.zsh @@ -0,0 +1,29 @@ +cdf_preview() { + if [ -d $1 ]; then + tree -L 1 $1 + else + cat $1 + fi +} +# cdf - cd with fuzzy finder +# Usage: cdf [path] +cdf() { + local fd_options fzf_options target + + fd_options=( + --hidden + ) + + fzf_options=( + # --preview='echo {}' + --preview='([[ -d {} ]] && tree -L 1 {}) || ([[ -L {} ]] && ls -al {}) || cat {}' + --bind=ctrl-space:toggle-preview + --exit-0 + ) + + target="$(fdfind . "${1:-.}" "${fd_options[@]}" | fzf "${fzf_options[@]}")" + + ([[ -f "$target" ]] || [[ -L "$target" ]]) && target="${target%/*}" + + cd "$target" || return 1 +} diff --git a/zsh/gitclone.sh b/zsh/gitclone.sh old mode 100644 new mode 100755