Skip to content

Conversation

@MikuGeek
Copy link
Contributor

When handling numerous filenames, it's better to give indication to original filenames. I've added the original filenames below, separated by a divider, without changing the code related to renaming.

@sxyazi
Copy link
Owner

sxyazi commented Mar 19, 2025

This doesn't make sense. Not everyone wants the file names to appear twice, and you can already achieve this through custom bulk rename commands:

[[opener.bulk-rename]]
block = true
run = '''
  s="$(cat "$1")"
  echo "$s\n------\n$s" > "$1"
  nvim "$1"
  sed -i "" "$(wc -l <<< "$s")q" "$1"
'''

[[open.prepend_rules]]
name = "bulk-rename.txt"
use  = "bulk-rename"

However, I can accept removing the strict restriction that the new and old file lists must have the same length, and instead just read the first n lines.

This way, you wouldn't need the final sed -i to remove the separator from the end of the file, which could make implementing such customizations more convenient.

@MikuGeek MikuGeek force-pushed the enhance-bulk-rename branch from a117530 to 6a22f12 Compare March 24, 2025 12:09
@MikuGeek
Copy link
Contributor Author

Thanks for the reminder. I apologize for not fully reading the documentation. I've modified the bulk rename logic; it truncates when the number of new filenames exceeds the number of old filenames, but the rest of the logic remains the same.

@sxyazi sxyazi changed the title feat: give indication to original filenames in bulk rename feat: allow bulk renaming to include trailing content in addition to the required new names Mar 24, 2025
Copy link
Owner

@sxyazi sxyazi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you!

@sxyazi sxyazi merged commit 31fccd4 into sxyazi:main Mar 24, 2025
6 checks passed
Lemi0002 pushed a commit to Lemi0002/yazi that referenced this pull request Apr 10, 2025
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Apr 24, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants