mirror of
https://github.com/junegunn/fzf.git
synced 2025-11-19 00:53:42 -05:00
fix fdr function for relative and non-existent paths
13
Examples.md
13
Examples.md
@@ -67,16 +67,15 @@ fda() {
|
|||||||
fdr() {
|
fdr() {
|
||||||
local declare dirs=()
|
local declare dirs=()
|
||||||
get_parent_dirs() {
|
get_parent_dirs() {
|
||||||
dirs+=("$1")
|
if [[ -d "${1}" ]]; then dirs+=("$1"); else return; fi
|
||||||
if [[ ${1} == '/' ]]; then
|
if [[ "${1}" == '/' ]]; then
|
||||||
for _dir in ${dirs[@]}; do
|
for _dir in "${dirs[@]}"; do echo $_dir; done
|
||||||
echo $_dir
|
|
||||||
done
|
|
||||||
else
|
else
|
||||||
get_parent_dirs $(dirname $1)
|
get_parent_dirs $(dirname "$1")
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
DIR=$(get_parent_dirs ${1:-$(pwd)} | fzf-tmux --tac) && cd "$DIR"
|
local DIR=$(get_parent_dirs $(realpath "${1:-$(pwd)}") | fzf-tmux --tac)
|
||||||
|
cd "$DIR"
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user