[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Ranger-users] How to execute a command directly from a binding ?
From: |
niku |
Subject: |
Re: [Ranger-users] How to execute a command directly from a binding ? |
Date: |
Thu, 30 Jan 2014 22:22:01 +0530 |
User-agent: |
Mutt/1.5.21 (2010-09-15) |
> I've a small problem with ranger. I cannot figure how to execute a command
> directly on a mapping. For instance, when I use DELETE, it types :delete
> and then I have to push ENTER to use it. Is it possible to make a binding
> directly executes :delete or another command ?
As rc.conf file shows, the <DELETE> key is translated to 'console delete'.
'Console' is a ranger function defined in commands.py. 'Console delete'
runs self.fm.open_console(delete). As the documentation line there
says:
self.fm.open_console(string): Open the console with the
given string already typed in
for you.
You are interested in:
self.fm.execute_console(string): Execute the string
as a ranger command.
You may try adding a new command and use that instead of 'console',
but what you need can be done just fine by the 'shell' command. Just
replace 'console delete' with 'shell -d rm %s'.