From 185857d8fe28209f1d0203cb3a6aa851a7153a86 Mon Sep 17 00:00:00 2001 From: hut Date: Sat, 1 Oct 2011 01:44:26 +0200 Subject: defaults/rc.conf: simplified " keybinding --- ranger/defaults/rc.conf | 3 +-- ranger/ext/keybindings.py | 10 ++++++---- 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 " tag_toggle tag=%any map 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: -- cgit 1.4.1-2-gfad0