mirror of
https://github.com/junegunn/fzf.git
synced 2025-11-18 16:45:38 -05:00
fdr - cd to selected parent directory
18
Examples.md
18
Examples.md
@@ -61,6 +61,24 @@ fda() {
|
||||
}
|
||||
```
|
||||
|
||||
```sh
|
||||
# fdr - cd to selected parent directory
|
||||
fdr() {
|
||||
local declare dirs=()
|
||||
get_parent_dirs() {
|
||||
dirs+=("$1")
|
||||
if [[ ${1} == '/' ]]; then
|
||||
for _dir in ${dirs[@]}; do
|
||||
echo $_dir
|
||||
done
|
||||
else
|
||||
get_parent_dirs $(dirname $1)
|
||||
fi
|
||||
}
|
||||
DIR=$(get_parent_dirs ${1:-$(pwd)} | fzf-tmux --tac) && cd "$DIR"
|
||||
}
|
||||
```
|
||||
|
||||
```sh
|
||||
# cf - fuzzy cd from anywhere
|
||||
# ex: cf word1 word2 ... (even part of a file name)
|
||||
|
||||
Reference in New Issue
Block a user