dotfiles/.config/shell/functions/cdf
PowerUser64 06ab216290 zsh: realized some things need to be functions
By that, I mean things that change my working directory need to be
functions
2022-01-01 18:24:20 -08:00

14 lines
363 B
Bash

#!/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
cdf() {
DIR="$(fd $@ | fzy)"
if [ -f "$DIR" ];then
cd "$(dirname "$DIR")" && pwd
else
cd "$DIR" && pwd
fi
}