You are not logged in.
Ok thanks got it.
--jerry
Arch Awesome, Ranger & Vim the coding triple threat.
Offline
Good morning Hut, I was wondering is there a way to marka group of files and run a command and have them all open in there related editor.application ? For example VIm.
thanks
--jerry
Arch Awesome, Ranger & Vim the coding triple threat.
Offline
In the last few days I have come across some more "issues".
The script Hut linked me to, to open all the images in a directory with sxiv, doesn't work if there are other files than image files in the directory. My Downloads directory also hosts a few folders, PDF files and some iso's and when I open an image it only loads that one and not the other images that are in the directory. When I open the Downloads/Backgrounds directory, which hosts only image files, it works as expected. Can this be fixed?
Also, .wmv files still won't get recognized. Even if I add the corect mime-type.
Lastly, it's not possible to select files in one instance of ranger and then paste them into another, is it? If not, can someone elaborate on how the tab system works? I looked up the keybindings but nothing happens when I try them...
If you can't sit by a cozy fire with your code in hand enjoying its simplicity and clarity, it needs more work. --Carlos Torres
Offline
In the last few days I have come across some more "issues".
The script Hut linked me to, to open all the images in a directory with sxiv, doesn't work if there are other files than image files in the directory. My Downloads directory also hosts a few folders, PDF files and some iso's and when I open an image it only loads that one and not the other images that are in the directory. When I open the Downloads/Backgrounds directory, which hosts only image files, it works as expected. Can this be fixed?
Also, .wmv files still won't get recognized. Even if I add the corect mime-type.
Lastly, it's not possible to select files in one instance of ranger and then paste them into another, is it? If not, can someone elaborate on how the tab system works? I looked up the keybindings but nothing happens when I try them...
I process my images with feh and not with sxiv, fi I remember right that is what you were using. I don't know how to fix that probelm with sxiv but I do with feh. Hut helped me with a reference in the rifle.conf for directory viewing of images.
ext JPG|jpg|PNG|png|BMP|bmp|GIF|gif|JPEG|jpeg, X, flag f = feh -FZxr --magick-timeout -1 .
this will give you a fullscreen feh and not a window to the side, you can navigate images using arrows and 'z' is random, it has a flag in there for imagemagick that stops it from attempting to convert everything, I found it stopped a lot of them problems with feh. Check it out, I like it a lot better then sxiv. Sorry I don't know the cure for sxiv.
I don't use tabs in ranger and they probably rock but between the book marks and history moving back and forth between directories is not painful. You can make a book mark by keys m(some other key) then to go there tick as in ' (some other key). that should help you get around a bit quicker, also Shift-h walks you back and going forward on any directory remembers the last path from that point.
hope that helps
--jerry
PS On the wmv's I got nothing, they just work on my machine.
Arch Awesome, Ranger & Vim the coding triple threat.
Offline
Tabs work like this: "alt+number" to create/switch to a tab, "tab" and "shift+tab" to move to the next/previous tab, "q" to close a tab.
If you use xterm, you need to add this line to your options.py to use the alt key:
xterm_alt_key = True
To pass "copied files" from one ranger instance to another, you can use the :save_copy_buffer and :load_copy_buffer commands.
About wmvs: what does 'grep wmv /etc/mime.types' say?
About sxiv: Is it possible that the extensions are uppercase when the script fails?
"hut_" or "h00th00t" in irc.freenode.net #archlinux
Ranger Mailing List: https://lists.nongnu.org/mailman/listinfo/ranger-users
Offline
Tabs work like this: "alt+number" to create/switch to a tab, "tab" and "shift+tab" to move to the next/previous tab, "q" to close a tab.
Okay. I got confused then since my config also shows Control something. I already use Alt+number for launching apps so I'll edit those shortcuts.
EDIT: Control+n creates a new tab, Control+w and q both close one. Tab and Shift+tab both work too, but Alt-number (which I changed to Control+number) doesn't open a tab nor switches to one. It just shows the number in the top right corner of ranger. Am I just being really stupid here?
To pass "copied files" from one ranger instance to another, you can use the :save_copy_buffer and :load_copy_buffer commands.
Not exactly sure where to put these, but I'll look into it!
About wmvs: what does 'grep wmv /etc/mime.types' say?
That the file doesn't exist
About sxiv: Is it possible that the extensions are uppercase when the script fails?
Yep! I did edit the rifle script to also use sxiv for .JPG though. Does that have anything to do with it somehow?
Last edited by Unia (2012-06-22 22:40:39)
If you can't sit by a cozy fire with your code in hand enjoying its simplicity and clarity, it needs more work. --Carlos Torres
Offline
hut wrote:Tabs work like this: "alt+number" to create/switch to a tab, "tab" and "shift+tab" to move to the next/previous tab, "q" to close a tab.
Okay. I got confused then since my config also shows Control something. I already use Alt+number for launching apps so I'll edit those shortcuts.
EDIT: Control+n creates a new tab, Control+w and q both close one. Tab and Shift+tab both work too, but Alt-number (which I changed to Control+number) doesn't open a tab nor switches to one. It just shows the number in the top right corner of ranger. Am I just being really stupid here?
Thats a limitation of terminals. You can use CTRL (almost) only together with letters and not with SHIFT but with ALT. Use the program at doc/print_keys.py in rangers source to see how certain keys behave in a terminal.
hut wrote:To pass "copied files" from one ranger instance to another, you can use the :save_copy_buffer and :load_copy_buffer commands.
Not exactly sure where to put these, but I'll look into it!
In ranger instance 1, navigate to some file and type:
yy:save_copy_buffer<enter>
In ranger instance 2, type:
:load_copy_buffer<enter>
now both instances got the same file copied. To do something with this file, you could use %c in the console, e.g. "!cp -va %c ./"
hut wrote:About wmvs: what does 'grep wmv /etc/mime.types' say?
That the file doesn't exist
oh well, just add another entry in rifle.conf for wmv files that matches the extension, not mime type
hut wrote:About sxiv: Is it possible that the extensions are uppercase when the script fails?
Yep! I did edit the rifle script to also use sxiv for .JPG though. Does that have anything to do with it somehow?
Try replacing "-regex" with "-iregex" in the script and see if it fixes things.
"hut_" or "h00th00t" in irc.freenode.net #archlinux
Ranger Mailing List: https://lists.nongnu.org/mailman/listinfo/ranger-users
Offline
Thanks for all your help Hut! I have rarely seen a dev who helps people this much and so fast, so props to you
The sxiv issue is fixed now and so is the copy/pasting between different instances. I didn't know about that Control key system with terminals so I'll have to look into that and see if I can possibly set those tab bindings to other keys.
The only thing that still won't work is getting wmv recognized as a video file. It opens just fine in mplayer when pressing Enter, it's just not getting the color in Ranger that other video files do get. I have now added the following to rifle.conf but that doesn't help either:
ext wmv, has mplayer, X, flag f = mplayer -- "$@"
EDIT: You can get the file /etc/mime.types by installing mime-types. I'll look into this issue now and hope to get it resolved!
EDIT2: Installing mime-types fixes it! The wmv file now gets the correct color
Last edited by Unia (2012-06-23 10:40:08)
If you can't sit by a cozy fire with your code in hand enjoying its simplicity and clarity, it needs more work. --Carlos Torres
Offline
Hut, there's something wrong with ranger. On the bottom right, there's the the scroll percentage or "Top", "Bot" or "All". Right now instead of "Top" it shows "ToT", instead of "Bot" it shows "BoB", instead of "All" it shows "AlA" and instead of e.g. "50%" it shows "505". You see the pattern, right?
In case that's relevant, I use ranger in rxvt-unicode.
Last edited by Army (2012-06-24 16:02:13)
Offline
Hi Hut, I am writing a command for Ranger to open all marked files in vim, I found how to get the marked files in the current directory but I can't seem to find a nethod to get all marked file? Does one exist?
thanks
--jerry
Arch Awesome, Ranger & Vim the coding triple threat.
Offline
Hi Hut, I am writing a command for Ranger to open all marked files in vim, I found how to get the marked files in the current directory but I can't seem to find a nethod to get all marked file? Does one exist?
thanks
--jerry
Hi hut me again,
I wrote the command here it is, there is one thing i could use help with:
class loadmarked(Command):
def execute(self):
""" load selected files in to seperate vim windows """
cwd = self.fm.env.cwd;
marked_files = cwd.get_selection();
for f in marked_files:
os.system('lxterminal -e vim '+f.path)
This is grabbing all "space bar selected" files.
I like Sakura for a terminal but when launched from here, the command loads the first file in vim and then won't load the second util I close the first. If I load ranger instead into lxterminal it loads all the selected files into vim like I want. Is there away to modify the command to make sure it allows each request to return?
Also I still can't find the command the collect "all selected files" in different directories this only works for the CWD.
thanks for all your help.
--jerry
Arch Awesome, Ranger & Vim the coding triple threat.
Offline
jk121960 wrote:Hi Hut, I am writing a command for Ranger to open all marked files in vim, I found how to get the marked files in the current directory but I can't seem to find a nethod to get all marked file? Does one exist?
thanks
--jerry
Hi hut me again,
I wrote the command here it is, there is one thing i could use help with:
class loadmarked(Command): def execute(self): """ load selected files in to seperate vim windows """ cwd = self.fm.env.cwd; marked_files = cwd.get_selection(); for f in marked_files: os.system('lxterminal -e vim '+f.path)
This is grabbing all "space bar selected" files.
I like Sakura for a terminal but when launched from here, the command loads the first file in vim and then won't load the second util I close the first. If I load ranger instead into lxterminal it loads all the selected files into vim like I want. Is there away to modify the command to make sure it allows each request to return?Also I still can't find the command the collect "all selected files" in different directories this only works for the CWD.
thanks for all your help.
--jerry
Selection is supposed to be directory-wise. Of course you could hack in a way to get all selected files from all directories but I would not recommend it. Instead, I recommend using the copy buffer for your task:
map x shell setsid xterm -e %c
Or by using the variable fm.env.copy in a command.
To add and remove files from the copy buffer, select them and use one of the following commands that I put here for a quick reference:
map yy copy # overwrite the copy buffer
map uy uncut # clear the copy buffer
map ya copy mode=add # add files to the copy buffer
map yr copy mode=remove # add files to the copy buffer
"hut_" or "h00th00t" in irc.freenode.net #archlinux
Ranger Mailing List: https://lists.nongnu.org/mailman/listinfo/ranger-users
Offline
I will check out these commands but I notice that the selection of files at least while that instance of ranger is running do get persisted. In other words if I select a couple of files then change directories select a couple more and go back to the original directory the selection is till there. Where is the information stored for that persistence?
thanks for all your help.
--jerry
Arch Awesome, Ranger & Vim the coding triple threat.
Offline
I will check out these commands but I notice that the selection of files at least while that instance of ranger is running do get persisted. In other words if I select a couple of files then change directories select a couple more and go back to the original directory the selection is till there. Where is the information stored for that persistence?
thanks for all your help.
--jerry
There is no single list. You'd have to iterate over every directory object and collect all the selected files. But be aware that directories get garbage-collected when not used after a while and you lose that information.
all_selected = []
for path, directory in self.fm.env.directories.items():
all_selected.extend(directory.get_selection())
Btw, a quick way to reset all selections in all directories is pressing ctrl+R
Hut, there's something wrong with ranger. On the bottom right, there's the the scroll percentage or "Top", "Bot" or "All". Right now instead of "Top" it shows "ToT", instead of "Bot" it shows "BoB", instead of "All" it shows "AlA" and instead of e.g. "50%" it shows "505". You see the pattern, right?
In case that's relevant, I use ranger in rxvt-unicode.
Fixed, thank you
Last edited by hut (2012-06-28 14:26:24)
"hut_" or "h00th00t" in irc.freenode.net #archlinux
Ranger Mailing List: https://lists.nongnu.org/mailman/listinfo/ranger-users
Offline
Cool on all counts thanks again for creating this amazing. I have a hard time deciding if I like this vim or awesome the most. They just all fit together in an amazing way, like they were made for each other. One thing tho0ugh since my python is not of guru status as yours, when I call each instance of "terminal -> Vim" I have that problem with sakura that it is not letting go of the process to let the next vim load, when I close the first vim the next one opens, although lxterminal does it fine. Is there a better way to call the process, I have tried "system" and "subprocess" but my knowledge of "subprocess" is limited as it is new to python for a few versions. Or possibly some other call I don't know.
thanks not meaning to tax you my apologies.
--jerry
Arch Awesome, Ranger & Vim the coding triple threat.
Offline
I don't know about sakura. Do you want to open up 10 terminals with 10 instances of vim?
anyway, ranger/core/runner.py defines a class for simple program running:
self.fm.run(arglist, flags="d")
self.fm.run(["xterm", "-e", "vim", fileobject.path], flags="d")
self.fm.run(["xterm", "-e", "vim"] + [fileobject.path for fileobject in list_of_filenames], flags="d")
flag "d" is for detaching the process. other flags are explained in the man page
"hut_" or "h00th00t" in irc.freenode.net #archlinux
Ranger Mailing List: https://lists.nongnu.org/mailman/listinfo/ranger-users
Offline
Cool that looks like it is what I need, yes I do open separate instances of vim rather then loading all in on instance. Awesome and the ability to configure it makes working between multiple windows amazing. I also got a vim command for copy and paste to the X clipboard from another guys .vimrc and so that data sharing between instances is covered, everything else I handle with Awesome. I think there had to be a formal command to release the process. I will let you know how it goes and thanks for all your help once again.
--jerry
vmap <F9> :!xclip -f -sel clip<CR> " copy text to xorg server clipboard
map <F10> :-1r !xclip -o -sel clip<CR> " paste text from xserv clip to vim
Arch Awesome, Ranger & Vim the coding triple threat.
Offline
I don't know about sakura. Do you want to open up 10 terminals with 10 instances of vim?
anyway, ranger/core/runner.py defines a class for simple program running:
self.fm.run(arglist, flags="d") self.fm.run(["xterm", "-e", "vim", fileobject.path], flags="d") self.fm.run(["xterm", "-e", "vim"] + [fileobject.path for fileobject in list_of_filenames], flags="d")
flag "d" is for detaching the process. other flags are explained in the man page
Very Cool worked like a charm, used version 2.
thanks
--jerry
Arch Awesome, Ranger & Vim the coding triple threat.
Offline
Here's a few primitive ideas on some issues I've faced. Some would probably make things more complicated if implemented, but here they are.
1)
I guess some people miss the apps.py entry which opens all image files in sxiv and starts at the current file. Here's a script for that:
Sorry being the millionth person to bring this up. My problem is that external scripts cannot be a aware of the way in which the files are currently sorted in ranger.
Moreover, it is quite a pain to accurately imitate the work you've done for the 'natural' sorting with `find` and `sort`.
I've yet to look more into it but maybe the apps.py functionality could be rewritten if rifle.conf was able to incorporate more environment variables (such as a variable that returns a list of all the files, but sorted, without having to mark them first).
Maybe there's more such variables that would be useful to people.
2) Password protected .rar files. ranger hangs while waiting for user input when trying to preview them. There doesn't seem to be a straightforward way of only checking whether they're protected before attempting to open them. This is not really ranger's fault, but I can't ^C out of this situation. I have to actually kill it.
On the same matter, although probably harder and sillier to code, backgrounding previews (and possibly killing these threads when the user is no longer highlighting that file) could be a workaround to this as well as a way of smoother navigation.
3) scope.sh: The default:
mimetype=$(file --mime-type -Lb "$path")
does not work right for .mkv files (and possibly others?). More specifically it returns "application/octet-stream".
What worked fine for me is:
mimetype=$(mimetype -b "$path")
extra/perl-file-mimeinfo could be added as an optional dependency and the existence of `mimeinfo` could be checked in scope.sh, making `file` the fallback.
Last edited by MadCatMk2 (2012-06-28 20:00:21)
Offline
Here I am with yet another small question.. How can I get Ranger to see .msi and .exe files as executables?
If you can't sit by a cozy fire with your code in hand enjoying its simplicity and clarity, it needs more work. --Carlos Torres
Offline
@Unia:
I never tried it, but you can first try to set "showexec" option as mount option for your drive. Most browsers and command-line tools should now see those files as executable.
I really love ranger. Definitely one of the most powerful filebrowser I've used so far.
Still, some ideas / questions:
Call of shell user functions
os.system() and built-in "shell" function directly call sh, so they cannot call any user function in *rc files.
Is there any convenient way to do this ?
Fork to background
If I start ranger from a terminal, applications are properly forked to background.
But if I start ranger "directly" (e.g. lxterminal -e ranger), applications will close on ranger exit.
Any clue?
Offline
@Unia:
I never tried it, but you can first try to set "showexec" option as mount option for your drive. Most browsers and command-line tools should now see those files as executable.
Thanks, but these .exe files are on my home partition. ls lists them fine as executable, just Ranger doesn't.
If you can't sit by a cozy fire with your code in hand enjoying its simplicity and clarity, it needs more work. --Carlos Torres
Offline
jk121960 wrote:jk121960 wrote:Hi Hut, I am writing a command for Ranger to open all marked files in vim, I found how to get the marked files in the current directory but I can't seem to find a nethod to get all marked file? Does one exist?
thanks
--jerry
Hi hut me again,
I wrote the command here it is, there is one thing i could use help with:
class loadmarked(Command): def execute(self): """ load selected files in to seperate vim windows """ cwd = self.fm.env.cwd; marked_files = cwd.get_selection(); for f in marked_files: os.system('lxterminal -e vim '+f.path)
This is grabbing all "space bar selected" files.
I like Sakura for a terminal but when launched from here, the command loads the first file in vim and then won't load the second util I close the first. If I load ranger instead into lxterminal it loads all the selected files into vim like I want. Is there away to modify the command to make sure it allows each request to return?Also I still can't find the command the collect "all selected files" in different directories this only works for the CWD.
thanks for all your help.
--jerry
Selection is supposed to be directory-wise. Of course you could hack in a way to get all selected files from all directories but I would not recommend it. Instead, I recommend using the copy buffer for your task:
map x shell setsid xterm -e %c
Or by using the variable fm.env.copy in a command.
To add and remove files from the copy buffer, select them and use one of the following commands that I put here for a quick reference:
map yy copy # overwrite the copy buffer map uy uncut # clear the copy buffer map ya copy mode=add # add files to the copy buffer map yr copy mode=remove # add files to the copy buffer
OK took a bit to circle back but here is the finished command.
class loadmarked(Command):
def execute(self):
""" Extract copied files to current directory """
copied_files = tuple(self.fm.env.copy)
cwd = self.fm.env.cwd
if copied_files:
marked_files = copied_files
else:
marked_files = cwd.get_selection()
for f in marked_files:
os.system('lxterminal -e vim '+f.path)
I am specifically loading lxterminal, even with the ranger's run command Sakura would open all the right files but when I would close Ranger all would close. So it isn't detaching properly. Lxterminal on the other hand works perfectly. So if you are only in one directory you can "space bar" select the files, if you need to add files from other directory "space bar" then use "yy" then go to the next directory and select files by using "ya". Then run the command :loadmarked and all the files will open in seperate vim's. You can then close ranger.
I hope someone else can use it it saves a lot of time for me.
Hut thanks again for all your help.
--jerry
Arch Awesome, Ranger & Vim the coding triple threat.
Offline
Hi! One of the coolest features I found in ranger is the "f" command (quick navigation)... though I was wondering if it was possible to instead of just jumping, start hiding the files that doesn't match the query (something like a fuzzy search), it seems to me that is a bit clearer than insert characters and suddenly jump.
DId I explain myself?
PS.- Great job, this little app rocks
Geeks & Linux Atelier
An eye for an eye ... ends in making everybody blind -- Mahatma Gandhi
dotfiles
Offline
Hi! One of the coolest features I found in ranger is the "f" command (quick navigation)... though I was wondering if it was possible to instead of just jumping, start hiding the files that doesn't match the query (something like a fuzzy search), it seems to me that is a bit clearer than insert characters and suddenly jump.
DId I explain myself?
PS.- Great job, this little app rocks
You're looking for :filter / 'zf'
'/' and then 'n' is more practical for me in most cases though
Last edited by MadCatMk2 (2012-07-08 21:20:51)
Offline