[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Ranger-users] passing / testing macros to shell
From: |
Diederich Hessling |
Subject: |
Re: [Ranger-users] passing / testing macros to shell |
Date: |
Fri, 22 Jan 2016 06:31:17 +0100 |
On Thu, 21 Jan 2016 17:15:45 +0100
hut <address@hidden> wrote:
> On Thu, Jan 21, 2016 at 06:38:03AM +0100, Diederich Hessling wrote:
> > I mapped a key to something like 'map td shell echo "%c" >> list_of_stuff'
> > with some sed piping to give me line breaks and it works fine.
> > I would like that to work also when nothing is yanked/copied, and the shell
> > expression then should use "%f" instead.
or %f macro will be passed to the shell?
> There is the command "save_copy_buffer" which writes the copy buffer to
> ~/.config/ranger/copy_buffer, maybe that helps you.
Hi there and thanks for your reply.
I managed to improvise something similar, which does what I want (so far ;). I
grepped through the git page for macros, found actions.py and changed
"if self.fm.copy_buffer:
macros['c'] = [fl.path for fl in self.fm.copy_buffer]
else:
macros['c'] = MACRO_FAIL"
to
"if self.fm.copy_buffer:
macros['c'] = [fl.path for fl in self.fm.copy_buffer]
else:
macros['c'] = [self.fm.thisfile.relative_path]"
This works with a ranger that I've unzipped from a tar.gz and ran in from
inside that dir. Guess I'll change that globally on my system and I'm done ;).
But I'll also check out your suggestion, which would probably be cleaner and
better.
Cheers and thanks for your work!
Dieter
--
Diederich Hessling <address@hidden>