( shyciii | 2024. 04. 19., p – 07:24 )

Akkor az ideiglenes megoldásra ez lett (aztán majd ha megcsinálja a zoxide vagy egyéb fejlesztő file-ra is, akkor váltok):

 

#!/usr/bin/bash

selection=$(find / -type f ! -path "/proc/*" ! -path "/mnt/*" 2>/dev/null | fzf --exact --multi --height=80% --border=sharp --color='fg+:red' \
--preview='batcat {}' --preview-window='45%,border-sharp' \
--prompt='Files > ' \
--bind='ctrl-d:reload(find / -type d ! -path "/proc/*" ! -path "/mnt/*" 2>/dev/null)' \
--bind='ctrl-d:+change-prompt(Dirs > )' \
--bind='ctrl-d:+change-preview(tree -C {})' \
--bind='ctrl-d:+refresh-preview' \
--bind='ctrl-f:change-prompt(Files > )' \
--bind='ctrl-f:+reload(find / -type f ! -path "/proc/*" ! -path "/mnt/*" 2>/dev/null)' \
--bind='ctrl-f:+change-preview(batcat {})' \
--bind='ctrl-f:+refresh-preview' \
--header '
CTRL-D to display directories | CTRL-F to display files
'
)

if [ -d "$selection" ]; then
    cd $selection || exit
elif [ -f "$selection" ]; then
    if sudo -u "$USER" test -w "$selection"; then
        eval "nano $selection"
exit
    else
        eval "sudo nano $selection"
exit
    fi
fi