Add commands for fzfd (fzf for directories), cdf, cpf, mvf, rmf (all
variants that use fzf, in the case of cp and mv that takes two paths, they accept an argument for the second path, or if left empty uses fzf for the first and second path)
This commit is contained in:
parent
f2c43242f5
commit
79cdc0f23b
1 changed files with 37 additions and 0 deletions
37
home/.zshrc
37
home/.zshrc
|
|
@ -130,6 +130,7 @@ fi
|
|||
alias pilot="gh copilot"
|
||||
alias ps="gh copilot suggest"
|
||||
alias pe="gh copilot explain"
|
||||
alias fzfd="fd --type d --hidden --follow --exclude .git | fzf"
|
||||
|
||||
# Alias functions
|
||||
vif() {
|
||||
|
|
@ -148,6 +149,42 @@ catc() {
|
|||
cat "$1" | wlc
|
||||
}
|
||||
|
||||
cdf() {
|
||||
cd "$(fzfd)"
|
||||
}
|
||||
|
||||
cpf() {
|
||||
if [ -z "$1" ]; then
|
||||
cp "$(fzf)" "$(fzfd)"
|
||||
else
|
||||
cp "$(fzf)" "$1"
|
||||
fi
|
||||
}
|
||||
|
||||
mvf() {
|
||||
if [ -z "$1" ]; then
|
||||
mv "$(fzf)" "$(fzfd)"
|
||||
else
|
||||
mv "$(fzf)" "$1"
|
||||
fi
|
||||
}
|
||||
|
||||
rmf() {
|
||||
if [ -z "$1" ]; then
|
||||
mv "$(fzf)" "$(fzfd)"
|
||||
else
|
||||
mv "$(fzf)" "$1"
|
||||
fi
|
||||
}
|
||||
|
||||
rmdf() {
|
||||
if [ -z "$1" ]; then
|
||||
mv "$(fzf)" "$(fzfd)"
|
||||
else
|
||||
mv "$(fzf)" "$1"
|
||||
fi
|
||||
}
|
||||
|
||||
# Check if tmux is already running or if the session is interactive
|
||||
if [[ -z "$TMUX" ]] && [[ $- == *i* ]]; then
|
||||
# Create a new tmux session, if one doesnt exist, give it the main name, never attach to a session
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue