From fca220a01ef1abe225dc85eddbc9724ad59970b8 Mon Sep 17 00:00:00 2001 From: PowerUser64 Date: Wed, 27 Oct 2021 23:34:32 -0700 Subject: [PATCH] zsh: add cdf() (cd file) --- .zshrc | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/.zshrc b/.zshrc index caf2e5e..dd272db 100644 --- a/.zshrc +++ b/.zshrc @@ -171,6 +171,13 @@ fi } + # cd file: cd to the containing dir of a file, given part of its name + # can take an `fd` command + # requires that `fzy` is installed + cdf() { + cd "$(dirname "$(fd $@ | fzy)")" && pwd + } + # toggles whether a file or group of files is executable chx() { for FILE in "$@";do