aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGuangxiong Lin <[email protected]>2022-09-26 20:29:48 +0800
committerGuangxiong Lin <[email protected]>2022-09-26 20:29:48 +0800
commit4e34842a89a626c031160381fcd683d06bd53ce3 (patch)
treed1d1c73e2ce4a2dbf44442a64dd9045dcb3c75a0
parent8a8499bcad1a4b820dbfcb08c5bdbb1feea93377 (diff)
downloaddotfiles-4e34842a89a626c031160381fcd683d06bd53ce3.tar.gz
dotfiles-4e34842a89a626c031160381fcd683d06bd53ce3.tar.bz2
dotfiles-4e34842a89a626c031160381fcd683d06bd53ce3.zip
Add fcd command to help quickly switch directory
-rwxr-xr-x.fzfrc14
1 files changed, 14 insertions, 0 deletions
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=$(