You are not logged in.

#201 2010-04-15 14:10:12

rson451
Member
From: Annapolis, MD USA
Registered: 2007-04-15
Posts: 1,233
Website

Re: Ranger, a textbased filemanager

Personally I'd fine j/k wrapping to be more a pain in the ass than anything tbh.  If you start assigning basic motions different than vim, it's going to screw up lots of people.


archlinux - please read this and this — twice — then ask questions.
--
http://rsontech.net | http://github.com/rson

Offline

#202 2010-04-15 19:09:06

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

Re: Ranger, a textbased filemanager

It's not much work, actually you can implement it in your key config.

Replace the KEY_UP mapping with a function that either moves up by 1 or moves to the bottom, depending on whether you're at position 0 or not. (the current position is accessible via arg.fm.env.cwd.pointer, the lowest possible position is len(arg.fm.env.cwd.files) - 1. Same for KEY_DOWN.


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

Offline

#203 2010-04-15 20:49:24

cmlr
Member
From: Rochester, NY, USA
Registered: 2007-04-18
Posts: 99

Re: Ranger, a textbased filemanager

Great work on ranger.

I would love to see a trash can such as vifm has.  This would make things much safer, and then "dd" could work as expected.

Offline

#204 2010-04-16 06:52:44

RPMN
Member
Registered: 2010-03-08
Posts: 13

Re: Ranger, a textbased filemanager

If you decide to include trash support, please make it optional!

Who needs trash anyway?

Offline

#205 2010-04-16 07:02:32

muunleit
Member
From: Germany
Registered: 2008-02-23
Posts: 234

Re: Ranger, a textbased filemanager

RPMN wrote:

If you decide to include trash support, please make it optional!

Who needs trash anyway?

+1


"The mind can make a heaven out of hell or a hell out of heaven" -- John Milton

Offline

#206 2010-04-16 07:48:21

MindTooth
Member
From: Norway
Registered: 2008-11-11
Posts: 331

Re: Ranger, a textbased filemanager

Started using this software, and I really like it. The simplicity is just to cope after...

Good job on the software wink

Offline

#207 2010-04-16 09:31:16

b4283
Member
Registered: 2008-11-26
Posts: 123

Re: Ranger, a textbased filemanager

great software i very appreciate !

nonetheless, the configuration was over-complicated (especially compared to vifm).
this is what is used for default opening a animated gif file:

FILETYPE=gif=gif=gifview -a

i think using pure python to configure is not a good idea, but it's only a suggestion !

maybe use a YAML parser for this ..?
YAML has the fame for clear writings and readings, which is perfect for conf files.

Offline

#208 2010-04-16 09:45:53

b4283
Member
Registered: 2008-11-26
Posts: 123

Re: Ranger, a textbased filemanager

b4283 wrote:

nonetheless, the configuration was over-complicated (especially compared to vifm).

after keen trial i find it is also easy enough, nvm what i said. smile

Offline

#209 2010-04-16 10:48:18

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

Re: Ranger, a textbased filemanager

cmlr wrote:

Great work on ranger.

I would love to see a trash can such as vifm has.  This would make things much safer, and then "dd" could work as expected.

Hm. I have this feature in the ruby branch but didn't port it to the new python version. I guess I found it inconvenient that my files disappear when I "dd" them. Just marking them as "cut" is more similar to what other filemanagers do. (except vifm tongue) It was especially annoying when the cut files were relatively big and on a different filesystem than your ~/.trash, because that means they have to be copied first.
I'll think about providing an optional keybinding which gives you this feature though.


b4283 wrote:

the configuration was over-complicated (especially compared to vifm).

I need the flexibility! =P
Anyway, I will make the keys.py simpler soon but the apps.py will stay that way. If one wants a simpler configuration for that, one could just use something like mimeo or xdg-open on every file, they have an easier configuration, though less customizable.

Last edited by hut (2010-04-16 10:53:13)


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

Offline

#210 2010-04-16 12:13:37

b4283
Member
Registered: 2008-11-26
Posts: 123

Re: Ranger, a textbased filemanager

hut wrote:

I need the flexibility! =P
Anyway, I will make the keys.py simpler soon but the apps.py will stay that way. If one wants a simpler configuration for that, one could just use something like mimeo or xdg-open on every file, they have an easier configuration, though less customizable.

actually, after tracing your code i find it is really beautiful !

i suspect the CustomApp class is a polymorphism practice ?

you don't need to fix it, i was wrong.

Offline

#211 2010-04-16 15:14:55

JohannesSM64
Member
From: Norway
Registered: 2009-10-11
Posts: 623
Website

Re: Ranger, a textbased filemanager

cmlr wrote:

Great work on ranger.

I would love to see a trash can such as vifm has.  This would make things much safer, and then "dd" could work as expected.

The problem of having "dd" work as expected is that it would move the files to the trash directory on every "dd", adding significant overhead, especially when working between drives.

Offline

#212 2010-04-16 20:29:38

cmlr
Member
From: Rochester, NY, USA
Registered: 2007-04-18
Posts: 99

Re: Ranger, a textbased filemanager

OK, perhaps it's better without a trash can.  But I'd like to bind keys to scripts or sequences of commands.  That way, one could bind "DD" to "mv %f ~/.Trash".

Secondly, it would be nice to be able to define commands, to execute with ":", and these could take the current file or selection as input.

Maybe this is already possible, but I don't know how.

Offline

#213 2010-04-16 20:41:50

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

Re: Ranger, a textbased filemanager

take look at ranger/defaults/keys.py and commands.py.
The current selection is obtainable with fm.env.get_selection()
To run shell commands, you can use fm.run(). For example:

@map('DD')
def movetotrash(arg):
    arg.fm.run(["mv"] + arg.fm.env.get_selection() + ["~/.Trash"])

(not tested)


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

Offline

#214 2010-04-16 20:58:21

cmlr
Member
From: Rochester, NY, USA
Registered: 2007-04-18
Posts: 99

Re: Ranger, a textbased filemanager

hut wrote:

take look at ranger/defaults/keys.py and commands.py.
The current selection is obtainable with fm.env.get_selection()
To run shell commands, you can use fm.run(). For example:

@map('DD')
def movetotrash(arg):
    arg.fm.run(["mv"] + arg.fm.env.get_selection() + ["~/.Trash"])

(not tested)

Thanks!  Now ranger is much more useful for me.

Offline

#215 2010-04-16 21:30:38

cmlr
Member
From: Rochester, NY, USA
Registered: 2007-04-18
Posts: 99

Re: Ranger, a textbased filemanager

cmlr wrote:
hut wrote:

take look at ranger/defaults/keys.py and commands.py.
The current selection is obtainable with fm.env.get_selection()
To run shell commands, you can use fm.run(). For example:

@map('DD')
def movetotrash(arg):
    arg.fm.run(["mv"] + arg.fm.env.get_selection() + ["~/.Trash"])

(not tested)

Thanks!  Now ranger is much more useful for me.

This doesn't work, but I can play around with it.

Offline

#216 2010-04-16 21:36:24

cmlr
Member
From: Rochester, NY, USA
Registered: 2007-04-18
Posts: 99

Re: Ranger, a textbased filemanager

This works better:

@map('DD')
def movetotrash(arg):
    arg.fm.run("mv " + str(arg.fm.env.get_selection()[0]) + " ~/.Trash")

since arg.fm.env.get_selection() returns a vector of file objects.  I took the first one, and then turned it into a string.

Offline

#217 2010-04-16 21:44:39

cmlr
Member
From: Rochester, NY, USA
Registered: 2007-04-18
Posts: 99

Re: Ranger, a textbased filemanager

The following will move all selections to trash, not just the first file

@map('DD')
def movetotrash(arg):
    commands = ["mv " + str(f) + " /home/carl/.Trash/" for f in arg.fm.env.get_selection()]
    [arg.fm.run(c) for c in commands]

Offline

#218 2010-04-16 23:02:02

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

Re: Ranger, a textbased filemanager

you should probably do

from ranger.ext.shell_escape import shell_quote

somewhere and change str(f) to shell_quote(str(f)). Otherwise spaces in filenames will screw up the script.


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

Offline

#219 2010-04-17 11:22:07

cmlr
Member
From: Rochester, NY, USA
Registered: 2007-04-18
Posts: 99

Re: Ranger, a textbased filemanager

It would be nice if programs opened in the background, without temporarily disabling ranger.  For example, I might want to open an html file with firefox, and then edit it too.

Offline

#220 2010-04-17 12:51:31

cmlr
Member
From: Rochester, NY, USA
Registered: 2007-04-18
Posts: 99

Re: Ranger, a textbased filemanager

I have more bookmarks than there's room for in the popup box.  We should be able to adjust the size of the box in options.py.

Offline

#221 2010-04-17 13:56:51

JohannesSM64
Member
From: Norway
Registered: 2009-10-11
Posts: 623
Website

Re: Ranger, a textbased filemanager

cmlr wrote:

I have more bookmarks than there's room for in the popup box.  We should be able to adjust the size of the box in options.py.

Seconded

Offline

#222 2010-04-17 15:14:43

orschiro
Member
Registered: 2009-06-04
Posts: 2,136
Website

Re: Ranger, a textbased filemanager

cmlr wrote:

It would be nice if programs opened in the background, without temporarily disabling ranger.  For example, I might want to open an html file with firefox, and then edit it too.

Very nice idea.

Offline

#223 2010-04-17 15:51:37

JohannesSM64
Member
From: Norway
Registered: 2009-10-11
Posts: 623
Website

Re: Ranger, a textbased filemanager

That is already implemented. "firefox D" will open it detached. The reason it is not done for everything by default is that console apps are not supposed to be opened detached, as it would simply leave a process not connected to any tty.

Offline

#224 2010-04-17 16:26:30

cmlr
Member
From: Rochester, NY, USA
Registered: 2007-04-18
Posts: 99

Re: Ranger, a textbased filemanager

JohannesSM64 wrote:

That is already implemented. "firefox D" will open it detached. The reason it is not done for everything by default is that console apps are not supposed to be opened detached, as it would simply leave a process not connected to any tty.

Pressing "r" and entering "firefox D" opens firefox, but ranger remains blacked out and unusable.  The same change in apps.py didn't work either.

Offline

#225 2010-04-17 16:36:26

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

Re: Ranger, a textbased filemanager

Try "firefox d". In the apps.py, add c.flags += 'd' before the return [...]

cmlr wrote:

I have more bookmarks than there's room for in the popup box.  We should be able to adjust the size of the box in options.py.

I don't understand why you'd want to change the size of the box. You want to make it smaller? Then even less bookmarks will fit.


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

Offline

Board footer

Powered by FluxBB