summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorhut <hut@lavabit.com>2011-10-01 01:44:26 +0200
committerhut <hut@lavabit.com>2011-10-01 01:44:26 +0200
commit185857d8fe28209f1d0203cb3a6aa851a7153a86 (patch)
tree473f2f1567f8f1d6778031068078308aeaa144ed
parent3f053cf2ecda9dee7e987a0d186fff6f5be27bb4 (diff)
downloadranger-185857d8fe28209f1d0203cb3a6aa851a7153a86.tar.gz
defaults/rc.conf: simplified "<any> keybinding
-rw-r--r--ranger/defaults/rc.conf3
-rw-r--r--ranger/ext/keybindings.py10
2 files changed, 7 insertions, 6 deletions
diff --git a/ranger/defaults/rc.conf b/ranger/defaults/rc.conf
index 81bd32da..d56c90a9 100644
--- a/ranger/defaults/rc.conf
+++ b/ranger/defaults/rc.conf
@@ -34,6 +34,7 @@ map cd console cd
 # Tagging / Marking
 map t       tag_toggle
 map T       tag_remove
+map "<any>  tag_toggle tag=%any
 map <Space> mark toggle=True
 map v       mark all=True val=True
 map V       mark all=True val=False
@@ -213,8 +214,6 @@ eval import itertools; [cmd("map +%s%s shell -d chmod %s+%s %%s" % (mode+mode))
 # 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 "x tag_toggle tag=x (one mapping for each key)
-eval -q [cmd('map "%s eval fm.tag_toggle(tag=chr(%d))' % (chr(s),s)) for s in range(33, 127)]
 
 
 # ===================================================================
diff --git a/ranger/ext/keybindings.py b/ranger/ext/keybindings.py
index 0c09de11..e53dc890 100644
--- a/ranger/ext/keybindings.py
+++ b/ranger/ext/keybindings.py
@@ -48,9 +48,10 @@ class KeyMaps(dict):
 
 
 class KeyBuffer(object):
-	any_key        = ANYKEY
-	passive_key    = PASSIVE_ACTION
-	quantifier_key = QUANT_KEY
+	any_key             = ANYKEY
+	passive_key         = PASSIVE_ACTION
+	quantifier_key      = QUANT_KEY
+	exclude_from_anykey = [27]
 
 	def __init__(self, keymap=None):
 		self.keymap = keymap
@@ -82,7 +83,8 @@ class KeyBuffer(object):
 			moved = True
 			if key in self.pointer:
 				self.pointer = self.pointer[key]
-			elif self.any_key in self.pointer:
+			elif self.any_key in self.pointer and \
+					key not in self.exclude_from_anykey:
 				self.wildcards.append(key)
 				self.pointer = self.pointer[self.any_key]
 			else: