[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Ranger-users] Bulk-anything command
From: |
hut |
Subject: |
Re: [Ranger-users] Bulk-anything command |
Date: |
Thu, 22 Jun 2017 18:34:21 +0200 |
User-agent: |
Mutt/1.7.2 (2016-11-26) |
On Thu, Jun 22, 2017 at 11:34:02AM -0400, John Z. wrote:
> Additionally, I'm glad to have an opportunity to ask a question
> regarding %%s: I assume first % escapes the second one? How does this
> work, then?
>
> The reason I ask is because just yesterday, I wanted to yank current
> directory, and I noticed that when I press 'y', a little menu offers 'd'
> which seems to put %d into X selection, using xsel.
>
> However, when I pasted the contents, I got out literal '%s', instead of
> directory, so I asssumed %%s was a typo, but now I see it being used.
>
> Can you explain to me, please, what's the thing with it?
Hi,
In general, when you run a command which takes another command as an
argument, like ":map" or ":console", you have to be aware about the time
when the macros are expanded. If you run:
:map x shell echo %f
Then x will be bound to "shell echo <the_file_thats_selected_right_now>".
To delay macro expansion until the time the command is executed, you
need to escape the % like:
:map x shell echo %%f
Now x is bound to "shell echo %f" and %f will be expanded at the time
when you press x.
But about your specific problem: I believe there was a bug with macro
escaping in the "yp" key binding and similar ones in the past. It
should be fixed if you upgrade ranger and migrate/delete your
configuration according to https://github.com/ranger/ranger/wiki/Upgrading .
Regards,
hut
Re: [Ranger-users] Bulk-anything command, Ingo Lindholm, 2017/06/22
Re: [Ranger-users] Bulk-anything command, John Z., 2017/06/26