summary refs log tree commit diff stats
diff options
context:
space:
mode:
-rw-r--r--ranger/defaults/rc.conf19
1 files changed, 12 insertions, 7 deletions
diff --git a/ranger/defaults/rc.conf b/ranger/defaults/rc.conf
index 5ac2763a..a347d116 100644
--- a/ranger/defaults/rc.conf
+++ b/ranger/defaults/rc.conf
@@ -244,13 +244,18 @@ map um<any> unset_bookmark %any
 map m<bg>   draw_bookmarks
 copymap m<bg>  um<bg> `<bg> '<bg>
 
-# Beware. I haven't figured out how to make these keybindings pretty yet:
-
-# map +ow shell -d chmod o+w (one mapping for each combination)
-eval import itertools; [cmd("map +%s%s shell -d chmod %s+%s %%s" % (mode+mode)) for mode in itertools.product("ugoa", "rwxXst")]
-
-# map -ow shell -d chmod o+w (one mapping for each combination)
-eval import itertools; [cmd("map -%s%s shell -d chmod %s-%s %%s" % (mode+mode)) for mode in itertools.product("ugoa", "rwxXst")]
+# Generate all the chmod bindings with some python help:
+eval for arg in "rwxXst": cmd("map +u{0} shell -d chmod u+{0} %s".format(arg))
+eval for arg in "rwxXst": cmd("map +g{0} shell -d chmod g+{0} %s".format(arg))
+eval for arg in "rwxXst": cmd("map +o{0} shell -d chmod o+{0} %s".format(arg))
+eval for arg in "rwxXst": cmd("map +a{0} shell -d chmod a+{0} %s".format(arg))
+eval for arg in "rwxXst": cmd("map +{0}  shell -d chmod u+{0} %s".format(arg))
+
+eval for arg in "rwxXst": cmd("map -u{0} shell -d chmod u-{0} %s".format(arg))
+eval for arg in "rwxXst": cmd("map -g{0} shell -d chmod g-{0} %s".format(arg))
+eval for arg in "rwxXst": cmd("map -o{0} shell -d chmod o-{0} %s".format(arg))
+eval for arg in "rwxXst": cmd("map -a{0} shell -d chmod a-{0} %s".format(arg))
+eval for arg in "rwxXst": cmd("map -{0}  shell -d chmod u-{0} %s".format(arg))
 
 # ===================================================================
 # == Define keys for the console