lf icon indicating copy to clipboard operation
lf copied to clipboard

Implement 'mkdir' command

Open SenseiSchizo opened this issue 3 years ago • 5 comments

Ranger has a 'mkdir' command which simply makes a directory with a given name in the current directory, I use this a ton, And would love to have this implemented in lf.

SenseiSchizo avatar Jul 29 '22 03:07 SenseiSchizo

How about

cmd mkdir %{{
    printf "Make directory: "
    read ans
    mkdir $ans
}}
map md mkdir

in the config?

ivan-volnov avatar Aug 05 '22 17:08 ivan-volnov

See also https://github.com/gokcehan/lf/wiki/Tips#commandmapping-to-create-new-directories

lahwaacz avatar Aug 06 '22 06:08 lahwaacz

I agree that we should have a native mkdir command in lf and probably also a touch command. Not expect the user to set it manually in their config, so whenever someone installs lf, those commands will always be available everywhere, like in ranger.

Limero avatar Aug 06 '22 12:08 Limero

Agreed.

How about

cmd mkdir %{{
    printf "Make directory: "
    read ans
    mkdir $ans
}}
map md mkdir

in the config?

This works, but doesn't work the same way as in ranger (Taking the dir name as an argument instead of prompting for it) and is a temporary solution at best.

ghost avatar Aug 08 '22 03:08 ghost

See also https://github.com/gokcehan/lf/wiki/Tips#commandmapping-to-create-new-directories

The solution here works properly, Would be nice to see it implemented either by default, or as a built in command.

ghost avatar Aug 08 '22 03:08 ghost

Hey! I decided to implement this, here's the pull request if you're interested in reading it: https://github.com/gokcehan/lf/pull/1179

zSnails avatar Mar 27 '23 22:03 zSnails

If the stance on this is to just rely on the shell for these commands, how about adding default shell commands?

So a new user who is used to ranger can download lf and right away commands like :mkdir and :touch are available, but instead of a native Go command, they use the shell. I assume 99% of all lf users who has a mkdir command in their config use an identical implementation.

Limero avatar Apr 03 '23 16:04 Limero