blob is binary.
2:59 +0100
Added version info to examples' href='/akspecs/ranger/commit/examples/plugin_chmod_keybindings.py?h=v1.9.0b5&id=c139ec86237c2800f55ea2064f18c1b5bc4e9523'>c139ec86 ^
index : tour | |
touring some programming systems | elioat <elioat@tilde.institute> |
about summary refs log blame commit diff stats |
# Compatible with ranger 1.6.0 through ranger 1.7.*
#
# This plugin serves as an example for adding key bindings through a plugin.
# It could replace the ten lines in the rc.conf that create the key bindings
# for the "chmod" command.
import ranger.api
old_hook_init = ranger.api.hook_init
def hook_init(fm):
old_hook_init(fm)
# Generate key bindings for the chmod command
command = "map {0}{1}{2} shell -d chmod {1}{0}{2} %s"
for mode in list('ugoa') + ['']:
for perm in "rwxXst":
fm.execute_console(command.format('-', mode, perm))
fm.execute_console(command.format('+', mode, perm))
ranger.api.hook_init = hook_init