You are not logged in.

#626 2010-10-27 22:36:18

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

Re: Ranger, a textbased filemanager

sefsinalas wrote:

nono...the "Del" key. The normal key to delete files in X11

First put this in your ~/.config/ranger/keys:

from ranger.api.keys import *
map = keymanager.get_context('browser')

Then you can map <DELETE> to some command. Like:

map('<DELETE>', fm.open_console('delete seriously? '))

This will delete anything instantly without confirmation:

map('<DELETE>', fm.execute_console('delete y'))

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

Offline

#627 2010-10-30 21:15:29

Revelation60
Member
From: The Netherlands
Registered: 2009-03-19
Posts: 158
Website

Re: Ranger, a textbased filemanager

I really like ranger! The only thing I am missing (or overlooking ?) is an incremental search function. I want to be able to type the name of a file or folder and ranger to go there instead of using the arrows to get to it.

Offline

#628 2010-10-30 21:20:54

firecat53
Member
From: Lake Stevens, WA, USA
Registered: 2007-05-14
Posts: 1,542
Website

Re: Ranger, a textbased filemanager

Hit / and then type part of the filename and hit Enter. Works for anything in the current directory smile That's what you're looking for I hope!

Scott

Revelation60 wrote:

I really like ranger! The only thing I am missing (or overlooking ?) is an incremental search function. I want to be able to type the name of a file or folder and ranger to go there instead of using the arrows to get to it.

Offline

#629 2010-10-30 22:36:20

hurleyef
Member
Registered: 2010-06-22
Posts: 72

Re: Ranger, a textbased filemanager

firecat53 wrote:

Hit / and then type part of the filename and hit Enter. Works for anything in the current directory smile That's what you're looking for I hope!

Scott

Revelation60 wrote:

I really like ranger! The only thing I am missing (or overlooking ?) is an incremental search function. I want to be able to type the name of a file or folder and ranger to go there instead of using the arrows to get to it.

I've been wanting the same thing, this will do nicely.

Offline

#630 2010-10-30 22:48:05

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

Re: Ranger, a textbased filemanager

Also try "f" :-D


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

Offline

#631 2010-10-31 10:08:50

Revelation60
Member
From: The Netherlands
Registered: 2009-03-19
Posts: 158
Website

Re: Ranger, a textbased filemanager

I was looking for something in between the two tongue With / I have to press enter and thus it is not an incremental search. With f it does do an incremental search but it automatically starts a file when it has resolved which one I want. I just want the cursor to go there.

Offline

#632 2010-10-31 11:06:18

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

Re: Ranger, a textbased filemanager

No key for that.

Here's how to add one:

~/.config/ranger/commands.py:

from ranger.api.commands import *
from ranger.defaults.commands import search

class inc_search(search):
  def quick(self):
    if self.line.split(" ", 2)[1]:
      search.execute(self)

keys.py:

from ranger.api.keys import *
map = keymanager.get_context('browser')
map('x', fm.open_console('inc_search '))

Last edited by hut (2010-10-31 12:01:47)


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

Offline

#633 2010-10-31 11:50:31

Revelation60
Member
From: The Netherlands
Registered: 2009-03-19
Posts: 158
Website

Re: Ranger, a textbased filemanager

I can't get it to work sad If I press x it just goes to the next item. You do mean .config/ranger/keys.py, right?

Offline

#634 2010-10-31 12:01:23

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

Re: Ranger, a textbased filemanager

Oh, sorry, use open_console instead of execute_console.


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

Offline

#635 2010-10-31 12:12:56

Revelation60
Member
From: The Netherlands
Registered: 2009-03-19
Posts: 158
Website

Re: Ranger, a textbased filemanager

Thanks! It is working now smile

I have another question, if you don't mind. What can I do to fix this:

map('<SHIFT><DELETE>', fm.open_console('delete y'))

Offline

#636 2010-10-31 12:21:34

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

Re: Ranger, a textbased filemanager

Not all keys have a representation in ranger. Just use the key code defined by ncurses. You can find out the codes with the little app in ranger/doc/print_keys.py.

The code for shift+delete is 383, so write:

map(383, ...)

Last edited by hut (2010-10-31 12:23:36)


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

Offline

#637 2010-10-31 16:31:48

Revelation60
Member
From: The Netherlands
Registered: 2009-03-19
Posts: 158
Website

Re: Ranger, a textbased filemanager

Thanks! The map is working. It doens't delete the file right away however, you still have to press enter. Can this be changed?

I was also wondering if ranger would implement a real filesystem search like the find command.

Offline

#638 2010-10-31 19:36:53

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

Re: Ranger, a textbased filemanager

Revelation60 wrote:

Thanks! The map is working. It doens't delete the file right away however, you still have to press enter. Can this be changed?

I was also wondering if ranger would implement a real filesystem search like the find command.

That's implemented already, type:

#find 

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

Offline

#639 2010-10-31 19:51:08

Revelation60
Member
From: The Netherlands
Registered: 2009-03-19
Posts: 158
Website

Re: Ranger, a textbased filemanager

It doesn't work the way I'd expect it to. I take it you mean with #find :shell -p find.

If you want to find a file in a subdirectory,  you have to make a weird regex. For example: say in a subdirectory called foo a file is called bar.txt.

#find bar.txt will not find anything. This is probably because the file gets listed as foo/bar.txt. If you search for that, you'll find it.

But of course, you don't know where the file is. So that's not very helpful wink

Offline

#640 2010-10-31 22:57:07

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

Re: Ranger, a textbased filemanager

"#command" is expanded to ":shell -p command", which runs the command and pipes the output to "less". So you can do everything you could do in the shell.
For example, I got this mapping:

map('F', fm.open_console('shell -p find . | grep '))

I can type "Fbar.txt<enter>" to find foo/bar.txt.


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

Offline

#641 2010-11-01 04:27:36

sefsinalas
Member
From: Salta - Argentina
Registered: 2010-06-13
Posts: 14
Website

Re: Ranger, a textbased filemanager

there is anyway to extract and compress files directly from ranger?

Offline

#642 2010-11-01 11:09:51

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

Re: Ranger, a textbased filemanager

get 'atool' and open archive files with mode 1, by typing 1l, to extract them.
For compressing, use @apack foo.tar<enter>

also: https://bbs.archlinux.org/viewtopic.php … 03#p844503

Last edited by hut (2010-11-01 11:12:19)


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

Offline

#643 2010-11-05 23:56:57

firecat53
Member
From: Lake Stevens, WA, USA
Registered: 2007-05-14
Posts: 1,542
Website

Re: Ranger, a textbased filemanager

Hey Hut, I noticed (fully updated ranger-git as of today) that when doing a :chmod on a directory, the permissions line at the bottom doesn't change and can't be changed even with a refresh. The permissions actually do change, and it also works on files, just not on directories. Actually, I should say it updates....rarely smile But I can't find a consistent pattern. I haven't used that feature enough to say whether it's worked consistently in the past or not.

Thanks!
Scott

Offline

#644 2010-11-06 15:54:21

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

Re: Ranger, a textbased filemanager

And this happens only with directories, right?
Thanks for mentioning, I uploaded a fix.

Btw. I'm thinking of removing the :chmod command, since it's easily replaced with @chmod (using /bin/chmod, which is more flexible anyway), I hope you guys don't mind?


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

Offline

#645 2010-11-06 16:06:08

ngoonee
Forum Fellow
From: Between Thailand and Singapore
Registered: 2009-03-17
Posts: 7,358

Re: Ranger, a textbased filemanager

Question (just started using ranger) but is it possible for ranger to default to something like xdg-open in the case that no specific file handler has been defined? Would help out those of us who use Gnome/KDE and already have mimetypes registered....

I'm pretty sure there's a simple way to do this in the current config, but haven't figured out how?


Allan-Volunteer on the (topic being discussed) mailn lists. You never get the people who matters attention on the forums.
jasonwryan-Installing Arch is a measure of your literacy. Maintaining Arch is a measure of your diligence. Contributing to Arch is a measure of your competence.
Griemak-Bleeding edge, not bleeding flat. Edge denotes falls will occur from time to time. Bring your own parachute.

Offline

#646 2010-11-06 16:13:01

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

Re: Ranger, a textbased filemanager

1. Put a copy of ranger/defaults/apps.py into ~/.config/ranger/apps.py, for example by typing

ranger --copy-config=apps

2. Edit it. At the bottom of the function "def app_default" it says something about mimeopen, replace that string with xdg-open.

3. I really should've made this configurable through the options.py or something. :X


EDIT:


Sirsurthur wrote:

Indeed I am using scope.sh. By renaiming it, ranger does not crash anymore but it still does not show any preview of this .srt files. For now, I am indeed using ranger with python 3.0.

I guess I will stay with ranger/python3 for now. It's not that a big issue but wanted you to be aware of it.

Thanks for your answers,
Sirsurthur

----
Edit : for your information, I also got this crash during a .pdf preview :

ranger --debug
Traceback (most recent call last):
  File "/usr/lib/python3.1/site-packages/ranger/core/main.py", line 85, in main
    fm.loop()
  File "/usr/lib/python3.1/site-packages/ranger/core/fm.py", line 190, in loop
    loader.work()
  File "/usr/lib/python3.1/site-packages/ranger/core/loader.py", line 234, in work
    self.fm.notify(err)
  File "/usr/lib/python3.1/site-packages/ranger/core/loader.py", line 229, in work
    next(item.load_generator)
  File "/usr/lib/python3.1/site-packages/ranger/core/loader.py", line 98, in generate
    read = read.decode('utf-8')
UnicodeDecodeError: 'utf8' codec can't decode byte 0xc3 in position 511: unexpected end of data

Can you give me the file for which this error happens?

Last edited by hut (2010-11-06 16:43:09)


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

Offline

#647 2010-11-06 18:04:41

ngoonee
Forum Fellow
From: Between Thailand and Singapore
Registered: 2009-03-17
Posts: 7,358

Re: Ranger, a textbased filemanager

Sorry, hut, I must be blind, but I can't see anything referring mimeopen in apps.py. Also, ranger --copy-config doesn't exist smile.


Allan-Volunteer on the (topic being discussed) mailn lists. You never get the people who matters attention on the forums.
jasonwryan-Installing Arch is a measure of your literacy. Maintaining Arch is a measure of your diligence. Contributing to Arch is a measure of your competence.
Griemak-Bleeding edge, not bleeding flat. Edge denotes falls will occur from time to time. Bring your own parachute.

Offline

#648 2010-11-06 18:13:44

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

Re: Ranger, a textbased filemanager

ngoonee wrote:

Sorry, hut, I must be blind, but I can't see anything referring mimeopen in apps.py. Also, ranger --copy-config doesn't exist smile.

Okay, you didn't tell me what version you use so I just guessed smile

Then just add this at the bottom of the function:

return tup("xdg-open", *c)

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

Offline

#649 2010-11-07 19:22:09

vae77
Member
Registered: 2010-07-02
Posts: 75
Website

Re: Ranger, a textbased filemanager

Great Job, thanks smile

Offline

#650 2010-11-09 06:07:55

killua
Member
Registered: 2010-04-12
Posts: 8

Re: Ranger, a textbased filemanager

Ranger rocks!  Thanks for your great job,hut ^_^ Ranger is the only one file manager i have installed.
Just one question: is it possible to map key to do combined actions,for example,can i map J to firstly move down and then enter ? ( J = j+l )

Offline

Board footer

Powered by FluxBB