You are not logged in.
@jk121960:
I cannot reproduce the issue here.
Have you tried to run ranger with the --clean option? It permits to ignore your configuration, to see if you have this problem with the default config too.
Offline
Hi and thanks, I will give that a try, I didn't know of this option. I will post back what I find
--jerry
Arch Awesome, Ranger & Vim the coding triple threat.
Offline
@PotatoesMaster I did the --clean option and weirdly the native OO applications like '.ods' and '.odt' started working but not the MS extensions like doc and docx etc. Hopefully this gives a clue, cause I got nothing, Still if I use the 'r' command and type libreoffice they all work.
thanks for anything that comes to mind.
--jerry
Last edited by jk121960 (2012-10-07 08:23:26)
Arch Awesome, Ranger & Vim the coding triple threat.
Offline
@jk121960, @hut:
There is a problem in the default rifle.conf.
The line
ext docx?, has libreoffice, X, flag f = libreoffice -- "$@"
should be
ext docx?, has libreoffice, X, flag f = libreoffice "$@"
Offline
@jk121960, @hut:
There is a problem in the default rifle.conf.The line
ext docx?, has libreoffice, X, flag f = libreoffice -- "$@"
should be
ext docx?, has libreoffice, X, flag f = libreoffice "$@"
OK thanks that worked, it has always been that syntax in this version, I thought that was for parsing of arguments and others are still done that way. Anyway that worked and that is whats important.
thanks again I appreciate it.
--jerry
Arch Awesome, Ranger & Vim the coding triple threat.
Offline
ryzion wrote:Is there a way to quickly remove all filters from a list?
Could you explain, what exactly do you want to do?
Well lets say I've filtered my folder for "foo". What is the fastest way to get back to my unfiltered folder?
E: zf<enter> should be the quickest way, right?
Last edited by ryzion (2012-10-09 10:41:34)
Offline
loop wrote:ryzion wrote:Is there a way to quickly remove all filters from a list?
Could you explain, what exactly do you want to do?
Well lets say I've filtered my folder for "foo". What is the fastest way to get back to my unfiltered folder?
Use empty filter command
:filter<enter>
--jerry
Arch Awesome, Ranger & Vim the coding triple threat.
Offline
Thanks, I've just discovered zf<enter>
Offline
Hello!
I rename some files with the "rrname" command from my commands.py:
class rrname(Command):
def execute(self):
filenames = [f.basename for f in self.fm.thistab.get_selection()]
for f in filenames:
new_name = '-' + f
self.fm.rename(f, new_name)
# attempt to do something with renamed files
self.fm.reload_cwd()
with open('out', 'w') as log:
cwd = self.fm.thisdir
for fileobj in cwd.files:
filename = fileobj.basename
log.write(str(filename))
But after renaming, I can`t do something with renamed files, because cwd.files keeps old filenames (I can see it in "log" file). Is there any command instead of self.fm.reload_cwd(), to reload current directory, or it`s not so simple?
Actually, I want renamed files to stay marked after renaming. The whole code:
class rrname(Command):
"""
:rrname <file(s)>
Prepends filename(s) of the selected file(s) with '-'
"""
do_mark = True
def execute(self):
filenames = [f.basename for f in self.fm.thistab.get_selection()]
for f in filenames:
new_name = '-' + f
self.fm.rename(f, new_name)
cwd = self.fm.thisdir
for fileobj in cwd.files:
filename = fileobj.basename
if filename[0] == '-' and filename[1:] in filenames:
cwd.mark_item(fileobj, val=self.do_mark)
self.fm.ui.need_redraw = True
Offline
Hi,
I use the following in my rc.conf:
map S shell -d terminal --working-directory="%d" &
It's very convenient, but recently it's stopped working. It opens the terminal in my home directory, not the current directory. I've tried
map S console shell -d terminal --working-directory="%d" &
and I can see %d being expanded properly and hitting enter confirms that it works, but I can't get the original working again. Any ideas where the problem may be?
EDIT: Never mind, I've fixed the problem.
map S shell -d terminal
works now (i.e., it opens the terminal in the current directory, even though it didn't work before, which is why I added the --working-directory in the first place. Weird. So probably something changed in the implementation somewhere, but I've solved my problem so I'm happy.
Last edited by darkfeline (2012-10-12 04:21:28)
Offline
Hello!
I rename some files with the "rrname" command from my commands.py:class rrname(Command): def execute(self): filenames = [f.basename for f in self.fm.thistab.get_selection()] for f in filenames: new_name = '-' + f self.fm.rename(f, new_name) # attempt to do something with renamed files self.fm.reload_cwd() with open('out', 'w') as log: cwd = self.fm.thisdir for fileobj in cwd.files: filename = fileobj.basename log.write(str(filename))
But after renaming, I can`t do something with renamed files, because cwd.files keeps old filenames (I can see it in "log" file). Is there any command instead of self.fm.reload_cwd(), to reload current directory, or it`s not so simple?
Actually, I want renamed files to stay marked after renaming. The whole code:
class rrname(Command): """ :rrname <file(s)> Prepends filename(s) of the selected file(s) with '-' """ do_mark = True def execute(self): filenames = [f.basename for f in self.fm.thistab.get_selection()] for f in filenames: new_name = '-' + f self.fm.rename(f, new_name) cwd = self.fm.thisdir for fileobj in cwd.files: filename = fileobj.basename if filename[0] == '-' and filename[1:] in filenames: cwd.mark_item(fileobj, val=self.do_mark) self.fm.ui.need_redraw = True
Well, the command you wanted was:
self.fm.thisdir.load_content(schedule=False)
The full code should look something like this:
class rrname(Command):
"""
:rrname <file(s)>
Prepends filename(s) of the selected file(s) with '-'
"""
do_mark = True
def execute(self):
filenames = [f.basename for f in self.fm.thistab.get_selection()]
for f in filenames:
new_name = '-' + f
self.fm.rename(f, new_name)
if self.fm.thisdir.marked_items:
self.fm.thisdir.load_content(schedule=False)
for f in filenames:
self.fm.execute_console("mark -"+f)
Let me do a quick analysis:
if self.fm.thisdir.marked_items:
Only re-mark if the items were already marked.
self.fm.thisdir.load_content(schedule=False)
Force a reload. In the last few versions (I don't know the exact number), Ranger has had a scheduler for these things. Because we need to run it now, we have to disable that.
for f in filenames:
self.fm.execute_console("mark -"+f)
I find using these style of commands handles the exceptions a lot more reliably than other methods, so this is my preference. It also means you don't have to look for file objects or do any searching manually, and you don't have to find out any API you aren't already familiar with. Additionally, it saves you looping through the whole directory.
Finally, "rrname" is a terrible name. "prepend_dash" would be much nicer (you have auto-complete anyway).
Offline
@Vee, I love you!
Offline
Hello everyone! Several times got the problem. The steps are:
1. Run ranger.
2. Work for a while.
3. Close one of opened tabs with 'q' keypress (mapped for tab_close command).
4. Got "'dict' object has no attribute 'append'" error message at the bottom of ranger`s window.
5. 'uq' keypress does not work.
6. Open new tab with 'gn' keypress, then close it. Got the same error message.
7. Open new tab with 'gn' keypress, then close it. Got the same error message.
...
8. Restart ranger and have all things working for a while.
ranger-master 1.5.5
Python 2.7.3rc2 (default, Apr 22 2012, 22:35:38)
[GCC 4.6.3]
Offline
I`ve noticed a strange thing:
1. Open a directory with some stuff.
2. Press '/ <something>' for search something.
3. Press 'cm' to find the most recently modicated file/dir.
4. Press 'n', implying to find next modificated file/dir, but actually we make search for stuff from step 2.
... Huh, OK.
5. Press 'cs' to find the biggest file.
6. Next 'n' pressings acts to search for next biggest files, not fo stuff from step 2.
7. 'ca', 'cc', 'ci' work the same way as 'cs', only 'cm' acts strange.
So, if you searched some stuff and want to look through most recently modificated files, it`s not enough to press 'cm', first you need to enable any other search method ('ca', 'cc', 'ci', 'cs') and toggle 'cm' back. Now 'n' looks through the most recently modificated files.
Is it by design?
Last edited by loop (2012-10-15 16:50:03)
Offline
About the progressbar:
The problem is that nobody is willing to write progressbar support for ranger. If I had a program that works like cp and periodically prints the status to the stdout, that would be great.But honestly, I wouldn't copy large amounts of data with ranger because I want to see the logs.
Would it be possible to integrate ranger with program like pv to get this?
Offline
Hi, Hut the paste (pp) started a while back to rename the incoming file when one exists rather than rename the current file. Where can I modify this to bring it back to when you paste files to replace the new for the old where the old file is the one that gets renamed?
thanks
-jerry
Last edited by jk121960 (2012-10-21 00:13:04)
Arch Awesome, Ranger & Vim the coding triple threat.
Offline
Is it possible to get files sorted by filetype and the subgroups by name?
usability == arch + i3 + urxvt + vim + ranger + dwb + vlc + cmus + mutt + shitload of scripts
Offline
Is it possible to get files sorted by filetype and the subgroups by name?
Yes.
I have been (and still am) a fair bit short on time recently, so the others will have to wait for my reply as no-one else seems to be going to.
The answer you want is to press "o" and then "t".
But that is never good enough.
Alternatively, put this in your ~/.config/options.py.
from ranger.fsobject.directory import Directory
def sort_by_extension(path):
extension = path.extension
if extension is None:
extension = ""
return extension
def join_sorts(*sort_functions):
def new_sort_func(p):
return tuple(f(p) for f in sort_functions)
return new_sort_func
Directory.sort_dict["extension_then_basename"] = join_sorts(sort_by_extension, Directory.sort_dict["basename"])
and then run ":sort extension_then_basename" from inside Ranger [this can be bound to a key].
Lets run through the code:
from ranger.fsobject.directory import Directory
This is where Ranger stores the sorting algorithms, specifically inside "Directory.sort_dict".
def sort_by_extension(path):
The sort function receives "path" objects, which are really "File" instances (but the other functions accept them as path). It needs to return something that Python can order, keeping in mind that Python can order strings ("b" > "aa" > "a" and "ba" > "ab").
extension = path.extension
if extension is None:
extension = ""
return extension
Get the extension from the path object, and make sure we have a string. Then return it. This will let Python sort by extension.
def join_sorts(*sort_functions):
We, however, want to sort by name in the ambiguous case. This is where Python's tuples come in.
A tuple looks like this:
(10, "hello", 54, x, [sda], "sort-of like a list of things")
and Python knows how to sort these.
First it sorts by the first value, and then by the second when the first are equal, and then the third, and so on.
So if we want to sort by extension and then basename we want to sort by (extension, basename). This function will take in many (as many as you want) functions and then make a new function that returns a tuple of that form.
def new_sort_func(p):
return tuple(f(p) for f in sort_functions)
return new_sort_func
What we've got here is we make a new function (new_sort_func) and return it (return new_sort_func).
The new function returns a tuple which has the values "f(p)" for each "f" in our list of functions, so (extension(p), basename(p)) if our functions are (extension, basename).
Directory.sort_dict["extension_then_basename"] = join_sorts(sort_by_extension, Directory.sort_dict["basename"])
Let us look at this in two parts.
join_sorts(sort_by_extension, Directory.sort_dict["basename"])
This makes a new function using "join_sorts", which is our "sort_by_extension" plus "Directory.sort_dict['basename']". "Directory.sort_dict['basename']" is just where Ranger puts its "basename" sort - other choices are "natural", "size", "mtime", "atime", "ctime" and "type".
Directory.sort_dict["extension_then_basename"] =
Now we can sort how we want, give it to Ranger.
Now realise that "type" is a sort method already built-in, which uses mimetypes rather than extensions, a better approach. So the above may be rather written as:
from ranger.fsobject.directory import Directory
def join_sorts(*sort_functions):
def new_sort_func(p):
return tuple(f(p) for f in sort_functions)
return new_sort_func
Directory.sort_dict["extension_then_basename"] = join_sorts(
Directory.sort_dict["type"],
Directory.sort_dict["basename"]
)
Please enjoy.
Offline
@Veedrac
Hehe thanks for an awesome reply! I did not know ranger can be extended that easily <3
I still wonder why this type of a sort is not in ranger by default...
Last edited by Baabelfish (2012-10-21 03:24:32)
usability == arch + i3 + urxvt + vim + ranger + dwb + vlc + cmus + mutt + shitload of scripts
Offline
Lfm(last file manager) has a functionality to view compressed files like .tar etc like ordinary folders. Can this functionality be implemented in Ranger ?
Using Openbox + Tint2 + Idesk
Offline
Hi Ranger already does this, just hit enter when the file is highlighted.
--jerry
Arch Awesome, Ranger & Vim the coding triple threat.
Offline
Ranger only lists the files inside the archive. We cannot edit or read the files like we can in lfm. If you want to see what i'm telling , just install lfm and try opening an archive(compressed files like .tar,.rar etc) in it. Also, I'm using the latest git version of ranger.
Using Openbox + Tint2 + Idesk
Offline
Ranger only lists the files inside the archive. We cannot edit or read the files like we can in lfm. If you want to see what i'm telling , just install lfm and try opening an archive(compressed files like .tar,.rar etc) in it. Also, I'm using the latest git version of ranger.
This has been discussed very seriously before. Until someone (me included*, Hut excluded) gets off their backside and implements it, its not going to happen. I'm pretty sure Hut likes the idea, but it's not trivial to implement.
By the way, I tried lfm just now and managed to crash it with this functionality in the first 60 seconds. That's the kind of thing to avoid ;-).
* I have even yet to implement my own simple suggestion I proposed to Hut, so you can assume it will be a while...
Offline
lfm didn't crash on my system. It was pretty stable and opened ( and opens) several compressed files for me without error. I believe this is the only option missing in ranger, otherwise it's complete in all aspects. Atleast an option should be given to enable or disable this functionality, so that who want to use it will use it and those who don't want it, they disable it. I only want to see this option added to ranger otherwise it covers all the functionality needed by me. And, also, i think, many would welcome this functionality if I'm not wrong.
Using Openbox + Tint2 + Idesk
Offline