diff --git a/Examples.md b/Examples.md index bf8ebb3..7f012db 100644 --- a/Examples.md +++ b/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)