Move fff function from find to fdfind

This commit is contained in:
Jeremy Gardais 2023-02-06 16:06:37 +01:00
parent 35c5bb5b79
commit 8f9e91b3ff
Signed by: jegardai
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 ##Cree le repertoire et va dedans
function mkcd() { function mkcd() {
mkdir $1 && cd $_ mkdir -- $1 && cd $_
} }
@ -2122,7 +2122,7 @@ ffu() {
} }
# }}} # }}}
# fff - cd to the directory of the selected file {{{ # 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 # Check for symlinked files too
# Allow to give arguments to prefill fzf request # Allow to give arguments to prefill fzf request
# Display a directory preview tree of the selected file with exa # Display a directory preview tree of the selected file with exa
@ -2134,10 +2134,10 @@ fff() {
## Manage argument {{{ ## Manage argument {{{
if [ "${#}" -eq "0" ]; then if [ "${#}" -eq "0" ]; then
## Default command without args ## 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 else
## If at least one argument was given, add it to fzf query ## 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 fi
## }}} ## }}}