-
Notifications
You must be signed in to change notification settings - Fork 328
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
Rename To Preserve Extension #279
Comments
very ugly solution (map it to A or whatever you like) cmd renameappend ${{ |
My solution:
|
I agree that keeping the extension is the most common when renaming. Should we make this the default behavior? Should there be an option to toggle it? Would be nice to not have to use custom commands. |
@Limero I think it should be the default. If you wanna change the entire name you would |
I think there gotta be at least 4 default naming function: One for renaming it entirely (like just let me change its name to this new value), one for appending (at the very end of the file/directory), one for inserting (at the very beginning of the file/directory), one for appending before the extension of the file (default behavior for directories should be same as appending IMHO). Here is my lfrc for those (yes, I use hard tabs and I don't care what you think):
|
Thank you all for the feedback. For the record, this is why I try not to include commands as builtin because everyone has some slightly different favorite and expects it to be the default. The current default seems to be the simpler one rather than the common one. You should be able to define other versions of rename commands using either
Or by using command line commands:
Examples in the wiki page dates back to times we did not have a builtin rename command. Perhaps it is time to remove those examples in favor of these. |
I really think sane, great defaults are better than having two commands for renaming. EDIT: you might as well throw bulk renaming when multiple files are selected in there. and have these defaults in In this case, someone is going to realize some command could be better written, and we're all going to benefit. It feels like |
After tweaking a bit, I realized that I can shorten it to this:
|
Hey all :) I'm the one who wrote that section at the wiki and I've just stumbled upon this discussion. Just wanted to let you know I've edited that wiki section with a link to this issue and I've made the commands handle filenames with quotes and possibly other characters better, using a You might also be interested in #306 . |
Okay, this is last, I promise. :) I realized that "before extension" keybinding has one bug. Right now, it goes to the very end of filename thanks to default This goes right before the This first goes to the very end of filename, and goes one word back (right after the Thanks to @doronbehar to help me realize it. :) Anyways, have a nice day. :) |
Answering your comment #306 (comment) which to my view relates to the discussion here more then there.
Totally agree with you, but replacing |
I think the best argument in favor of this is that it is easier to define the other behaviors when the default is keeping the extension since there could be files with no extension or multiple extensions. If anyone wants to implement this, I'm now willing to accept a PR. The function filepath.Ext can be used for this purpose which seems to have a proper extension definition. |
I think this is a better solution map A rename # at the very end I got this from lukesmith's voidrice config |
I have updated the tips to reflect the new behavior of the |
What is the new behavior you are talking about exactly? Speaking of the wiki, that wiki section is very unclear TBH :). I think the previous version was better - It's not clear what is the purpose of showing that table - keybindings after / before applying your config? Also, what happened to the Link to wiki diff: https://github.com/gokcehan/lf/wiki/Tips/_compare/8311fe2f2d0fef74cbd1baf858dbac44d0f4c865...12982d7d605d108e2bdd1a2fa35037f890fad631 |
I agree that the descriptions by themselves can be vague, I have added another column to the table to visually show the effects of each mapping. Thanks for the feedback.
I fail to see how. Positioning the cursor can be implemented entirely using native
After. That is rather obvious when comparing the table with the mappings below.
As I have explained above, |
Thanks for the link to the PR, I missed that. The table indeed looks better now. I still felt that the phrasings around the table and the config example was a bit confusing, so I expanded that a bit. |
OK, thanks for tidying the example up. I think it looks even better now that the mapping table comes after the config. @gokcehan Unless I'm missing something I believe this ticket can actually be closed now, since preserving the extension is now the default behavior. |
rename: README.md│
should instead berename: README│.md
as keeping the extension is a more common use case.The recommended way in the wiki removes the extension (and leaves the dot) and forces you to have multiple keybindings for files, files without extensions and directories.
The text was updated successfully, but these errors were encountered: