Closed fritzrehde closed 2 years ago
I feel like this is quite an easy thing to implement. If no one who is more experienced with this code base wants to/has time to do it, I could give it a try. Would you consider this issue beginner friendly? I've never really contributed to a project before, but have some experience with Rust.
I think this is one of the easier features and yes, I think it's beginner-friendly. Just take the existing rename-commands as a starting point. :)
@fritzrehde I'm a bit confused on what you're asking for?
rename_append
will place the cursor after the filename but before the extension so you can immediately start editing the filename and not the extension? (Same behaviour as ranger)
Are you talking about only editing the extension?
I am talking about only deleting the filename, leaving only the extension and placing the cursor before the extension. I want to use this instead of the normal rename
command, as I usually want to keep the file extension but rename the filename.
Also, I didn't even realize this until now, folders/directories cannot currently be renamed. I feel like this should definitely be an option too (all the rename commands should work with directories as well).
So, it's basically like rename_append
, but with additionally deleting the first part of the filename in the input field. The new command could also be just a parameter for the existing one.
But @fritzrehde, Joshuto can rename dirs. Both, with the rename-x
commands and with bulk_rename
. Maybe I didn't get your point.... What exactly does not work when renaming dirs?
Yes, that's how I envision rename_keep_ext
. I'm trying to implement it right now as a seperate command, but a parameter (do you mean something like :rename --keep-ext
?) could work too.
Yes, sorry about thinking the rename command only works on files. I was confused by the documentation once again, since "file" is only ever mentionned instead of "directory" or "node" or something more broad.
I was confused by the documentation once again, since "file" is only ever mentionned instead of "directory" or "node" or something more broad.
A directory is just a file with a list of entries as its contents :)
Yes, that's how I envision rename_keep_ext. I'm trying to implement it right now as a seperate command, but a parameter (do you mean something like :rename --keep-ext?) could work too.
Yeah either of these solutions work for me :+1:
Leaning more towards rename_keep_ext
because its easier to use for the user.
Yup, it was very easy to implement. I also agree with the name rename_keep_ext
. I'll do a pull request soon.
One thing I'm not sure about is the behaviour on hidden files. Given how I explained rename_keep_ext
should work, the command should work just like rename_prepend
on e.g. .testfile
, since it just removes whatever is before the extension. However, this is not very useful. In the case of hidden files, I would want rename_keep_ext
to behave just like :rename
. But I am afraid this is confusing and contradictory (although it is how I would prefer to use it as a user). What are your thoughts?
One thing I'm not sure about is the behaviour on hidden files. Given how I explained
rename_keep_ext
should work, the command should work just likerename_prepend
on e.g..testfile
, since it just removes whatever is before the extension. However, this is not very useful. In the case of hidden files, I would wantrename_keep_ext
to behave just like:rename
. But I am afraid this is confusing and contradictory (although it is how I would prefer to use it as a user). What are your thoughts?
I think its fine to keep the behaviour of rename_keep_ext
the same as rename_prepend
when dealing with hidden files. Makes it more consistent even if its arguably less useful
Like I said, this is my first pull request, so I am open to any feedback!
Is there a reason my pull request isn't being merged (or denied if there is a problem)? I think a contributor has to allow for the tests to run because I am a first time contributor.
Sorry, I've just been busy with work and stuff. Will take a look soon!
No worries, take as much time as you need!
I have found the
rename
,rename_append
andrename_prepend
commands. However, I usually only want to change the filename and not the extension. Could an option (maybe calledrename_keep_ext
) be added that deletes the filename, keeps the extension, and puts the cursor to the beginning of the line?