gokcehan / lf

Terminal file manager
MIT License
7.8k stars 330 forks source link

Downdir command? #1790

Closed tcftbl closed 3 months ago

tcftbl commented 3 months ago

Currently the command open changes to a directory if current file is a directory and opens the file otherwise. I was wondering if it might be a good idea to have separate downdir and open commands for navigating and opening files respectively.

I find myself frequently opening files by accident when navigating the filesystem which can be a bit annoying. I think it could make navigating much faster if you wouldn't have to worry about accidentally opening files with l key and using, for example Enter to open files.

This might be a bit tricky to make work without breaking the current behaviour though.

What do you think?

joelim-work commented 3 months ago

The open command was intentionally designed to open both files and directories for convenience. If you prefer to have separate commands, you can define them in your config file:

cmd downdir &{{
    if [ -d "$f" ]; then
        lf -remote "send $id open"
    fi
}}

cmd openfile &{{
    if ! [ -d "$f" ]; then
        lf -remote "send $id open"
    fi
}}

map l downdir
map <enter> openfile
tcftbl commented 3 months ago

Thank you for the response!