about summary refs log tree commit diff stats
path: root/ranger/defaults/commands.py
diff options
context:
space:
mode:
authorhut <hut@lavabit.com>2011-10-03 06:20:43 +0200
committerhut <hut@lavabit.com>2011-10-03 06:20:43 +0200
commit9c4f3cc87b9c15999cb07730caf9657a71b96d0c (patch)
tree6b1c5ab834aa9e7436e192cc229bf502c0f667c0 /ranger/defaults/commands.py
parent4bea11d661ee302257966bc9fc60c712b72f4e7d (diff)
downloadranger-9c4f3cc87b9c15999cb07730caf9657a71b96d0c.tar.gz
defaults.commands: added alias command, overhauled alias system
Diffstat (limited to 'ranger/defaults/commands.py')
-rw-r--r--ranger/defaults/commands.py15
1 files changed, 11 insertions, 4 deletions
diff --git a/ranger/defaults/commands.py b/ranger/defaults/commands.py
index 60e3279d..a9a232b9 100644
--- a/ranger/defaults/commands.py
+++ b/ranger/defaults/commands.py
@@ -59,10 +59,17 @@ from ranger.api.commands import *
 from ranger.ext.get_executables import get_executables
 from ranger.core.runner import ALLOWED_FLAGS
 
-alias('e', 'edit')
-alias('q', 'quit')
-alias('q!', 'quitall')
-alias('qall', 'quitall')
+class alias(Command):
+	"""
+	:alias <newcommand> <oldcommand>
+
+	Copies the oldcommand as newcommand.
+	"""
+	def execute(self):
+		if not self.arg(1) or not self.arg(2):
+			self.fm.notify('Syntax: alias <newcommand> <oldcommand>', bad=True)
+		else:
+			self.fm.commands.alias(self.arg(1), self.arg(2))
 
 class cd(Command):
 	"""