You are not logged in.

#1626 2013-02-23 21:59:43

archman-cro
Member
From: Croatia
Registered: 2010-04-04
Posts: 943
Website

Re: Ranger, a textbased filemanager

loop wrote:

@bslackr, the same for me.
Here is my python script to replace rifle_sxiv.sh. Obviously, you should edit the last line to make yourself comfortable.

#!/usr/bin/env python3

from os  import listdir
from os  import path
from sys import argv
from subprocess import Popen

filename   = argv[1]
extensions = {'.jpg', '.jpeg', '.png', '.gif', '.tif'}
images  = []

basename = path.basename(filename)
dirname  = path.dirname(filename)

for item in listdir(dirname):
    extension = path.splitext(item)[1]
    if extension.lower() in extensions:
        images.append(item)

images.sort(key=str.lower)
position  = str(images.index(basename) + 1)
images = [path.join(dirname, filename) for filename in images]
Popen(['sxiv', '-Fqdg', '+0+12', '-n', position] + images)

Thank you for this script. Needed this in rifle.conf for it to work:

mime ^image, has sxiv,   X, flag f = /path/to/rifle_sxiv.py "`realpath -- "$@"`"

Last edited by archman-cro (2013-02-23 22:22:45)

Offline

#1627 2013-02-24 06:46:44

loop
Member
Registered: 2011-05-06
Posts: 58

Re: Ranger, a textbased filemanager

@hut, my congratulations on the ranger 1.6 release! I can hardly imagine my routine without this eye candy, so thank you very much! smile
@archman-cro, glad you liked it. Of course, this is some kind of 'temporary solutions' untill sxiv gets more integration with ranger's sortings and filters (I hope so).

Maybe some zsh-lovers are missing their hashes (short aliases to often used directories), so they can add this modified version of default ':cd' command  to commands.py:

class cd_zsh(cd):
    def execute(self):
        if self.arg(1) == '-r':
            import os.path
            self.shift()
            destination = os.path.realpath(self.rest(1))
            if os.path.isfile(destination):
                destination = os.path.dirname(destination)
        else:
            # do not interpret destination that starts with '/'
            if self.rest(1).startswith('/'):
                destination = self.rest(1)
            else:
                from subprocess import check_output, CalledProcessError, STDOUT
                try:
                    destination = check_output(['print ~{}'.format(self.rest(1).lstrip('~'))],
                            shell=True,executable='/usr/bin/zsh',stderr=STDOUT).decode().strip()
                except CalledProcessError:
                    # to walk into subdirs
                    destination = self.rest(1)

        if not destination:
            destination = '~'

        if destination == '-':
            self.fm.enter_bookmark('`')
        else:
            self.fm.cd(destination)

Now, if you have hash 'work', just run command ':cd_zsh work' (even without tilde symbol) to get the destination. Please, keep in mind that current realisation of the command evaluates hashes before subdirectories, so if you have subdirectory 'work', the hash destination will take the priority.

Offline

#1628 2013-02-25 09:54:17

TheLemonMan
Member
From: Italy
Registered: 2011-09-04
Posts: 214
Website

Re: Ranger, a textbased filemanager

Since the latest update Ranger keeps opening text files using nano, no matter what $EDITOR is or what apps.py/rifle.sh set. Is this a known issue ?

Offline

#1629 2013-02-25 10:50:31

tweed
Member
Registered: 2011-03-18
Posts: 21

Re: Ranger, a textbased filemanager

Gotta ask. sorry.

is RANGER 1.6.x just as compatible with freeBSD as 1.5.5 is?
Happily running the FreeBSD port. Love to know as 1.6.x is awesome.

Any issues expected?
many thanks.

Last edited by tweed (2013-02-25 10:50:57)

Offline

#1630 2013-02-25 11:53:09

loop
Member
Registered: 2011-05-06
Posts: 58

Re: Ranger, a textbased filemanager

Hello!
Does new cool :scout command enterpret '^' and '$' even without -r flag?

1. Create two files: 'hello', 'hello^hello'.
2. Do ':scout -aet ^hello' (no action, but I expected the 'hello^hello' file to be opened).
3. Do ':scout -aet ^hello$' (have file 'hello' opened).

Last edited by loop (2013-02-25 11:53:27)

Offline

#1631 2013-02-25 22:16:21

hut
Member
From: Hanover, Germany
Registered: 2010-03-12
Posts: 561
Website

Re: Ranger, a textbased filemanager

loop wrote:

Hello!
Does new cool :scout command enterpret '^' and '$' even without -r flag?

1. Create two files: 'hello', 'hello^hello'.
2. Do ':scout -aet ^hello' (no action, but I expected the 'hello^hello' file to be opened).
3. Do ':scout -aet ^hello$' (have file 'hello' opened).

Yes, that's a feature smile.

tweed wrote:

Gotta ask. sorry.

is RANGER 1.6.x just as compatible with freeBSD as 1.5.5 is?
Happily running the FreeBSD port. Love to know as 1.6.x is awesome.

Any issues expected?
many thanks.

ranger 1.6 is even more compatible with fbsd than 1.5. The hidden dependencies to "bash", "setsid" and GNU cp/mv have been removed. BTW there is a mailing list where you can ask questions about FBSD without feeling out of place smile

TheLemonMan wrote:

Since the latest update Ranger keeps opening text files using nano, no matter what $EDITOR is or what apps.py/rifle.sh set. Is this a known issue ?

Works for me. Either your configs are bad, out of date or you don't set $EDITOR properly.

Last edited by hut (2013-02-25 22:17:06)


"hut_" or "h00th00t" in irc.freenode.net #archlinux
Ranger Mailing List: https://lists.nongnu.org/mailman/listinfo/ranger-users

Offline

#1632 2013-02-26 00:40:04

dag
Member
From: US
Registered: 2013-01-20
Posts: 216

Re: Ranger, a textbased filemanager

Since the latest update Ranger keeps opening text files using nano, no matter what $EDITOR is or what apps.py/rifle.sh set. Is this a known issue ?

i noticed this too, also when I uninstaled it vim would not run by default it would ask run with...  here is what worked for me in /etc/bash.bashrc

export visual=vim
export editor=vim

--------------------------------------
alcoves wonder creates the wonder unto the ages; never lose that.

Offline

#1633 2013-02-26 04:51:30

loop
Member
Registered: 2011-05-06
Posts: 58

Re: Ranger, a textbased filemanager

hut wrote:

Yes, that's a feature smile.

OK, then. smile

dag wrote:
export editor=vim

Try to change it like this:

export EDITOR=vim

And then before launch ranger, try to test the terminal with the command 'echo $EDITOR'.

Offline

#1634 2013-02-26 06:59:17

dag
Member
From: US
Registered: 2013-01-20
Posts: 216

Re: Ranger, a textbased filemanager

it seems fine to me comes back as vim. I dont think it is case sensitive.

:edit:~>  this is what worked for me,and thus not an issue(for me).

Last edited by dag (2013-02-26 07:04:35)


--------------------------------------
alcoves wonder creates the wonder unto the ages; never lose that.

Offline

#1635 2013-02-26 07:47:03

bashnev
Member
Registered: 2012-06-11
Posts: 19

Re: Ranger, a textbased filemanager

TheLemonMan wrote:

Since the latest update Ranger keeps opening text files using nano, no matter what $EDITOR is or what apps.py/rifle.sh set. Is this a known issue ?

I have the same problem if I use my keyboard shortcut to run ranger. I've tried both

 xfce4-terminal -e ranger 

and

 xterm -bg black -fg white -e ranger 

If, however, I simply fire up a terminal and then run ranger from the prompt everything works as expected.

Offline

#1636 2013-02-26 09:17:40

PotatoesMaster
Member
From: France
Registered: 2010-08-26
Posts: 54

Re: Ranger, a textbased filemanager

bashnev wrote:

If, however, I simply fire up a terminal and then run ranger from the prompt everything works as expected.

From your statements, I presume you have a line

export EDITOR=placeholder

in your ~/.bashrc.

Then this file is not sourced when you run ranger with your shortcuts (this is normal behaviour).

You have plenty of possible solutions to remedy this. You can:

  • Move the lines export … in a file sourced ahead of where you run your programs (~/.xinitrc or some DE specific files).

  • Store the environment variables system-wide, by displacing the same lines in /etc/environment (keeping only the part EDITOR=foo). Some may find this ugly (personally I don't care).

  • Specify the environment variable in your shortcut

    EDITOR=foo xfce4-terminal -e ranger # if the command is interpreted by a shell
    sh -c 'EDITOR=foo xfce4-terminal -e ranger' # if it is not
  • Force the shell rc file to be sourced (generally by adding -i to the options passed on shell invocation)

    bash -ic 'xfce4-terminal -e ranger'

Offline

#1637 2013-02-26 20:54:36

bashnev
Member
Registered: 2012-06-11
Posts: 19

Re: Ranger, a textbased filemanager

I knew the issue was .bashrc not being sourced but I didn't know how to fix it, so thank you PotatoesMaster. Ranger now works as expected from the keyboard shortcut. Curiously everything worked before the upgrade to version 1.6.

Offline

#1638 2013-02-26 21:19:17

ibrunton
Member
From: Canada
Registered: 2011-05-05
Posts: 270

Re: Ranger, a textbased filemanager

With the latest update, suddenly images open differently.  First with the wrong program, then opening only one instead of being able to scroll through the directory (in feh or sxiv).  Obviously something changed.  What do I need to change in my config to get the old behaviour back?

Offline

#1639 2013-02-26 23:33:43

hut
Member
From: Hanover, Germany
Registered: 2010-03-12
Posts: 561
Website

Re: Ranger, a textbased filemanager

ibrunton wrote:

With the latest update, suddenly images open differently.  First with the wrong program, then opening only one instead of being able to scroll through the directory (in feh or sxiv).  Obviously something changed.  What do I need to change in my config to get the old behaviour back?

http://lists.nongnu.org/archive/html/ra … 00077.html


"hut_" or "h00th00t" in irc.freenode.net #archlinux
Ranger Mailing List: https://lists.nongnu.org/mailman/listinfo/ranger-users

Offline

#1640 2013-02-27 21:10:05

ibrunton
Member
From: Canada
Registered: 2011-05-05
Posts: 270

Re: Ranger, a textbased filemanager

hut wrote:
ibrunton wrote:

With the latest update, suddenly images open differently.  First with the wrong program, then opening only one instead of being able to scroll through the directory (in feh or sxiv).  Obviously something changed.  What do I need to change in my config to get the old behaviour back?

http://lists.nongnu.org/archive/html/ra … 00077.html

Any idea how I'd rewrite that for feh instead of sxiv?  Or is there a simpler method for feh?

EDIT: Never mind, I figured it out.  The rewrite was simpler than I thought.

Last edited by ibrunton (2013-02-27 21:17:42)

Offline

#1641 2013-02-28 18:32:21

ryzion
Member
Registered: 2012-03-20
Posts: 89

Re: Ranger, a textbased filemanager

How can you filter case insensitive? huts solution from #1236 crashes ranger now. (AttributeError: '_sre.SRE_Pattern' object has no attribute 'lower')

Offline

#1642 2013-02-28 19:20:59

loop
Member
Registered: 2011-05-06
Posts: 58

Re: Ranger, a textbased filemanager

ryzion wrote:

How can you filter case insensitive? huts solution from #1236 crashes ranger now. (AttributeError: '_sre.SRE_Pattern' object has no attribute 'lower')

With the very new ranger-git you can use :scout command which has many useful flags (case switchers are included):

    """:scout [-FLAGS] <string>

    Swiss army knife command for searching, traveling and filtering files.
    """
    AUTO_OPEN       = 'a'
    OPEN_ON_ENTER   = 'e'
    FILTER          = 'f'
    SM_GLOB         = 'g'
    IGNORE_CASE     = 'i'
    KEEP_OPEN       = 'k'
    SM_LETTERSKIP   = 'l'
    MARK            = 'm'
    UNMARK          = 'M'
    PERM_FILTER     = 'p'
    SM_REGEX        = 'r'
    SMART_CASE      = 's'
    AS_YOU_TYPE     = 't'
    INVERT          = 'v'

Offline

#1643 2013-03-01 09:25:06

hut
Member
From: Hanover, Germany
Registered: 2010-03-12
Posts: 561
Website

Re: Ranger, a textbased filemanager

ryzion wrote:

How can you filter case insensitive? huts solution from #1236 crashes ranger now. (AttributeError: '_sre.SRE_Pattern' object has no attribute 'lower')

In ranger-git, you can use ":filter -i" for case-insensitive filtering.

EDIT: By the way, many questions that are asked here are already answered in the FAQ on the website http://ranger.nongnu.org/documentation.html and on the mailing list: https://lists.nongnu.org/mailman/listinfo/ranger-users

So please, before asking, take a look at the FAQ and try searching for it in the mailing list archive first.


ALSO: Read the FAQ when ranger crashes after upgrading!!1

Last edited by hut (2013-03-01 18:24:46)


"hut_" or "h00th00t" in irc.freenode.net #archlinux
Ranger Mailing List: https://lists.nongnu.org/mailman/listinfo/ranger-users

Offline

#1644 2013-03-02 14:36:44

jk121960
Member
Registered: 2011-12-09
Posts: 254

Re: Ranger, a textbased filemanager

Hut, Hi I needed to find out if you can use hex values somehow with the ranger theme?

thanks

--jerry


Arch Awesome, Ranger & Vim the coding triple threat.

Offline

#1645 2013-03-03 13:03:19

hut
Member
From: Hanover, Germany
Registered: 2010-03-12
Posts: 561
Website

Re: Ranger, a textbased filemanager

Nope smile Just the numbers that this script prints.


"hut_" or "h00th00t" in irc.freenode.net #archlinux
Ranger Mailing List: https://lists.nongnu.org/mailman/listinfo/ranger-users

Offline

#1646 2013-03-03 15:03:44

jk121960
Member
Registered: 2011-12-09
Posts: 254

Re: Ranger, a textbased filemanager

Ok got it thanks again

--jerry


Arch Awesome, Ranger & Vim the coding triple threat.

Offline

#1647 2013-03-03 20:50:47

Army
Member
Registered: 2007-12-07
Posts: 1,784

Re: Ranger, a textbased filemanager

Hi hut, I have a problem with ranger-git. Just checked out the latest git, it's still there:

When I select a directory with :find $dirname and ranger cd's into this directory automatically, because it's the only entry with this name, I cannot get to the newest entry in this directory typing n, nothing happens. Everything's fine if I scroll to the directory and enter it manually.

Last edited by Army (2013-03-03 20:51:49)

Offline

#1648 2013-03-03 21:10:27

hut
Member
From: Hanover, Germany
Registered: 2010-03-12
Posts: 561
Website

Re: Ranger, a textbased filemanager

Army wrote:

Hi hut, I have a problem with ranger-git. Just checked out the latest git, it's still there:

When I select a directory with :find $dirname and ranger cd's into this directory automatically, because it's the only entry with this name, I cannot get to the newest entry in this directory typing n, nothing happens. Everything's fine if I scroll to the directory and enter it manually.

What the "n" key does depends on the last searching task you did. If you used ":search" or ":search_inc" or ":find" (since recently), it will find the next file that matches the pattern. If you pressed "cc", it will find the newest file. If you pressed "cs" it will find the largest file, and so on.

So just press "cc" to get back into the "find newest file" mode.


"hut_" or "h00th00t" in irc.freenode.net #archlinux
Ranger Mailing List: https://lists.nongnu.org/mailman/listinfo/ranger-users

Offline

#1649 2013-03-03 23:45:39

Army
Member
Registered: 2007-12-07
Posts: 1,784

Re: Ranger, a textbased filemanager

Ok, thanks! Seems like I have to learn ranger again wink

Offline

#1650 2013-03-08 01:48:16

shuuichi_nitori
Member
Registered: 2012-12-30
Posts: 37

Re: Ranger, a textbased filemanager

@hut @archman-cro Thank you very much, now sxiv is working flawlessly!


Archlinux + AwesomeWM

Offline

Board footer

Powered by FluxBB