Add cdf alias
This commit is contained in:
parent
989430492e
commit
d1e8fe0a0a
2 changed files with 19 additions and 0 deletions
|
|
@ -114,6 +114,9 @@ g, gs, ga, gc, gp, gl, gd, gco, gb # Git operations
|
||||||
# Nix management
|
# Nix management
|
||||||
hm # home-manager shortcut
|
hm # home-manager shortcut
|
||||||
hms # Quick home-manager switch (rebuild)
|
hms # Quick home-manager switch (rebuild)
|
||||||
|
|
||||||
|
# Directory navigation helpers
|
||||||
|
cdf [pattern] # Find file/directory and cd to its location
|
||||||
```
|
```
|
||||||
|
|
||||||
### 🖥️ Session Management: Tmux
|
### 🖥️ Session Management: Tmux
|
||||||
|
|
@ -373,6 +376,9 @@ nvim $(fd --type f | fzf --preview 'bat --color=always {}')
|
||||||
# Smart directory navigation with zoxide
|
# Smart directory navigation with zoxide
|
||||||
cd proj && nvim . # Jump to project directory and edit
|
cd proj && nvim . # Jump to project directory and edit
|
||||||
zi && fd "*.md" | fzf # Interactive directory select, then find markdown files
|
zi && fd "*.md" | fzf # Interactive directory select, then find markdown files
|
||||||
|
|
||||||
|
# Find and navigate to directories containing specific files
|
||||||
|
cdf "Universal Sparse" # Search for files/dirs matching pattern and cd there
|
||||||
```
|
```
|
||||||
|
|
||||||
#### Built-in zsh keybindings:
|
#### Built-in zsh keybindings:
|
||||||
|
|
|
||||||
|
|
@ -113,6 +113,19 @@ in
|
||||||
|
|
||||||
# Zoxide configuration - replace cd with z for smart directory jumping
|
# Zoxide configuration - replace cd with z for smart directory jumping
|
||||||
eval "$(zoxide init zsh --cmd cd)"
|
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