Improve documentation for command modes

This commit is contained in:
Florian Bruhin 2017-09-12 15:10:27 +02:00
parent 07079664a6
commit f70c5968a9
4 changed files with 13 additions and 5 deletions

View File

@ -125,7 +125,8 @@ Bind a key to a command.
==== optional arguments
* +*-m*+, +*--mode*+: A comma-separated list of modes to bind the key in (default: `normal`).
* +*-m*+, +*--mode*+: A comma-separated list of modes to bind the key in (default: `normal`). See `:help bindings.commands` for the
available modes.
* +*-f*+, +*--force*+: Rebind the key if it is already bound.
@ -938,7 +939,8 @@ Unbind a keychain.
==== positional arguments
* +'key'+: The keychain or special key (inside <...>) to unbind.
* +'mode'+: A mode to unbind the key in (default: `normal`).
* +'mode'+: A mode to unbind the key in (default: `normal`). See `:help bindings.commands` for the available modes.
[[undo]]
=== undo

View File

@ -308,7 +308,9 @@ For simple keys (no `<>`-signs), a capital letter means the key is pressed with
If you want a binding to do nothing, bind it to the `nop` command. If you want a default binding to be passed through to the website, bind it to null.
Note that some commands which are only useful for bindings (but not used interactively) are hidden from the command completion. See `:help` for a full list of available commands.
The following modes are available:
* normal: The default mode, where most commands are invoked.
* insert: Entered when an input field is focused on a website, or by
pressing `i` in normal mode. Passes through almost all keypresses to the
website, but has some bindings like `<Ctrl-e>` to open an external editor.
@ -328,7 +330,7 @@ The following modes are available:
* prompt: Entered when there's a prompt to display, like for download
locations or when invoked from JavaScript.
+
You can bind normal keys in this mode, but they will be only active when a
yes/no-prompt is asked. For other prompt modes, you can only bind special
keys.

View File

@ -320,7 +320,8 @@ class ConfigCommands:
command: The command to execute, with optional args, or None to
print the current binding.
mode: A comma-separated list of modes to bind the key in
(default: `normal`).
(default: `normal`). See `:help bindings.commands` for the
available modes.
force: Rebind the key if it is already bound.
"""
if command is None:
@ -352,6 +353,7 @@ class ConfigCommands:
Args:
key: The keychain or special key (inside <...>) to unbind.
mode: A mode to unbind the key in (default: `normal`).
See `:help bindings.commands` for the available modes.
"""
try:
self._keyconfig.unbind(key, mode=mode, save_yaml=True)

View File

@ -2177,8 +2177,10 @@ bindings.commands:
The following modes are available:
* normal: The default mode, where most commands are invoked.
* insert: Entered when an input field is focused on a website, or by
pressing `i` in normal mode. Passes through almost all keypresses to the
website, but has some bindings like `<Ctrl-e>` to open an external editor.
@ -2198,7 +2200,7 @@ bindings.commands:
* prompt: Entered when there's a prompt to display, like for download
locations or when invoked from JavaScript.
+
You can bind normal keys in this mode, but they will be only active when a
yes/no-prompt is asked. For other prompt modes, you can only bind special
keys.