You are not logged in.

#951 2011-04-27 11:02:40

student975
Member
From: Russian Federation
Registered: 2011-03-05
Posts: 613

Re: Ranger, a textbased filemanager

Revelation60 wrote:

A VFS for archives would be fantastic. I have no idea how hard that is to implement.

Agree! Transparent archive navigation is very handy. But at some cases we need just to unpack an archive into a given destination (which will be much faster rather via vfs).

As for unpacking in a ranger-way I imagine something like additional copy/paste commands (yz/pz?). Password-protected archives must invoke console dialog (one by one) with password prompt. Something similar can be imagined wrt creating new archive (with prompt for new archive name and autodetection pack command on file extension base).

Last edited by student975 (2011-04-27 11:36:55)


"I exist" is the best myth I know..

Offline

#952 2011-04-27 12:27:33

Dieter@be
Forum Fellow
From: Belgium
Registered: 2006-11-05
Posts: 2,001
Website

Re: Ranger, a textbased filemanager

did you know you can open archives with vim? AFAICT that should be all you need.


< Daenyth> and he works prolifically
4 8 15 16 23 42

Offline

#953 2011-04-27 12:37:12

igndenok
Member
From: Sidoarjo, Indonesia
Registered: 2010-06-07
Posts: 160

Re: Ranger, a textbased filemanager

I got no problem with password-protected archives (except with certain rar version), and I didn't use atools for my archive preview because it's much slower than 7z.


Ask, and it shall be given you.
Seek, and ye shall find.
Knock, and it shall be opened unto you.

Offline

#954 2011-04-27 12:44:35

student975
Member
From: Russian Federation
Registered: 2011-03-05
Posts: 613

Re: Ranger, a textbased filemanager

igndenok wrote:

I got no problem with password-protected archives (except with certain rar version), and I didn't use atools for my archive preview because it's much slower than 7z.

For protected rar archives I have added

case "$extension" in
    # RAR extension (reports error for passworded archives):
    rar)
        unrar l -p- "$path" 2>&1 | head -n $maxln && exit 3
        exit 1;;

into the scope.sh script.

What is your scenario wrt unpacking archives (being they password-protected or not) inside ranger?

Last edited by student975 (2011-04-27 12:44:53)


"I exist" is the best myth I know..

Offline

#955 2011-04-27 13:24:49

igndenok
Member
From: Sidoarjo, Indonesia
Registered: 2010-06-07
Posts: 160

Re: Ranger, a textbased filemanager

Lately the password-protected rar I got using format like this (and I got no problem with it, a few days ago)

*.part1.rar
*.part2.rar
...

but not with format (IIRC) like this (I didn't have this type anymore because I already convert it to zip)

*.rar
*.r00
*.r01
...

and I replace default preview application (atool -l) with 7z (because I still need 7z)

7z l "$path" | head -n $maxln && exit 3
exit 1;;

Ask, and it shall be given you.
Seek, and ye shall find.
Knock, and it shall be opened unto you.

Offline

#956 2011-04-27 14:06:23

student975
Member
From: Russian Federation
Registered: 2011-03-05
Posts: 613

Re: Ranger, a textbased filemanager

@igndenok

The thing is, it is insignificant for me which multivolume rar format to use (I don't use rar as packer at all). But, say, respondents can sent a message with this ot that format, and it would be handy to deal with all of them.

As for previewing - at case a rar archive is password protected, all tools (7z, unrar, atool) prints prompt for password and waits for something to be typed in stdinput. At my case it results in ranger hang. So, take especial  attention to '-p-' option in 'unrar l -p- "$path" 2>&1 | head -n $maxln && exit 3'. This way ranger hangs problem is eliminated for me.


"I exist" is the best myth I know..

Offline

#957 2011-04-27 14:40:02

igndenok
Member
From: Sidoarjo, Indonesia
Registered: 2010-06-07
Posts: 160

Re: Ranger, a textbased filemanager

I didn't read unrar help, thanks for pointing that out. It seems that 7z can list directly password-protected rar without problem, assuming it was rar version 3. I think I'll use your method as fallback.


Ask, and it shall be given you.
Seek, and ye shall find.
Knock, and it shall be opened unto you.

Offline

#958 2011-04-27 14:48:33

Revolt
Member
From: Portugal
Registered: 2009-06-11
Posts: 71
Website

Re: Ranger, a textbased filemanager

student975 wrote:
Revelation60 wrote:

A VFS for archives would be fantastic. I have no idea how hard that is to implement.

Agree! Transparent archive navigation is very handy. But at some cases we need just to unpack an archive into a given destination (which will be much faster rather via vfs).

As for unpacking in a ranger-way I imagine something like additional copy/paste commands (yz/pz?). Password-protected archives must invoke console dialog (one by one) with password prompt. Something similar can be imagined wrt creating new archive (with prompt for new archive name and autodetection pack command on file extension base).

I made some commands for that and put them on the wiki a while back (doesn't work on password protected files though):
https://wiki.archlinux.org/index.php/Ra … ve_Related

You can then bind a key to the :extracthere and :compress commands (I use px and pc).

Last edited by Revolt (2011-04-27 14:49:42)

Offline

#959 2011-04-27 14:50:34

student975
Member
From: Russian Federation
Registered: 2011-03-05
Posts: 613

Re: Ranger, a textbased filemanager

igndenok wrote:

I didn't read unrar help, thanks for pointing that out. It seems that 7z can list directly password-protected rar without problem, assuming it was rar version 3. I think I'll use your method as fallback.

There are two type of password protecting - content only, and both content and header. At last case 7z (as well as any other listed tool) will wait for password from stdin.

Last edited by student975 (2011-04-27 14:51:29)


"I exist" is the best myth I know..

Offline

#960 2011-04-27 15:37:07

igndenok
Member
From: Sidoarjo, Indonesia
Registered: 2010-06-07
Posts: 160

Re: Ranger, a textbased filemanager

@hut: Using non-git version and use transmission-show for list files inside .torrent still have problem with

'utf8' codec can't decode byte...

for showing list of a filename that contain unicode char.
Using 2 different .torrent that contain unicode char in the filename, 1 error and the other success for preview.
I dump both content list into .txt file, and ranger show above problem for both .txt

$ file *.txt
22.txt: UTF-8 Unicode text
33.txt: UTF-8 Unicode English text

Where 22.txt from .torrent that ranger succes give preview, while 33.txt not


Ask, and it shall be given you.
Seek, and ye shall find.
Knock, and it shall be opened unto you.

Offline

#961 2011-04-27 16:26:52

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

Re: Ranger, a textbased filemanager

student975 wrote:

What is a common way to deal with archives? I mean we want to stay in text mode. And let's imagine simple case when an archive isn't password-protected. So, we have /very/long/and/deep/source/path/someArchiveNameWithSpaces.tar.bz2 and /even/more/deep/and/long/destination/path. How does ranger help here?

I'd probably use: 1lccdd <navigate to destination> pp

As for vfs, it's planned but in the meantime you can just open the archive in vim big_smile?

igndenok wrote:

@hut: Using non-git version and use transmission-show for list files inside .torrent still have problem with

'utf8' codec can't decode byte...

for showing list of a filename that contain unicode char.
Using 2 different .torrent that contain unicode char in the filename, 1 error and the other success for preview.
I dump both content list into .txt file, and ranger show above problem for both .txt

$ file *.txt
22.txt: UTF-8 Unicode text
33.txt: UTF-8 Unicode English text

Where 22.txt from .torrent that ranger succes give preview, while 33.txt not

It's likely fixed in ranger-git already, try it and report smile?
Also, can you share your lines in scope.sh?


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

Offline

#962 2011-04-27 17:00:46

igndenok
Member
From: Sidoarjo, Indonesia
Registered: 2010-06-07
Posts: 160

Re: Ranger, a textbased filemanager

hut wrote:

It's likely fixed in ranger-git already, try it and report smile?

I'll try again later.

hut wrote:

Also, can you share your lines in scope.sh?

Here my scope.sh

Edit: My new scope.sh, I got less problem with this new config.

Last edited by igndenok (2011-04-30 10:27:52)


Ask, and it shall be given you.
Seek, and ye shall find.
Knock, and it shall be opened unto you.

Offline

#963 2011-04-27 21:17:42

student975
Member
From: Russian Federation
Registered: 2011-03-05
Posts: 613

Re: Ranger, a textbased filemanager

Revolt wrote:

I made some commands for that and put them on the wiki a while back (doesn't work on password protected files though):
https://wiki.archlinux.org/index.php/Ra … ve_Related

You can then bind a key to the :extracthere and :compress commands (I use px and pc).

Thanks, I'll try to dig in.

hut wrote:

I'd probably use: 1lccdd <navigate to destination> pp

Thanks, it does work. I haven't used aunpack earlier and, as a result, didn't know aunpack will create a dedicated dir if needed.


"I exist" is the best myth I know..

Offline

#964 2011-04-28 01:36:50

igndenok
Member
From: Sidoarjo, Indonesia
Registered: 2010-06-07
Posts: 160

Re: Ranger, a textbased filemanager

@hut: Using ranger-git, got no problem with problem before. Except for file 22.txt preview only show partial.
End of my report, now waiting for stable release and kudos for patch from groundnuty big_smile.


Ask, and it shall be given you.
Seek, and ye shall find.
Knock, and it shall be opened unto you.

Offline

#965 2011-04-28 11:56:26

Google
Member
From: Mountain View, California
Registered: 2010-05-31
Posts: 484
Website

Re: Ranger, a textbased filemanager

Let me know if you find that leak or need me to test it more some how. It still does it-- both on my bfs patched kernel and vanilla kernel. I don't think the problem is on my configuration or anything.

Offline

#966 2011-04-28 19:06:20

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

Re: Ranger, a textbased filemanager

Here is a little function to move forward and backward by a word in console mode :

    # add it to ranger/gui/widgets/console.py
    def move_by_word(self, forward=True):
        if self.line:
            self.tab_deque = None
            if forward:
                i = self.pos + 1
                if i >= len(self.line):
                    return
                while i < len(self.line) and re.match(r'[\w\d]', self.line[i], re.U):
                    i += 1
            else:
                i = self.pos - 1
                if i <= 0:
                    return
                while i > 0 and re.match(r'[\w\d]', self.line[i-1], re.U):
                    i -= 1
            self.pos = i
            self.on_line_change()

I noticed that when <A-something> is mapped in console mode, pressing Escape doesn't quit this mode.

Offline

#967 2011-04-29 00:15:23

student975
Member
From: Russian Federation
Registered: 2011-03-05
Posts: 613

Re: Ranger, a textbased filemanager

Fiew tiny suggestions:

1. For current tab highlighting use inversed colors wrt others tabs (as for files/directories highlighted row).
2. Show seconds also in file's date-time - (status line, left bottom corner).
3. Show yy/dd state, say dd:5 which means five items (files and/or dirs) are dd-ed - (status line, right bottom corner)

What do you think?


"I exist" is the best myth I know..

Offline

#968 2011-05-01 19:39:56

Sirsurthur
Member
Registered: 2009-02-02
Posts: 124

Re: Ranger, a textbased filemanager

Hello Hut,

I got an utf-8 issue with ranger-git :

[julien@arch ~]$ ranger --debug
Ranger version: 1.4.3, executed with python 3.2
Locale: fr_FR.UTF8

Traceback (most recent call last):
  File "/usr/lib/python3.2/site-packages/ranger/core/main.py", line 85, in main
    fm.loop()
  File "/usr/lib/python3.2/site-packages/ranger/core/fm.py", line 191, in loop
    loader.work()
  File "/usr/lib/python3.2/site-packages/ranger/core/loader.py", line 250, in work
    self.fm.notify(err)
  File "/usr/lib/python3.2/site-packages/ranger/core/loader.py", line 245, in work
    next(item.load_generator)
  File "/usr/lib/python3.2/site-packages/ranger/core/loader.py", line 120, in generate
    self.signal_emit('after', process=process, loader=self)
  File "/usr/lib/python3.2/site-packages/ranger/ext/signals.py", line 110, in signal_emit
    fnc(signal)
  File "/usr/lib/python3.2/site-packages/ranger/core/actions.py", line 619, in on_after
    data[(-1, -1)] = open(path, 'r').read(1024 * 32)
  File "/usr/lib/python3.2/codecs.py", line 300, in decode
    (result, consumed) = self._buffer_decode(data, self.errors, final)
UnicodeDecodeError: 'utf8' codec can't decode byte 0xc9 in position 39: invalid continuation byte

Ranger crashed.

Let me know if you need some more inputs !

Last edited by Sirsurthur (2011-05-01 19:41:50)

Offline

#969 2011-05-03 20:04:55

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

Re: Ranger, a textbased filemanager

Hello.
I have two things to propose.

Make the hints more verbose (I hardly remember some shortcuts I rarely use smile)
But I know some lines are too longs (like those for goto and options) hmm

for y<bg>:
copy: copy add remove path_to_xsel dirpath_to_xsel basename_to_xsel

for d<bg>:
disk_usage cut: d:cut add remove
instead of
du (disk usage) dd (cut)

for p<bg>:
paste: paste overwrite symlinks relative_symLinks
instead of
press p to confirm pasting, overwrite, create symlinks, relative symLinks

for z<bg>:
filter options: directories_first collape_preview sort_case_insensitive show_hidden preview_files Preview_dirs use_preview_script flushinput mouse
instead of
[cdfhimpPsv] show_hidden preview_files Preview_dirs filter flushinput mouse

for o<bg>:
sort by: size basename mtime type reverse natural
instead of
size basename mtime type reverse natural

for g<bg>:
goto: / dev etc h:~ media Mnt opt srv usr var Ranger link: l:target_path reaL_path tab: close new next T:prev

for c<bg>:
w:rename chdir search order: ctime mimetype size tag
instead of
ctime mimetype size tag  w:rename

when displaying the taskview (w):
tasks: dd:remove J:move_down H:move_up

patch: http://pastebin.archlinux.fr/pastebin.php?dl=432299

A view to display the list of files currently in copy buffer (so we can remove them one by one).
patch: http://pastebin.archlinux.fr/pastebin.php?dl=432298

Last edited by PotatoesMaster (2011-05-03 20:07:21)

Offline

#970 2011-05-03 20:23:59

student975
Member
From: Russian Federation
Registered: 2011-03-05
Posts: 613

Re: Ranger, a textbased filemanager

Probably :delete will be more consistent if it will ask a conformation at any case.


"I exist" is the best myth I know..

Offline

#971 2011-05-06 13:08:07

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

Re: Ranger, a textbased filemanager

Hello!
Is there any chance to get aliases and hashes (hash -d) from ~/.zshrc worked with ranger?

Also, found an issue whith command :shell cp %s %D an error 'NoneType' object has no attribute 'path' appears if destination directory is empty.

Last edited by loop (2011-05-06 14:17:41)

Offline

#972 2011-05-07 00:04:14

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

Re: Ranger, a textbased filemanager

@loop: you can add this to your file ~/.config/ranger/keys.py (create it if necessary) :

from ranger.ext.spawn import spawn
from ranger.fsobject import Directory
import re

class hash_to_bookmarks(Command):
    def tab(self):
        return ['hash_to_bookmarks force']

    def execute(self):
        line = parse(self.line)
        lastword = line.chunk(-1)
        force = lastword == 'force'
        hash_pattern = re.compile(r'^[\d\w]=.')
        entries = spawn('zsh', '-ic', 'hash -d')

        self.fm.bookmarks.update_if_outdated()

        for i in entries.split('\n'):
            if hash_pattern.match(i):
                key, value = i[0], i[2:]
                if force or not key in self.fm.bookmarks.dct.keys():
                    self.fm.bookmarks[key] = Directory(value)

Then use the command :hash_to_bookmarks to grab the bookmarks from zsh (only one-letter long ones).
:hash_to_bookmarks force allows to overwrite existing bookmarks). wink

Offline

#973 2011-05-07 04:54:24

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

Re: Ranger, a textbased filemanager

Hello, PotatoesMaster. Thank you for your help!
One thing: hashes in zsh can be used as destination points while copy, move and other operations. It would be great to use ranger`s bookmarks in such way, but I`ve not realized the way to do this. E.g.:

:shell for i in ~dir1 ~dir2 ~dir3 ... ~dir'n' ; do cp %f $i; done

Last edited by loop (2011-05-07 08:32:08)

Offline

#974 2011-05-07 10:56:25

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

Re: Ranger, a textbased filemanager

To use zsh alias, functions and stuff with the shell command, edit ranger/defaults/commands.py and replace the line #163 (in shell.execute())

self.fm.execute_command(command, flags=flags)

with

self.fm.execute_command("zsh -ic '" + command + "'", flags=flags)

Offline

#975 2011-05-07 16:39:16

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

Re: Ranger, a textbased filemanager

PotatoesMaster, thank you again! Zsh stuff get worked! cool
The only annoying detail happens every time I use zsh alias or hash, the command work properly but ranger itself goes to background and stays there untill command fg entered.
Meanwhile ranger is suspended, shell demonstrates: zsh: suspended (tty output)  ranger.
I`ll try to swap some zsh options to get over.

Offline

Board footer

Powered by FluxBB