You are not logged in.

#826 2011-02-23 19:13:29

niksfirefly
Member
Registered: 2011-02-23
Posts: 9

Re: Ranger, a textbased filemanager

Is it possible to access aliases,functions,and exported variables from bash defined in .bashrc
in :shell ranger??

I am getting not found errors with custom commands and cant find the rule how it works
what is the chain of loading bash startup files when i start for example
:shell -w "my_command_form_bashrc"

Offline

#827 2011-02-23 19:15:23

niksfirefly
Member
Registered: 2011-02-23
Posts: 9

Re: Ranger, a textbased filemanager

Is it possible to access aliases,functions,and exported variables from bash defined in .bashrc
in :shell ranger??

I am getting not found errors with custom commands and cant find the rule how it works
what is the chain of loading bash startup files when i start for example
:shell -w "my_command_form_bashrc"

Offline

#828 2011-02-23 19:16:59

niksfirefly
Member
Registered: 2011-02-23
Posts: 9

Re: Ranger, a textbased filemanager

Is it possible to access aliases,functions,and exported variables from bash defined in .bashrc
in :shell ranger??

I am getting not found errors with custom commands and cant find the rule how it works
what is the chain of loading bash startup files when i start for example
:shell -w "my_command_form_bashrc"

Offline

#829 2011-02-24 00:30:43

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

Re: Ranger, a textbased filemanager

Hi niksfirefly
Its not possible. But you can hack ranger/defaults/commands.py and replace the last line in shell.execute()

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

with

self.fm.execute_command("bash -c 'source ~/.bashrc;" + command + "'", flags=flags)

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

Offline

#830 2011-02-24 14:25:41

mentat
Member
From: France
Registered: 2009-01-13
Posts: 138
Website

Re: Ranger, a textbased filemanager

Hut, is it possible you integrate it directly in the next version ?

Offline

#831 2011-02-24 15:54:26

Dx9
Member
Registered: 2010-01-14
Posts: 5
Website

Re: Ranger, a textbased filemanager

Great Job !! It's amazing!

Offline

#832 2011-02-24 16:47:40

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

Re: Ranger, a textbased filemanager

Is it possible to make ranger do the following:

I have some directories which contain files named like this

1.jpg
2.jpg
...
9.jpg
10.jpg
...
99.jpg
100.jpg
...

Ranger shows them like this

1.jpg
10.jpg
100.jpg
2.jpg
...
9.jpg
99.jpg
...

Is it possible to make ranger show them in the right order?

Offline

#833 2011-02-24 16:51:38

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

Re: Ranger, a textbased filemanager

Army wrote:

Is it possible to make ranger do the following:

I have some directories which contain files named like this

1.jpg
2.jpg
...
9.jpg
10.jpg
...
99.jpg
100.jpg
...

Ranger shows them like this

1.jpg
10.jpg
100.jpg
2.jpg
...
9.jpg
99.jpg
...

Is it possible to make ranger show them in the right order?

Yeah, to turn on that feature, type "on"

Edit: It's slightly slower than the default sorting method but i'm considering to change this to the default method

Last edited by hut (2011-02-24 16:52:42)


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

Offline

#834 2011-02-24 17:21:13

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

Re: Ranger, a textbased filemanager

Can I make this permanent? In options.py I only see sort='basename', which - according to 14? - belongs to both 'on' and 'ob'.

One other question, which might have already been answered here, but it's really a LONG thread wink What do I have to do to make pdf files have another color than text files?

Offline

#835 2011-02-24 17:25:47

niksfirefly
Member
Registered: 2011-02-23
Posts: 9

Re: Ranger, a textbased filemanager

hut wrote:

Hi niksfirefly
Its not possible. But you can hack ranger/defaults/commands.py and replace the last line in shell.execute()

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

with

self.fm.execute_command("bash -c 'source ~/.bashrc;" + command + "'", flags=flags)

thx hut
ill try that hack

is there any shortcut to see previous shell output
i can do simply
:shell -w pause

but maybe i miss your default solution

regards

Offline

#836 2011-02-25 13:20:39

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

Re: Ranger, a textbased filemanager

I have a suggestion:
With the option "mouse_enabled = False" in options.py there's no need to leave a blank space on the right side of files, because clicking into that area doesn't do anything. Hut, can you make ranger use this space for the file names if this option is set?

Offline

#837 2011-02-25 13:47:36

niksfirefly
Member
Registered: 2011-02-23
Posts: 9

Re: Ranger, a textbased filemanager

hut wrote:

Hi niksfirefly
Its not possible. But you can hack ranger/defaults/commands.py and replace the last line in shell.execute()

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

with

self.fm.execute_command("bash -c 'source ~/.bashrc;" + command + "'", flags=flags)

well this hack not works
i found out that
no aliases set
only sys ENV variables working inside :shell

maybe python script cannot access ?
somebody with great python and bash knowledge may find solution

Offline

#838 2011-02-25 15:20:55

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

Re: Ranger, a textbased filemanager

mentat wrote:

Hut, is it possible you integrate it directly in the next version ?

Not sure... It's very dependent on the users system.

Army wrote:

Can I make this permanent? In options.py I only see sort='basename', which - according to 14? - belongs to both 'on' and 'ob'.

the documentation is wrong in this case...

sort = 'natural'

Army wrote:

One other question, which might have already been answered here, but it's really a LONG thread wink What do I have to do to make pdf files have another color than text files?

That's non-trivial. I know it should be, sorry^^.
Lets see If I can modify the colorscheme engine to make this easier.

Army wrote:

I have a suggestion:
With the option "mouse_enabled = False" in options.py there's no need to leave a blank space on the right side of files, because clicking into that area doesn't do anything. Hut, can you make ranger use this space for the file names if this option is set?

There's an option for that already, padding_right

niksfirefly wrote:

is there any shortcut to see previous shell output
i can do simply
:shell -w pause

but maybe i miss your default solution

regards

I use the S key to open a shell and show the previous output, then ctrl+d to close the shell again


niksfirefly wrote:
hut wrote:

Hi niksfirefly
Its not possible. But you can hack ranger/defaults/commands.py and replace the last line in shell.execute()

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

with

self.fm.execute_command("bash -c 'source ~/.bashrc;" + command + "'", flags=flags)

well this hack not works
i found out that
no aliases set
only sys ENV variables working inside :shell

maybe python script cannot access ?
somebody with great python and bash knowledge may find solution

Maybe there's an option for bash that runs commands *and* loads .bashrc + other config files, but I don't see it.

Which file defines your aliases? Add source <yourfile>; to the command above. (unless it's ~/.bashrc... then I don't know)


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

Offline

#839 2011-02-25 16:30:26

niksfirefly
Member
Registered: 2011-02-23
Posts: 9

Re: Ranger, a textbased filemanager

Maybe there's an option for bash that runs commands *and* loads .bashrc + other config files, but I don't see it.

Which file defines your aliases? Add source <yourfile>; to the command above. (unless it's ~/.bashrc... then I don't know)


hmm I sourced many files (also from .bashrc which by default run with bash)
alias -p always is empty
only CAPITALIZED variables like PATH,HOME etc. get through
i think i give up with that

What i really miss from mc is active bash shell in bottom synchronized when i traverse dirs
Do you consider such solution or sth else for RANGER?

I use tmux so i think about opening bottom pane but have no clue how to sync with actual view from ranger

ranger + tmux is incredible duo-beast smile
thx for ur very good work

Last edited by niksfirefly (2011-02-25 17:29:26)

Offline

#840 2011-02-25 22:50:29

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

Re: Ranger, a textbased filemanager

Thanks hut! It's working, I didn't see that padding option.

Offline

#841 2011-02-26 06:13:57

Ledti
Member
Registered: 2010-07-31
Posts: 122
Website

Re: Ranger, a textbased filemanager

I think the Python 3.2 rebuild breaks something. Ranger launches console applications like the editor or aunpack, but it fails to run mplayer and other external apps.

Something like:

Failed to run: ('mplayer', '/path/to/video.mkv' 

Tested with and without a custom apps.py, and both the git and community versions. Switching to python2 is a temporary fix.

Offline

#842 2011-02-26 09:22:30

gorilla
Member
From: Berlin
Registered: 2010-06-15
Posts: 72

Re: Ranger, a textbased filemanager

jep, fails also here. I'm not able to open any files. Even when I try to open it with "r" it's not possible.

Offline

#843 2011-02-26 12:26:21

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

Re: Ranger, a textbased filemanager

A traceback would help: ranger --debug


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

Offline

#844 2011-02-26 12:49:52

Ledti
Member
Registered: 2010-07-31
Posts: 122
Website

Re: Ranger, a textbased filemanager

hut wrote:

A traceback would help: ranger --debug

Sorry, I actually tried that before posting, but it doesn't output anything when running that command from the console. Is there another way?

Edit:

For clarity: Ranger doesn't crash, it works perfectly. It just doesn't launch external applications other than ones that subsume Ranger's terminal.

Last edited by Ledti (2011-02-26 13:42:09)

Offline

#845 2011-02-26 13:18:03

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

Re: Ranger, a textbased filemanager

Yep.

~/> ranger --debug
Traceback (most recent call last):
  File "/usr/bin/ranger", line 50, in <module>
    import ranger
ImportError: No module named ranger

edit: nvm, I had to reinstall...

Last edited by archman-cro (2011-02-26 13:25:11)

Offline

#846 2011-02-26 13:43:09

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

Re: Ranger, a textbased filemanager

Okay, I'm busy for the next few days, please use python2 for the time being.
alias ranger='python2 /usr/bin/ranger'

If any of you attempts to fix it: The error occurs at ranger/core/runner.py line 194. Possibly something related to "[Errno 9] Bad file descriptor"

Ledti wrote:
hut wrote:

A traceback would help: ranger --debug

Sorry, I actually tried that before posting, but it doesn't output anything when running that command from the console. Is there another way?

Edit:

For clarity: Ranger doesn't crash, it works perfectly. It just doesn't launch external applications other than ones that subsume Ranger's terminal.

Turns out that the debug code isn't working properly. :D
For clarity: --debug is supposed to turn a simple error message into a crash + print the traceback

Last edited by hut (2011-02-26 13:49:53)


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

Offline

#847 2011-02-26 13:54:02

Ledti
Member
Registered: 2010-07-31
Posts: 122
Website

Re: Ranger, a textbased filemanager

hut wrote:

Okay, I'm busy for the next few days, please use python2 for the time being.
alias ranger='python2 /usr/bin/ranger'

If any of you attempts to fix it: The error occurs at ranger/core/runner.py line 194. Possibly something related to "[Errno 9] Bad file descriptor"

Ledti wrote:
hut wrote:

A traceback would help: ranger --debug

Sorry, I actually tried that before posting, but it doesn't output anything when running that command from the console. Is there another way?

Edit:

For clarity: Ranger doesn't crash, it works perfectly. It just doesn't launch external applications other than ones that subsume Ranger's terminal.

Turns out that the debug code isn't working properly. big_smile
For clarity: --debug is supposed to turn a simple error message into a crash + print the traceback

haha, alright. That makes sense. I was confused there for a bit. tongue

Offline

#848 2011-02-27 05:17:12

iamsmrt
Member
Registered: 2009-08-12
Posts: 138

Re: Ranger, a textbased filemanager

I get the same issue with mplayer and when trying to run `python2 /usr/bin/ranger` I get the following:

brian@brian-desktop:~$ python2 /usr/bin/ranger
Traceback (most recent call last):
  File "/usr/bin/ranger", line 50, in <module>
    import ranger
ImportError: No module named ranger

Offline

#849 2011-02-27 09:27:16

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

Re: Ranger, a textbased filemanager

Another way to switch back to python2 is to edit the PKGBUILD, simply replace all "python" with "python2", e.g.

sed 's/python/python2/g' -i PKGBUILD

That way it definitely works (that's how I build and use ranger)

Offline

#850 2011-02-27 10:08:09

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

Re: Ranger, a textbased filemanager

Army, thank you!

Offline

Board footer

Powered by FluxBB