summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorhut <hut@lavabit.com>2012-08-02 03:36:47 +0200
committerhut <hut@lavabit.com>2012-08-02 03:36:47 +0200
commitd2c8c6cb3f24ac626275af133bb723e549850538 (patch)
tree569586e90f36008f365839f6ee4c344bf5d023e2
parent5ce347118df3ebb96646ba1ffcf69f2e1f5c4da8 (diff)
downloadranger-d2c8c6cb3f24ac626275af133bb723e549850538.tar.gz
defaults/rc.conf: simplify the chmod bindings
-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