Last active
January 20, 2023 14:56
-
-
Save Vaisakhkm2625/88d247d97c49ced09b23885c6b1c0505 to your computer and use it in GitHub Desktop.
fuzzyCD - fuzzyfind a file and cd into that dir containing that file
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#add his to your bashrc file | |
#then type fcd to search for file and cd into that dir. | |
#fzf needs to be installed | |
fzfa(){ | |
fzf --color 'fg:#839496,fg+:#93a1a1,bg:#002b36,bg+:#073642' --height 50% --reverse | |
} | |
fcd() { | |
local target; | |
target="$(find . -name '.git' -type d -prune -o -name 'undodir' -type d -prune -o -type f -print | fzfa)" || return; | |
cd "${target%/*}"; | |
} | |
--------------------------------------- | |
This is the new way to do | |
export FZF_DEFAULT_COMMAND='fd --color=always --type file --follow --hidden --exclude .git' | |
export FZF_DEFAULT_OPTS="--ansi" | |
fcd() { | |
local target; | |
target="$(fzf)" || return; | |
cd "${target%/*}"; | |
} | |
------------------------------ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment