You are not logged in.

#1326 2012-04-17 21:08:14

catch22
Member
Registered: 2012-04-15
Posts: 10

Re: Ranger, a textbased filemanager

jk121960 wrote:

... hut puts in a range of editors that are common, nano being one of them...
Every install of ranger I have used has had vim in the list. So I am not sure what to think if you dont see it at all

I admit I haven't touched the surface of configuring stuff in ranger; just beginning, so I don't know where there's a list of editors like you mention?
In rifle.py I only see

DEFAULT_PAGER = 'less'
DEFAULT_EDITOR = 'nano'

Offline

#1327 2012-04-17 21:49:49

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

Re: Ranger, a textbased filemanager

catch22 wrote:
jk121960 wrote:

... hut puts in a range of editors that are common, nano being one of them...
Every install of ranger I have used has had vim in the list. So I am not sure what to think if you dont see it at all

I admit I haven't touched the surface of configuring stuff in ranger; just beginning, so I don't know where there's a list of editors like you mention?
In rifle.py I only see

DEFAULT_PAGER = 'less'
DEFAULT_EDITOR = 'nano'

Are you using the community version or the aur?


Arch Awesome, Ranger & Vim the coding triple threat.

Offline

#1328 2012-04-18 20:53:57

catch22
Member
Registered: 2012-04-15
Posts: 10

Re: Ranger, a textbased filemanager

jk121960 wrote:

Are you using the community version or the aur?

I guess community (?) since I don't have Arch installed at all.

Offline

#1329 2012-04-18 21:25:47

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

Re: Ranger, a textbased filemanager

Yes forgot sorry, your configuration is in ~/.config/ranger, all the files should be there if not you can run command 'ranger --copy-config=all' and it will put them there. The main one called apps.py has what you are looking for. Look for a method called ranger "CustomApplications" around line 175 you will find a statement 'def app_editor' in there is a statement that looks like this 'return self.either(c, 'vim', 'emacs', 'nano')' arrange your editors in the priority that you like. remember to backup the file before making code changes. Now on the off chance you got a very new version then the info your looking for will be in a file called rifle.conf. rifle.conf handles this all by env Variables, so you have to make sure that your $EDITOR variable carries vim as it's value. If not set it in your .bashrc or .bash_profile 'export EDITOR=vim' then it should pick it up.

--jerry


Arch Awesome, Ranger & Vim the coding triple threat.

Offline

#1330 2012-04-24 15:47:43

manolomartinez
Member
Registered: 2011-04-29
Posts: 64
Website

Re: Ranger, a textbased filemanager

Hi, right now I'm using the following line in rifle.conf to read pdfs in console (without X):

ext pdf, has pdftotext, terminal = pdftotext -- "$@" /tmp/visor.txt && vim /tmp/visor.txt

An ugly hack, I know. Could anyone share a better way?

Thanks,
Manolo

Offline

#1331 2012-04-24 20:16:35

catch22
Member
Registered: 2012-04-15
Posts: 10

Re: Ranger, a textbased filemanager

jk121960 wrote:

Yes forgot sorry, your configuration is in ~/.config/ranger, all the files should be there if not you can run command 'ranger --copy-config=all' and it will put them there. The main one called apps.py has what you are looking for. Look for a method called ranger "CustomApplications" around line 175 you will find a statement 'def app_editor' in there is a statement that looks like this 'return self.either(c, 'vim', 'emacs', 'nano')' arrange your editors in the priority that you like. remember to backup the file before making code changes. Now on the off chance you got a very new version then the info your looking for will be in a file called rifle.conf. rifle.conf handles this all by env Variables, so you have to make sure that your $EDITOR variable carries vim as it's value. If not set it in your .bashrc or .bash_profile 'export EDITOR=vim' then it should pick it up.

I don't have apps.py but do have rifle.conf but don't see any $EDITOR variable there.
The file is not in ~/.config/ranger btw, but in ~/bin/ranger-master/ranger/defaults.
In .bashrc there's no $EDITOR variable either and I don't see any .bash_profile at all.

Offline

#1332 2012-04-24 20:30:27

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

Re: Ranger, a textbased filemanager

catch22 wrote:
jk121960 wrote:

Yes forgot sorry, your configuration is in ~/.config/ranger, all the files should be there if not you can run command 'ranger --copy-config=all' and it will put them there. The main one called apps.py has what you are looking for. Look for a method called ranger "CustomApplications" around line 175 you will find a statement 'def app_editor' in there is a statement that looks like this 'return self.either(c, 'vim', 'emacs', 'nano')' arrange your editors in the priority that you like. remember to backup the file before making code changes. Now on the off chance you got a very new version then the info your looking for will be in a file called rifle.conf. rifle.conf handles this all by env Variables, so you have to make sure that your $EDITOR variable carries vim as it's value. If not set it in your .bashrc or .bash_profile 'export EDITOR=vim' then it should pick it up.

I don't have apps.py but do have rifle.conf but don't see any $EDITOR variable there.
The file is not in ~/.config/ranger btw, but in ~/bin/ranger-master/ranger/defaults.
In .bashrc there's no $EDITOR variable either and I don't see any .bash_profile at all.


OK well you need to do 2 things migrate your config files per the instructions on the arch wiki

ranger --copy-config=all

and then in your .bashrc place the statement

export EDITOR=vim

I went back and looked and you are using gvim? I don't know if that will open any other way but seperately. One is GUI the other is ncurses. but change the above code to suit your taste. This will set that variable on boot.

--jerry

Last edited by jk121960 (2012-04-24 20:31:11)


Arch Awesome, Ranger & Vim the coding triple threat.

Offline

#1333 2012-04-25 18:34:09

catch22
Member
Registered: 2012-04-15
Posts: 10

Re: Ranger, a textbased filemanager

jk121960 wrote:

... migrate your config files per the instructions on the arch wiki

ranger --copy-config=all

I've tried this before and always get the message

bash: --copy-config=all: command not found

even when I cd to the ranger dir

ludo@tranqcrunch:~/bin/ranger-master/ranger$ ls
api           container  data      ext       gui          __init__.pyo
colorschemes  core       defaults  fsobject  __init__.py

EDIT: I tried this first:

ludo@tranqcrunch:~/bin/ranger-master/ranger$ ranger --copy-config=all
bash: ranger: command not found

Last edited by catch22 (2012-04-25 18:35:30)

Offline

#1334 2012-04-25 18:52:15

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

Re: Ranger, a textbased filemanager

edit: Ok, the stuff I wrote doesn't work, because now I saw that there is no ranger executable in your ~/bin/ranger-master/ranger (according to your ls command of which you posted the output). Still, looks like there's something really messed up on your system. Read the recommendations at the end of my post!

catch22 wrote:

I tried this first:

ludo@tranqcrunch:~/bin/ranger-master/ranger$ ranger --copy-config=all
bash: ranger: command not found

Ok, you have the ranger executable in a custom directory! This way your command only works if ranger is in the PATH. Do you know what the PATH is? Try this

echo $PATH

and you'll see all directories, which are in the PATH. Executables in those directories are found by the system. So if you execute

ranger

the ranger executable isn't found, because it's not in the PATH. You should add the following to your ~/.bashrc

PATH=$PATH:/home/YOUR_USERNAME/bin/ranger-master/ranger

or simply type

./ranger

being in the directory where the executable is stored.

I recommend to use ranger-git from the AUR or ranger from the repos, if you use those, you won't run into those issues!

Last edited by Army (2012-04-25 18:54:35)

Offline

#1335 2012-04-25 19:59:13

catch22
Member
Registered: 2012-04-15
Posts: 10

Re: Ranger, a textbased filemanager

Army wrote:

... now I saw that there is no ranger executable in your ~/bin/ranger-master/ranger (according to your ls command of which you posted the output). Still, looks like there's something really messed up on your system. Read the recommendations at the end of my post!
...snipped...
I recommend to use ranger-git from the AUR or ranger from the repos, if you use those, you won't run into those issues!

The AUR is for Arch-users, right? I'm on Crunchbang though :-)
The problem is not that ranger doesn't work, it does.
ranger.py is in this path: /home/ludo/bin/ranger-master and it's even in my autostart starting up in screen.

Problem is that I want vim (or gvim) to work as editor in ranger, and not nano.
On an older machine I have ranger working (the version without rifle) with vim no problem

Maybe I should indeed reinstall.
Is there a good command I can use to remove the old ranger-stuff? Something with "purge" I remember vaguely?
Or is simply deleting all ranger-related files I can find sufficient?

Thanks for all the help btw :-)

Offline

#1336 2012-04-25 20:47:35

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

Re: Ranger, a textbased filemanager

catch22 wrote:
Army wrote:

... now I saw that there is no ranger executable in your ~/bin/ranger-master/ranger (according to your ls command of which you posted the output). Still, looks like there's something really messed up on your system. Read the recommendations at the end of my post!
...snipped...
I recommend to use ranger-git from the AUR or ranger from the repos, if you use those, you won't run into those issues!

The AUR is for Arch-users, right? I'm on Crunchbang though :-)
The problem is not that ranger doesn't work, it does.
ranger.py is in this path: /home/ludo/bin/ranger-master and it's even in my autostart starting up in screen.

Problem is that I want vim (or gvim) to work as editor in ranger, and not nano.
On an older machine I have ranger working (the version without rifle) with vim no problem

Maybe I should indeed reinstall.
Is there a good command I can use to remove the old ranger-stuff? Something with "purge" I remember vaguely?
Or is simply deleting all ranger-related files I can find sufficient?

Thanks for all the help btw :-)

Cruchbang is debian based, so use aptitude to uinstall, then go to 'http://ranger.nongnu.org/download.html' and download the source and follow the instructions. If you have never done source it's not that difficult just folow the instructions. But I have to think that debian has a reasonable install, if not raid the ubuntu packages and grab a deb file from there. They will probably be newer then debian. If you follow the instructions on my earlier post, it should open vim.

this is in rifle.conf about line 81 or so probably sooner because I added a lot of lines to mine above that. This is looking for that variable that I told you to add to .bashrc if you add that variable this should work, if not then replace the line as follows

replace 
mime ^text,      label editor = "$EDITOR" -- "$@"
with 
mime ^text,      label editor = vim -- "$@"
or 
mime ^text,      label editor = vim "$@"

"example in file"
# Define the "editor" for text files as first action
mime ^text,      label editor = "$EDITOR" -- "$@"
ext xml|csv|tex, label editor = "$EDITOR" -- "$@"

try that maybe before the reinstall

--jerry


Arch Awesome, Ranger & Vim the coding triple threat.

Offline

#1337 2012-04-25 21:50:30

catch22
Member
Registered: 2012-04-15
Posts: 10

Re: Ranger, a textbased filemanager

jk121960 wrote:

... in rifle.conf ...

replace 
mime ^text,      label editor = "$EDITOR" -- "$@"
with 
mime ^text,      label editor = vim -- "$@"

Aha! This works :-)
Thanks again Jerry!

Offline

#1338 2012-04-25 21:51:26

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

Re: Ranger, a textbased filemanager

catch22 wrote:
jk121960 wrote:

... in rifle.conf ...

replace 
mime ^text,      label editor = "$EDITOR" -- "$@"
with 
mime ^text,      label editor = vim -- "$@"

Aha! This works :-)
Thanks again Jerry!


No problem, I'm glad we finally found it.

cheers

--jerry


Arch Awesome, Ranger & Vim the coding triple threat.

Offline

#1339 2012-04-28 10:46:13

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

Re: Ranger, a textbased filemanager

manolomartinez wrote:

Hi, right now I'm using the following line in rifle.conf to read pdfs in console (without X):

ext pdf, has pdftotext, terminal = pdftotext -- "$@" /tmp/visor.txt && vim /tmp/visor.txt

An ugly hack, I know. Could anyone share a better way?

Thanks,
Manolo

Try this:

ext pdf, has pdftotext, terminal = pdftotext -- "$@" - | vim -

Then you use standard output/input instead of a temporary file. wink

Offline

#1340 2012-05-21 13:38:57

notphunny
Member
Registered: 2011-05-25
Posts: 6

Re: Ranger, a textbased filemanager

hi all, ty hut for awesome file manager wink

Can someone help me with configuring ranger to open txt files in current vim remote server.
I have:
alias vimremote='vim --servername xx --remote-silent'
and when I'm in ranger and do :open_with vimremote %s ranger just opens new vim session hmm
insted of sending file to existing server.
same happens with :shell

Should I define some function in commands? I'm not good with python hmm

Offline

#1341 2012-05-22 10:28:16

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

Re: Ranger, a textbased filemanager

notphunny wrote:

hi all, ty hut for awesome file manager wink

Can someone help me with configuring ranger to open txt files in current vim remote server.
I have:
alias vimremote='vim --servername xx --remote-silent'
and when I'm in ranger and do :open_with vimremote %s ranger just opens new vim session hmm
insted of sending file to existing server.
same happens with :shell

Should I define some function in commands? I'm not good with python hmm

Ranger doesn't read your .bashrc, so it does not know about your aliases. You could make a shell script and put it somewhere in your $PATH, or add this to the file opening rules (either the apps.py or rifle.conf configuration file, depending on your ranger version)


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

Offline

#1342 2012-05-28 13:03:06

Veedrac
Member
Registered: 2011-07-19
Posts: 81

Re: Ranger, a textbased filemanager

Hello all!

I've recently discovered a way to make the root flag work with pipes, courtesy of a friend Ashley:

if 'r' in flags:
    action = "sudo su -c '{}'".format(action)

ranger.ext.shell_escape seems to be immune to working with this, but I've seen no problems with quotations in my very low-intensity testing so far.
EDIT: Probably best to implement proper escaping anyway, I think

If you're wondering, hut, if I've been implementing my suggestions - I've not had access to linux for a while, so sorry, not yet.

Last edited by Veedrac (2012-05-30 09:39:17)

Offline

#1343 2012-05-28 22:47:11

firecat53
Member
From: Sammamish, Wa
Registered: 2007-05-14
Posts: 1,448
Website

Re: Ranger, a textbased filemanager

So does anyone know why having ranger running inside a tmux session would prevent any shell commands in the tmux statusbar from running more than once? The other tmux statusbar commands work fine and update (host, time, etc.), but not any shell command output.
My .tmux.conf is here. Notice the line:

set -g status-right '#(cut -d " " -f 1,2,3 /proc/loadavg) "#H" #(date "+%H:%M %a %m-%d")'

The date and host update just fine, but the loadavg only prints once when the session is opened, but never updates again after that. And it works fine normally...unless ranger happens to be running in that session!

Very strange!
Thanks,
Scott

Last edited by firecat53 (2012-05-28 22:48:07)

Offline

#1344 2012-06-02 18:11:13

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

Re: Ranger, a textbased filemanager

Hut, Hi I am launching feh from ranger with various parameters using the lists you can create in "rifle" but ranger seems to capture keystrokes even in full screen mode. Is there away to let feh take over in full screen mode like vim does?

thanks

--jerry


example command "feh -FZx $1" would allow fullscreen with arrow navigation etc.

Last edited by jk121960 (2012-06-02 18:13:46)


Arch Awesome, Ranger & Vim the coding triple threat.

Offline

#1345 2012-06-02 18:22:07

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

Re: Ranger, a textbased filemanager

Veedrac wrote:

Hello all!

I've recently discovered a way to make the root flag work with pipes, courtesy of a friend Ashley:

if 'r' in flags:
    action = "sudo su -c '{}'".format(action)

Cool, thanks. I'll add this after I test it some more.

Veedrac wrote:

EDIT: Probably best to implement proper escaping anyway, I think

What do you mean?

jk121960 wrote:

Hut, Hi I am launching feh from ranger with various parameters using the lists you can create in "rifle" but ranger seems to capture keystrokes even in full screen mode. Is there away to let feh take over in full screen mode like vim does?

thanks

--jerry


example command "feh -FZx $1" would allow fullscreen with arrow navigation etc.

When putting "ext jpg = feh -FZx $1" at the top of rifle.conf and pressing enter on a jpg file, feh is focused and receives my keystrokes.


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

Offline

#1346 2012-06-02 18:38:39

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

Re: Ranger, a textbased filemanager

jk121960 wrote:

Hut, Hi I am launching feh from ranger with various parameters using the lists you can create in "rifle" but ranger seems to capture keystrokes even in full screen mode. Is there away to let feh take over in full screen mode like vim does?

thanks

--jerry


example command "feh -FZx $1" would allow fullscreen with arrow navigation etc.

When putting "ext jpg = feh -FZx $1" at the top of rifle.conf and pressing enter on a jpg file, feh is focused and receives my keystrokes.

Hi I tried this

ext jpg|png|bmp|gif|jpeg = feh -FZx $1

and I can zoom but I don't get to navigate to other images etc. Also I would like to put it in the "open" list of apps to open with that appears when you use "r"

thanks

--jerry


Arch Awesome, Ranger & Vim the coding triple threat.

Offline

#1347 2012-06-02 19:52:09

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

Re: Ranger, a textbased filemanager

jk121960 wrote:

Hi I tried this

ext jpg|png|bmp|gif|jpeg = feh -FZx $1

and I can zoom but I don't get to navigate to other images etc.

You need to tell feh to open all image files and start viewing at $1.
Maybe something like this:

ext jpg|png|bmp|gif|jpeg, X, flag f = feh -FZx *.bmp *.jpg *.png *.gif *.jpeg --start-at "$(basename "$1")"

I also added "flag f" so you can continue to use ranger while feh is open.

jk121960 wrote:

Also I would like to put it in the "open" list of apps to open with that appears when you use "r"

that's done automatically if you put it into rifle.conf

Last edited by hut (2012-06-02 19:55:22)


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

Offline

#1348 2012-06-02 21:32:13

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

Re: Ranger, a textbased filemanager

Brilliant worked like a charm, that's what I needed thanks very much again.

All the best.

--jerry


Arch Awesome, Ranger & Vim the coding triple threat.

Offline

#1349 2012-06-02 23:34:12

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

Re: Ranger, a textbased filemanager

jk121960 wrote:

Brilliant worked like a charm, that's what I needed thanks very much again.

All the best.

--jerry


The one caveat I found but fixed, the recursive wasn't functional but I found if I shortened the command to:

ext JPG|jpg|PNG|png|BMP|bmp|GIF|gif|JPEG|jpeg, X, flag f = feh -FZxr --magick-timeout -1 .

added the --magick-timeout -1 to disable image magick conversion attempts when it hits an video or image it can't handle and just put a "." for this directory it works but you have to have an image to start it unless you put it in a map command. Also some camera's have uppercase ext's #$@$##@ what's that about. I suppose I could write a script to fix it, anyway the recursive works this way. Cool thanks again

--jerry


Arch Awesome, Ranger & Vim the coding triple threat.

Offline

#1350 2012-06-13 02:51:00

zwa
Member
Registered: 2005-12-05
Posts: 72

Re: Ranger, a textbased filemanager

I post just to express my utter contempt of programming  language based config files. Plain text written are ok though. smile

Offline

Board footer

Powered by FluxBB