summaryrefslogtreecommitdiff
path: root/qutebrowser/config/configfiles.py
diff options
context:
space:
mode:
Diffstat (limited to 'qutebrowser/config/configfiles.py')
-rw-r--r--qutebrowser/config/configfiles.py14
1 files changed, 12 insertions, 2 deletions
diff --git a/qutebrowser/config/configfiles.py b/qutebrowser/config/configfiles.py
index e7066fa11..f220d2ca4 100644
--- a/qutebrowser/config/configfiles.py
+++ b/qutebrowser/config/configfiles.py
@@ -442,11 +442,21 @@ class ConfigAPI:
urlpattern = urlmatch.UrlPattern(pattern) if pattern else None
self._config.set_obj(name, value, pattern=urlpattern)
- def bind(self, key: str, command: str, mode: str = 'normal') -> None:
+ def bind(self, key: str,
+ command: typing.Optional[str],
+ mode: str = 'normal') -> None:
"""Bind a key to a command, with an optional key mode."""
with self._handle_error('binding', key):
seq = keyutils.KeySequence.parse(key)
- self._keyconfig.bind(seq, command, mode=mode)
+ if command is None:
+ text = ("Unbinding commands with config.bind('{key}', None) "
+ "is deprecated. Use config.unbind('{key}') instead."
+ .format(key=key))
+ self.errors.append(configexc.ConfigErrorDesc(
+ "While unbinding '{}'".format(key), text))
+ self._keyconfig.unbind(seq, mode=mode)
+ else:
+ self._keyconfig.bind(seq, command, mode=mode)
def unbind(self, key: str, mode: str = 'normal') -> None:
"""Unbind a key from a command, with an optional key mode."""