From 4e34842a89a626c031160381fcd683d06bd53ce3 Mon Sep 17 00:00:00 2001 From: Guangxiong Lin Date: Mon, 26 Sep 2022 20:29:48 +0800 Subject: Add fcd command to help quickly switch directory --- .fzfrc | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/.fzfrc b/.fzfrc index 0d3b3fa..7a58bd8 100755 --- a/.fzfrc +++ b/.fzfrc @@ -32,6 +32,20 @@ esac # functions +fcd () { + local dir dirs + if command -v fd &> /dev/null; then + dirs=$( + fd --type directory --hidden \ + --exclude .git --no-ignore + ) + fi + dir=$(echo "$dirs" | fzf) + if [ $? -eq 0 ]; then + cd "$dir" + fi +} + fco () { local tags branches target branches=$( -- cgit v1.2.3