You are not logged in.
hya hut
im working on creating another ranger color scheme to share with the community. is there a way that the current line (the line in the current position you are) will not change colors by file type but always stay a user defined color?
Also is there any documentation regarding the color schemes (preferably one that understandable for non programmers) ?
thx
zeltak
Last edited by zeltak (2011-01-08 03:38:37)
Offline
UPDATE: appears that xcode has the gnu compiler built in... i think.
looking for tips on installing ranger for someone on a Mac.
Xcode on Mac is installed and so is python 2.6.x
Done a bit of searching though asking here.
1- download stable ranger tar.gz
2- extract on mac system
3- xcode requires just, "make" i read about.
YET, thinking that installing GNU compiler so I can do the ./configure, make thing is required/best.
SO, use mac ports to install GNU compiler? Which compiler package? (can likely figure that out though)
OR, can i take my prebuild (via AUR) ranger-git package, move it to Mac and install somehow? (no likely I bet)
Thanks for help, sorry i haven't figured it out. crazy busy.
Last edited by yvonney (2011-01-08 05:51:24)
Offline
hya hut
im working on creating another ranger color scheme to share with the community. is there a way that the current line (the line in the current position you are) will not change colors by file type but always stay a user defined color?
Also is there any documentation regarding the color schemes (preferably one that understandable for non programmers) ?
thx
zeltak
like
if context.in_browser and context.main_column and context.selected:
fg = red
bg = blue
somewhere at the end of the function?
It's all python code so it has to fit into the flow of the function but if you just want to override something its safest to put it at the end. (before the return statement!)
There is documentation at doc/colorschemes.txt
You could have also browsed rangers pydoc pages, e.g.:
http://ranger.nongnu.org/pydoc/ranger.g … cheme.html
And I suppose you've already looked at the default colorscheme.
Basically It's a function which has to return 3 values, foreground color, background color and attribute (like bold, etc). And you have this context object with tons of attributes which are either true or false depending on the place you're currently at in the code.
If ranger requests the color of the current line, it sets context.in_browser and context.main_column and context.selected (and others) to True. You can check for these attributes and set the color accordingly.
UPDATE: appears that xcode has the gnu compiler built in... i think.
looking for tips on installing ranger for someone on a Mac.
Xcode on Mac is installed and so is python 2.6.x
Done a bit of searching though asking here.
1- download stable ranger tar.gz
2- extract on mac system
3- xcode requires just, "make" i read about.YET, thinking that installing GNU compiler so I can do the ./configure, make thing is required/best.
SO, use mac ports to install GNU compiler? Which compiler package? (can likely figure that out though)
OR, can i take my prebuild (via AUR) ranger-git package, move it to Mac and install somehow? (no likely I bet)Thanks for help, sorry i haven't figured it out. crazy busy.
In fact you can skip step 3. Just extract and run ranger, for example with "python /path/to/ranger.py". You can make a bash alias for that. Ranger needs no GNU compiler, just python.
If you want to install it, "make install" should work, with root privileges.
"hut_" or "h00th00t" in irc.freenode.net #archlinux
Ranger Mailing List: https://lists.nongnu.org/mailman/listinfo/ranger-users
Offline
Hi Hut
Thanks for the answer, i really appreciate the detailed answer but as i said i am no programmer (far from it....) and have zero python understanding. if thats a requirement to create a color-scheme i guess ill just raise the white flag
i did try what you suggested:
if context.in_browser and context.main_column and context.selected:
fg = red
bg = blue
and put it at the end (before the return) but always get a error messages. i tried it in different configurations (deleting the original if context browser etc) and different themes but always with no success...
thanks again
Zeltak
Last edited by zeltak (2011-01-08 15:27:35)
Offline
When I use the :shell command, I immediately get back to ranger once the command is executed. If there is any error with the program I executed I won't see the error message because it's gone by too fast.
It's probably not a big deal to make a "press any key to continue"-patch for myself but maybe I'm just not using the most elegant approach for executing external commands and I'd like to hear from others how they execute external commands.
And is there a way to mark files with wildcards or regular expressions?
Offline
When I use the :shell command, I immediately get back to ranger once the command is executed. If there is any error with the program I executed I won't see the error message because it's gone by too fast.
It's probably not a big deal to make a "press any key to continue"-patch for myself but maybe I'm just not using the most elegant approach for executing external commands and I'd like to hear from others how they execute external commands.And is there a way to mark files with wildcards or regular expressions?
Hi, let me refer you to chapter 3.2 of the manual, type 32? to get there. It's a list of all commands, including one to mark files by regular expressions. It also explains that the shell-command takes additional arguments, called flags. Flags are explained in chapter 2.5 (25?). Flags modify the behaviour of programs and the "w" flag is probably the one you're looking for. Try :shell -w ls
"hut_" or "h00th00t" in irc.freenode.net #archlinux
Ranger Mailing List: https://lists.nongnu.org/mailman/listinfo/ranger-users
Offline
Wow. Nice. Thank you very much
Offline
Offline
Can you make a screenshot? I got no 256color terminal^^
Also consider adding it to the wiki: http://ourproject.org/moin/projects/ranger
"hut_" or "h00th00t" in irc.freenode.net #archlinux
Ranger Mailing List: https://lists.nongnu.org/mailman/listinfo/ranger-users
Offline
Can you make a screenshot? I got no 256color terminal^^
Also consider adding it to the wiki: http://ourproject.org/moin/projects/ranger
Done.
Btw, is it possible to integrate ranger with autojump?
At any rate, a great piece of software it is! Keep it up
Offline
Can I use "map('ć', fm.move(down=1)" and other letters like ščž for a browser direction keys? In example, for javascript "\u0107" corresponds to "ć".
Offline
Can I use "map('ć', fm.move(down=1)" and other letters like ščž for a browser direction keys? In example, for javascript "\u0107" corresponds to "ć".
You should be able to. Have you tried?
Make sure to write this at the top of the file:
# -*- coding: utf-8 -*-
"hut_" or "h00th00t" in irc.freenode.net #archlinux
Ranger Mailing List: https://lists.nongnu.org/mailman/listinfo/ranger-users
Offline
I added 'map('ć', fm.move(down=1))' in 'keys.py' under the "browser context" part.
I also have the '# -*- coding: utf-8 -*-' in the first line.
It won't work that way. Do I need to use an escape sequence?
Last edited by archman-cro (2011-01-23 21:53:16)
Offline
The new Thunar has some problems and I want to switch to Ranger as my default FM. So I have some questions if Ranger can:
1. to manage Trash (delete into, recover from or empty Trash) ?
2. to manage removable devices (mount, unmount) ?
Offline
I added 'map('ć', fm.move(down=1))' in 'keys.py' under the "browser context" part.
I also have the '# -*- coding: utf-8 -*-' in the first line.
It won't work that way. Do I need to use an escape sequence?
I think it's most likely because of python3.
Sorry folks, if you want international hotkeys with ranger, it seems like you need to run it with python2. I really have no time to fix this atm.
The new Thunar has some problems and I want to switch to Ranger as my default FM. So I have some questions if Ranger can:
1. to manage Trash (delete into, recover from or empty Trash) ?
2. to manage removable devices (mount, unmount) ?
Hi botzoboy. Ranger has no such features built in by default but you can add them yourself.
Maybe take some hints from here: https://wiki.archlinux.org/index.php/Ranger
"hut_" or "h00th00t" in irc.freenode.net #archlinux
Ranger Mailing List: https://lists.nongnu.org/mailman/listinfo/ranger-users
Offline
Thanks hut!!!
Solved now with Trash, remain to figure out how to manage removable devices.
Offline
Thanks hut!!!
Solved now with Trash, remain to figure out how to manage removable devices.
I do this with /etc/fstab and bindings for "shell mount %f" and "shell umount %f".
"hut_" or "h00th00t" in irc.freenode.net #archlinux
Ranger Mailing List: https://lists.nongnu.org/mailman/listinfo/ranger-users
Offline
Can't find Ranger inside python2.6, the folder from wiki isn't exist and replaced to python2.7. So where can i found a 'template'?
You can find it inside python3.1/site-packages/
Offline
aunpack is not working. when i open an archive it show me the unpacking process in the pager and stay like this until I press q key but the archive is not unpacked.
:shell aunpack f% is working
Offline
aunpack is not working. when i open an archive it show me the unpacking process in the pager and stay like this until I press q key but the archive is not unpacked.
:shell aunpack f% is working
it only lists the content.
try 1<enter> to unpack and type 24? to learn what this means
"hut_" or "h00th00t" in irc.freenode.net #archlinux
Ranger Mailing List: https://lists.nongnu.org/mailman/listinfo/ranger-users
Offline
Thank you hut!!
Regarding (un)mount removable devices I use udisks with this script. I think it will be a nice feature to include this in Ranger.
All the best an thanks again.
Last edited by botzoboy (2011-01-29 17:05:15)
Offline
Hello,
Thank you for this massive filemanager, it is the first fm which fits to my needs.
What is better as a complete python api to customize the ranger :-)
So i have no questions. Only a code snippet for the people who wants.
It adds music files to mpc if they are in the library
import statements
import os.path
body
# non trivial adding to mpc
def app_ncmpcpp(self, c):
mpc_args = []
mpd_root = "/media/win3/soundconsum/"
# strip mpd_root from filepaths
for f in c.files:
real_path = os.path.realpath(str(f))
if real_path.startswith(mpd_root) == True:
mpc_args.append(real_path.replace(mpd_root, ''))
if len(mpc_args) == 0:
return tup('mpc')
return tup('mpc', 'add') + tuple(mpc_args)
later in the app_default function you have to add
if f.audio:
return self.app_ncmpcpp(c)
Be sure to reindent the code after pasting and change mpd_root to your needs!!
Last edited by sighter (2011-02-07 13:53:13)
Offline
Thanks hut!!!
Solved now with Trash, remain to figure out how to manage removable devices.
Though the solution on the wiki page works as a trash for ranger the files won't show up in Thunar's trash. I solved this as follows but have not tested it with exotic filenames:
# move to trash
@map('DD')
def movetotrash(arg):
trash_dir = "/home/fdeboer/.local/share/Trash"
selection = arg.fm.env.get_selection()
import datetime
for item in selection:
file = os.path.split(str(item))[1]
with open(os.path.join(trash_dir,"info",file +".trashinfo"),'w') as info:
info.write("[Trash Info]\n")
info.write("Path="+str(item)+"\n")
dTime = datetime.datetime.now().strftime("%Y-%m-%dT%H:%M:%S")
info.write("DeletionDate="+dTime+"\n")
arg.fm.run(['mv', '-t', os.path.join(trash_dir,"files")] + [str(f) for f in selection])
This creates a file.trashinfo file which Thunar uses to show the original location and deletion time and allows Thunar to undelete.
Offline