Move fff function from find to fdfind

This commit is contained in:
gardouille 2023-02-06 16:06:37 +01:00
parent 35c5bb5b79
commit 8f9e91b3ff
Signed by: gardouille
GPG Key ID: E759BAA22501AF32
1 changed files with 4 additions and 4 deletions

8
zshrc
View File

@ -1252,7 +1252,7 @@ alias stat_sys="echo ' ' && uname -a && echo ' '&& uptime &&echo ' '&& df && ech
##Cree le repertoire et va dedans
function mkcd() {
mkdir $1 && cd $_
mkdir -- $1 && cd $_
}
@ -2122,7 +2122,7 @@ ffu() {
}
# }}}
# fff - cd to the directory of the selected file {{{
# Search with find (fd|fdfind overkill the CPU for few benefits on small tree)
# Search with fd (after few tests, fdfind is fareway better than find… even on small tree)
# Check for symlinked files too
# Allow to give arguments to prefill fzf request
# Display a directory preview tree of the selected file with exa
@ -2134,10 +2134,10 @@ fff() {
## Manage argument {{{
if [ "${#}" -eq "0" ]; then
## Default command without args
file=$(find . -xtype f | fzf --prompt='cd> ' --height=50% --preview 'exa --tree --level 2 $(dirname {}) | head --lines=20' --no-multi) &&
file=$(fd -uu --type file --type symlink | fzf --prompt='cd> ' --height=50% --preview 'exa --tree --level 2 $(dirname {}) | head --lines=20' --no-multi) &&
else
## If at least one argument was given, add it to fzf query
file=$(find . -xtype f | fzf --prompt='cd> ' --height=50% --preview 'exa --tree --level 2 $(dirname {}) | head --lines=20' --no-multi --query "${*} ") &&
file=$(fd -uu --type file --type symlink | fzf --prompt='cd> ' --height=50% --preview 'exa --tree --level 2 $(dirname {}) | head --lines=20' --no-multi --query "${*} ") &&
fi
## }}}