set shell sh
set shellopts '-eu'
set icons true
set ifs "\n"
set info time

set previewer ~/.config/lf/preview
set cleaner ~/.config/lf/cleaner

cmd fzf_jump_home ${{
    res="$(find ~/ | fzf --header="Jump to location" || true)"
    if [ -n "$res" ]; then
        if [ -d "$res" ]; then
            cmd="cd"
        else
            cmd="select"
        fi
        res="$(printf '%s' "$res" | sed 's/\\/\\\\/g;s/"/\\"/g')"
        lf -remote "send $id $cmd \"$res\""
    fi
}}

cmd fzf_jump_current ${{
    res="$(find . | fzf --header="Jump to location" || true)"
    if [ -n "$res" ]; then
        if [ -d "$res" ]; then
            cmd="cd"
        else
            cmd="select"
        fi
        res="$(printf '%s' "$res" | sed 's/\\/\\\\/g;s/"/\\"/g')"
        lf -remote "send $id $cmd \"$res\""
    fi
}}

$mkdir -p ~/.trash
cmd trash %set -f; mv -t ~/.trash -- $fx

map . set hidden!
map p paste
map x cut
map y copy
map l open
map f :fzf_jump_current
map <c-f> :fzf_jump_home
map <backspace2> trash
map <enter> shell

map m
map H cd ~/
