3

ranger

~/.config/ranger/rifle.conf

For simplicity

What one line – in the rifle configuration file – could cause open(1) to be used for all types of file?

Background

https://forums.pcbsd.org/thread-20080-post-111030.html#pid111030 under Miller columns in file system explorers/browsers.

PC-BSD Forums is, admittedly, not the best place for a question that overlaps with use, on OS X, of a command that first appeared in NextStep ;-) but this is – essentially – a plea for advice about a simple configuration for rifle.

My bookmarks about ranger include the following, one of which may include (or hint at) an answer but honestly, I'm half-lost. A pointer in the right direction might be all that's needed …

OS X context

In edge cases (such as mine), for some areas of file systems, the operating system may be more responsive with ranger than with Finder. I have yet to ascertain whether a preference for ranger will reduce the need to use com.apple.IconServices …


Presence of the file

In retrospect, after gaining an answer to this question, I realised that I had been overly cautious. In my history of commands –

gpes3e-gjp4:~ gjp22$ history | grep ranger\ --copy
  158  ranger --copy-config=commands
  169  ranger --copy-config=scope

– but not ranger --copy-config=all

I set aside ~/.config/ranger and then ran that command to gain the default configuration file. Then added the overriding line that's given in https://unix.stackexchange.com/a/223804/13260 below.

Still: the contents of the default file are foreign territory to me. With or without the lines and comments in that file, the 'one line' essence of this question would have arisen.

2 Answers 2

3

Neither of the commands in the first answer had the desired effect but based on those, I experimented with the following:

has open, flag f = open "$@"

Now, a rifle.conf file comprising just that one line does seem to be effective. If I understand correctly, the one and only condition, satisfied, is that open is installed (i.e. located in $PATH).

Google search results for rifle.conf "has open" drew attention to https://github.com/rafi/.config/blob/master/ranger/rifle.conf

ranger rifle open for osx, setting pass store dir


Following the first comment below I simplified the rifle.conf file to comprise:

flag f = open "$@"

That, too, seems to have the desired effect.

1
  • I don't know how open reacts to the flag f setting. It looks like from this example config that the has open setting is not required, so maybe something simpler like flag f = open -- "$@" or flag t = open -- "$@" Commented Aug 18, 2015 at 19:56
0
+50

What have you tried so far?

According to one of the ref links you posted, the line:

has open, flag f = open -a "$1"

or

has open, flag f = "open -a" "$1"

would be where I would start. I'm unable to test, not having access to OS X.

3
  • Thanks, which one of the links? Commented Aug 17, 2015 at 20:48
  • 1
    The Ubuntu man page link. Commented Aug 18, 2015 at 19:43
  • 1
    OK. I edited the question to explain that I had not run ranger --copy-config=all. Now, I see where you got the has … parts. Whilst neither of the lines in this answer were effective, you do win the bounty – for the attention, and for direction when I was "half-lost". Both lines were enough to get me thinking better. Thanks again. (Side note: that Ubuntu man page link file://~/.config/ranger/rifle.conf is not effective on OS X here.) Commented Aug 20, 2015 at 4:50

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .