dotfiles/.config/shell/bin/cdf

15 lines
337 B
Text
Raw Normal View History

#!/bin/bash
# cd find (interactive): cd to the containing dir of a file, or inside a folder, given part of its name
# Basically, an interactive version of what's above
# can take an `fd` command
# requires that `fzy` is installed
DIR="$(fd $@ | fzy)"
if [ -f "$DIR" ];then
cd "$(dirname "$DIR")" && pwd
else
cd "$DIR" && pwd
fi