Add !@B! modifier to collect marked files from both panels into a sin…#3297
Add !@B! modifier to collect marked files from both panels into a sin…#3297YuryChaikou-ServiceNow wants to merge 2 commits intoelfmz:masterfrom
Conversation
…gle list file
The B modifier for !@...! and !$...! substitutions creates a temp file
containing marked (selected) files from both the active and passive panels.
When B is present, the command is executed once for all selected files
rather than once per file.
Can be combined with existing modifiers: F (full paths), Q (quote spaces),
U (UTF-8 BOM), W (UTF-16LE), A (ANSI).
Example usage in user menu (F2):
Compare two marked files with Beyond Compare:
open -a 'Beyond Compare' "$(sed -n '1p' "!@bf!")" "$(sed -n '2p' "!@bf!")"
or with diff:
diff "$(sed -n '1p' "!@bf!")" "$(sed -n '2p' "!@bf!")"
Mark one file on the left panel and one on the right panel (with Insert),
then run the command to compare them.
|
@YuryChaikou-ServiceNow Your example is not very useful: there is existing functionality to refer to selected file on passive panel (even the selection is not visible) using "!#" symbols. I'm using that to compare files in Far3 and far2l. I suspect it maybe overwritten in some cases with your changes. Here is working code from Far3 I have right now: |
|
Thank you for the feedback! You're right that
Regarding the temp file, I agree it's somewhat heavy for the common two-file case. An alternative could be to expand selected filenames inline (space-separated), but that would break with filenames containing spaces and would diverge from how The existing That said, if you have a different approach in mind (e.g. inline expansion for small selections, or a different modifier syntax), I'm happy to review and implement it. |
That's right and should be fixed one day.
I use Otherwise quite useful feature, I think. As for temp file then it should be a separate task, too many changes are already. Let me test this. |
|
|
|
FYI for this and other PRs: I work on a MacBook running macOS 26.3, so additional testing on Linux may be needed. |
|
BTW I don't see that you updated help files for this change. Then it may be a lot of corner cases with !@b! modifier. Some operations maybe possible (like get the sizes). But, for example, there is multiple files selection on both panels and I started command to copy those files with !@b! modifier. What happens in this case? |
|
Copy all files to one folder Zip all files, preserve folder structure
Example ( |
Add B modifier documentation to the MetaSymbols section in English, Russian, Hungarian, and Ukrainian help files. Also adds missing U and W modifiers to the Hungarian help file.
…gle list file
The B modifier for
!@...!and!$...!substitutions creates a temp file containing marked (selected) files from both the active and passive panels. When B is present, the command is executed once for all selected files rather than once per file.Can be combined with existing modifiers: F (full paths), Q (quote spaces), U (UTF-8 BOM), W (UTF-16LE), A (ANSI).
Example usage in user menu (F2):
Compare two marked files with Beyond Compare:
open -a 'Beyond Compare' "$(sed -n '1p' "!@BF!")" "$(sed -n '2p' "!@BF!")"or with diff:
diff "$(sed -n '1p' "!@BF!")" "$(sed -n '2p' "!@BF!")"Mark one file on the left panel and one on the right panel (with Insert), then run the command to compare them.