summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRyan Roden-Corrent <ryan@rcorre.net>2016-08-09 07:35:26 -0400
committerFlorian Bruhin <git@the-compiler.org>2016-11-05 22:17:43 +0100
commita7ff4075de891660e67bfbe035949fed9e637f63 (patch)
tree873603a9710371b9d0e83cff1bb7fc3bb94e0eff
parenta876f4a199412d8c87670ef6985d2a09d40f24bf (diff)
downloadqutebrowser-a7ff4075de891660e67bfbe035949fed9e637f63.tar.gz
qutebrowser-a7ff4075de891660e67bfbe035949fed9e637f63.zip
Allow binding to an alias.
Fix #1813: Cannot :bind to alias
-rw-r--r--qutebrowser/config/parsers/keyconf.py5
-rw-r--r--tests/end2end/features/keyinput.feature12
2 files changed, 15 insertions, 2 deletions
diff --git a/qutebrowser/config/parsers/keyconf.py b/qutebrowser/config/parsers/keyconf.py
index 68450d54a..6194379fe 100644
--- a/qutebrowser/config/parsers/keyconf.py
+++ b/qutebrowser/config/parsers/keyconf.py
@@ -25,7 +25,7 @@ import itertools
from PyQt5.QtCore import pyqtSignal, QObject
-from qutebrowser.config import configdata, textwrapper
+from qutebrowser.config import configdata, textwrapper, config
from qutebrowser.commands import cmdutils, cmdexc
from qutebrowser.utils import log, utils, qtutils, message, usertypes
@@ -352,7 +352,8 @@ class KeyConfigParser(QObject):
line))
commands = [c.split(maxsplit=1)[0].strip() for c in commands]
for cmd in commands:
- if cmd not in cmdutils.cmd_dict:
+ aliases = config.section('aliases')
+ if cmd not in cmdutils.cmd_dict and cmd not in aliases:
raise KeyConfigError("Invalid command '{}'!".format(cmd))
def _read_command(self, line):
diff --git a/tests/end2end/features/keyinput.feature b/tests/end2end/features/keyinput.feature
index 92d1b87fd..6d804e029 100644
--- a/tests/end2end/features/keyinput.feature
+++ b/tests/end2end/features/keyinput.feature
@@ -61,6 +61,18 @@ Feature: Keyboard input
And I run :bind <ctrl-test23>
Then the message "<ctrl-test23> is bound to 'message-info bar' in normal mode" should be shown
+ Scenario: Binding to an alias
+ When I run :set aliases 'mib' 'message-info baz'
+ And I run :bind test25 mib
+ And I press the keys "test25"
+ Then the message "baz" should be shown
+
+ Scenario: Printing a bound alias
+ When I run :set aliases 'mib' 'message-info baz'
+ And I run :bind <test26> mib
+ And I run :bind <test26>
+ Then the message "<test26> is bound to 'mib' in normal mode" should be shown
+
# :unbind
Scenario: Binding and unbinding a keychain