Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement 'mkdir' command #887

Closed
ghost opened this issue Jul 29, 2022 · 7 comments · Fixed by #1188
Closed

Implement 'mkdir' command #887

ghost opened this issue Jul 29, 2022 · 7 comments · Fixed by #1188

Comments

@ghost
Copy link

ghost commented Jul 29, 2022

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.

@ivan-volnov
Copy link

How about

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

in the config?

@lahwaacz
Copy link

lahwaacz commented Aug 6, 2022

@Limero
Copy link
Contributor

Limero commented Aug 6, 2022

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.

@ghost
Copy link
Author

ghost commented Aug 8, 2022

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
Copy link
Author

ghost commented Aug 8, 2022

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.

@zSnails
Copy link

zSnails commented Mar 27, 2023

Hey! I decided to implement this, here's the pull request if you're interested in reading it: #1179

@Limero
Copy link
Contributor

Limero commented Apr 3, 2023

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
4 participants