Add cdf alias
This commit is contained in:
parent
989430492e
commit
d1e8fe0a0a
2 changed files with 19 additions and 0 deletions
|
|
@ -113,6 +113,19 @@ in
|
|||
|
||||
# Zoxide configuration - replace cd with z for smart directory jumping
|
||||
eval "$(zoxide init zsh --cmd cd)"
|
||||
|
||||
# Function to cd to directory containing a file selected with fzf
|
||||
function cdf() {
|
||||
local file
|
||||
file=$(fd "$@" ~ | fzf)
|
||||
if [[ -n "$file" ]]; then
|
||||
if [[ -d "$file" ]]; then
|
||||
cd "$file"
|
||||
else
|
||||
cd "$(dirname "$file")"
|
||||
fi
|
||||
fi
|
||||
}
|
||||
'';
|
||||
};
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue