summary refs log tree commit diff stats
path: root/ranger/api
diff options
context:
space:
mode:
authorhut <hut@lavabit.com>2010-01-25 16:07:02 +0100
committerhut <hut@lavabit.com>2010-01-25 16:07:02 +0100
commit90dc5f6a86909d7ef38004b70532246df7aeb054 (patch)
tree91e52c5253b48e7f1c34877601303ff0d0ebaf67 /ranger/api
parent1f9c9be3b45a331aab640784cadf2dcb819e531b (diff)
downloadranger-90dc5f6a86909d7ef38004b70532246df7aeb054.tar.gz
experiment with keybinding syntax
Diffstat (limited to 'ranger/api')
-rw-r--r--ranger/api/keys.py39
1 files changed, 21 insertions, 18 deletions
diff --git a/ranger/api/keys.py b/ranger/api/keys.py
index 308fab2b..be01871d 100644
--- a/ranger/api/keys.py
+++ b/ranger/api/keys.py
@@ -22,28 +22,32 @@ from ranger.gui.widgets import console_mode as cmode
 from ranger.container.bookmarks import ALLOWED_KEYS as ALLOWED_BOOKMARK_KEYS
 
 def make_abbreviations(command_list):
-	def bind(*args):
-		lastarg = args[-1]
-		if hasattr(lastarg, '__call__'):
-			# do the binding
-			command_list.bind(lastarg, *args[:-1])
+	def bind(*args, **keywords):
+		if keywords:
+			command_list.show(*args, **keywords)
 		else:
-			# act as a decorator. eg:
-			#    @bind('a')
-			#    def do_stuff(arg):
-			#       arg.fm.ui.do_stuff()
-			#
-			# is equivalent to:
-			#    bind('a', lambda arg: arg.fm.ui.do_stuff())
-			return lambda fnc: command_list.bind(fnc, *args)
-
-	def hint(*args):
-		command_list.hint(args[-1], *args[:-1])
+			lastarg = args[-1]
+			if hasattr(lastarg, '__call__'):
+				# do the binding
+				command_list.bind(lastarg, *args[:-1])
+			else:
+				# act as a decorator. eg:
+				#    @bind('a')
+				#    def do_stuff(arg):
+				#       arg.fm.ui.do_stuff()
+				#
+				# is equivalent to:
+				#    bind('a', lambda arg: arg.fm.ui.do_stuff())
+				return lambda fnc: command_list.bind(fnc, *args)
+
+	def show(*args, **keywords):
+		command_list.show(*args, **keywords)
 
 	def alias(*args):
 		command_list.alias(*args)
 
-	return bind, hint, alias
+	return bind, alias
+
 
 class Wrapper(object):
 	def __init__(self, firstattr):
@@ -129,4 +133,3 @@ def replace_narg(number, function, args, keywords):
 			keywords = dict(keywords)
 			keywords[NARG_KEYWORD] = number
 	return args, keywords
-