mirror of
https://github.com/junegunn/fzf.git
synced 2025-11-19 00:53:42 -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
|
```sh
|
||||||
# cf - fuzzy cd from anywhere
|
# cf - fuzzy cd from anywhere
|
||||||
# ex: cf word1 word2 ... (even part of a file name)
|
# ex: cf word1 word2 ... (even part of a file name)
|
||||||
|
|||||||
Reference in New Issue
Block a user