|From:||Wojciech 'vifon' Siewierski|
|Subject:||Re: [Ranger-users] Page command|
|Date:||Mon, 20 Apr 2015 19:27:57 +0200|
|User-agent:||Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Icedove/31.6.0|
On 20/04/15 18:52, Michael Longval wrote:
Hi, I added a "page" command because "selecting" a text or .py file always opens it. I don't always want that. Here is the rc.conf part: map pp page %f and this is the commands.py part: ( Now I've been using this for a while now, and I don't recall if I modified what was already there, or if I added this myself, anyway this simply pages the file to 'less' ) Also this is very MacOSX specific because I assume that people are using HOMEBREW. class page(Command): """:page <filename> Opens the specified file in 'less' """ def execute(self): theFile = self.fm.thisfile.path theCommand = "/usr/bin/clear;/usr/local/bin/less '" + theFile +"'" # this ASSUMES using HOMEBREW call(theCommand, shell=True) self.fm.ui.redraw_window() self.fm.ui.initialize() Hope it's usefull, Mike
ranger already allows you to “page” the text files: press “i”. It’s not as fully featured but it’s there.
Also, be aware that a
file named for example
or something like this. Just don’t call the shell and you should be fine in most cases.
-- Kind regards, Wojciech 'vifon' Siewierski
Description: OpenPGP digital signature
|[Prev in Thread]||Current Thread||[Next in Thread]|