docs(mapping): document the leader tree and palette remapping
This commit is contained in:
2 files changed
+76
No files matched your search
@@ -102,12 +102,38 @@ The following keys are available while the command palette is open:
|
||||
- Jump to the last result
|
||||
* - :kbd:`Backspace`
|
||||
- Delete the last character from the query
|
||||
* - :kbd:`Ctrl+R`
|
||||
- Remap the selected action by pressing its new shortcut
|
||||
* - :kbd:`F12`
|
||||
- Toggle display of unmapped actions
|
||||
* - Mouse click
|
||||
- Select and run the clicked action
|
||||
|
||||
|
||||
Remapping a shortcut
|
||||
----------------------
|
||||
|
||||
Each row shows the shortcut bound to the action in its key column. Select an
|
||||
action and press :kbd:`Ctrl+R`, then press the new shortcut. The palette appends
|
||||
the corresponding :code:`map` directive to :file:`kitty.conf` and reloads the
|
||||
configuration, so the change takes effect immediately without restarting
|
||||
|kitty|. Existing lines are left untouched and the new mapping is appended, so
|
||||
the most recent mapping wins. The read-only shortcuts panel does not offer
|
||||
remapping, and mouse bindings cannot be remapped this way.
|
||||
|
||||
|
||||
Leader key tree
|
||||
-----------------
|
||||
|
||||
When the :opt:`leader` option is set and a multi-key mapping starts with the
|
||||
leader key, pressing it opens the palette in which-key mode. Only the
|
||||
continuations available under the leader prefix are listed, with their help
|
||||
text. Press the key shown in the key column to run that action immediately, or
|
||||
use the arrow keys and :kbd:`Enter`. This mode does not remap or run unmapped
|
||||
actions, it is purely a keyboard tree. See :ref:`leader_keymap` for the
|
||||
configuration example.
|
||||
|
||||
|
||||
Unmapped actions
|
||||
------------------
|
||||
|
||||
|
||||
@@ -428,11 +428,61 @@ below::
|
||||
map --new-mode XXX --on-action end ...
|
||||
|
||||
|
||||
.. _leader_keymap:
|
||||
|
||||
Leader key and which-key hints
|
||||
-----------------------------------
|
||||
|
||||
The leader key turns a group of multi-key mappings into a discoverable tree.
|
||||
Set :opt:`leader` to the prefix you want to use, then define mappings that
|
||||
start with that prefix::
|
||||
|
||||
leader ctrl+space
|
||||
|
||||
map ctrl+space>n new_os_window
|
||||
map ctrl+space>w new_window
|
||||
map ctrl+space>t new_tab
|
||||
map ctrl+space>c close_window
|
||||
|
||||
Pressing :kbd:`Ctrl+Space` immediately opens a panel listing every key that can
|
||||
follow, with the action it runs and its help text. Press the key shown in the
|
||||
first column to run the action directly, or use the arrow keys and
|
||||
:kbd:`Enter`/ :kbd:`Escape` to leave. No timeout is needed: the panel opens as
|
||||
soon as the leader key is pressed.
|
||||
|
||||
The panel reads the same structured mapping data as the :doc:`command palette
|
||||
</kittens/command-palette>` and :doc:`the shortcuts help panel
|
||||
</kittens/help>`, so every action they list is also available here. Bindings
|
||||
guarded by :code:`--when-focus-on` are filtered against the focused window
|
||||
before they are shown.
|
||||
|
||||
The leader key is only intercepted when multi-key mappings actually start with
|
||||
it. Otherwise it is passed to the program running in the window normally. Set
|
||||
:opt:`leader` to :code:`none` to disable the panel.
|
||||
|
||||
|
||||
All mappable actions
|
||||
------------------------
|
||||
|
||||
There is a list of :doc:`all mappable actions <actions>`.
|
||||
|
||||
Remapping from the command palette
|
||||
---------------------------------
|
||||
|
||||
Every entry in the command palette shows the shortcut currently bound to it.
|
||||
Select an action and press :kbd:`Ctrl+R` to remap it: the footer asks for the
|
||||
new shortcut, so press the key combination you want. The palette appends a
|
||||
:code:`map` directive to :file:`kitty.conf` and reloads the configuration, so
|
||||
the new shortcut is active immediately::
|
||||
|
||||
map ctrl+alt+n new_os_window
|
||||
|
||||
The change is appended to the end of the file, it never rewrites existing lines.
|
||||
A later mapping for the same key wins, as usual in :file:`kitty.conf`. Remove
|
||||
the line manually to undo the change. Remapping is disabled in the read-only
|
||||
shortcuts help panel and for mouse bindings.
|
||||
|
||||
|
||||
Debugging mapping issues
|
||||
------------------------------
|
||||
|
||||
|
||||
Reference in new issue
Block a user