summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorhut <hut@lavabit.com>2011-08-23 00:52:27 +0200
committerhut <hut@lavabit.com>2011-08-23 00:52:27 +0200
commit9bb1444622424eb4fc548c2a0c81c3e73ca8faee (patch)
tree46a1f5391d23f2cd3820cb07a65fdf7fd43cb5d4
parentc6e105e1c4fb59a5f35dae432340fdfb0304ba52 (diff)
downloadranger-9bb1444622424eb4fc548c2a0c81c3e73ca8faee.tar.gz
defaults/keys: add shortcuts for chmod: +ow = chmod o+w, etc
-rw-r--r--ranger/defaults/keys.py8
1 files changed, 8 insertions, 0 deletions
diff --git a/ranger/defaults/keys.py b/ranger/defaults/keys.py
index cd1c5d07..1f4c3332 100644
--- a/ranger/defaults/keys.py
+++ b/ranger/defaults/keys.py
@@ -193,6 +193,14 @@ map('phl', fm.paste_hardlink())
 map('u<bg>', fm.hint("un*y*ank, unbook*m*ark, unselect:*v*"))
 map('ud', 'uy', fm.uncut())
 
+# ------------------------------------ changing of file permissions
+# type "+ow" for "chmod o+w %s" and so on
+from itertools import product
+for mode in product('ugoa', 'rwxXst'):
+	map('-%s%s' % mode, fm.execute_console('shell chmod %s-%s %%s' % mode))
+	map('+%s%s' % mode, fm.execute_console('shell chmod %s+%s %%s' % mode))
+	map('=%s%s' % mode, fm.execute_console('shell chmod %s+%s %%s' % mode))
+
 # ---------------------------------------------------- run programs
 map('S', fm.execute_command(os.environ['SHELL']))
 map('E', fm.edit_file())