From d95dc15dacbfcb323abaabc9c8c620a87e38cee9 Mon Sep 17 00:00:00 2001 From: Fabian Homborg Date: Fri, 18 Sep 2020 17:09:44 +0200 Subject: [PATCH] docs: Some more on custom bindings Show another fish_key_reader run, explain what keys we pressed, explain the escape delay. --- doc_src/index.rst | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/doc_src/index.rst b/doc_src/index.rst index 1da431ac7..c8d6f06d1 100644 --- a/doc_src/index.rst +++ b/doc_src/index.rst @@ -1661,14 +1661,27 @@ Put ``bind`` statements into :ref:`config.fish ` or a function c The key sequence (the ``\cc``) here depends on your setup, in particular the terminal. To find out what the terminal sends use :ref:`fish_key_reader `:: - > fish_key_reader + > fish_key_reader # pressing control-c Press a key: hex: 3 char: \cC Press [ctrl-C] again to exit bind \cC 'do something' + > fish_key_reader # pressing the right-arrow + Press a key: + hex: 1B char: \c[ (or \e) + ( 0.077 ms) hex: 5B char: [ + ( 0.037 ms) hex: 43 char: C + bind \e\[C 'do something' + Note that some key combinations are indistinguishable or unbindable. For instance control-i *is the same* as the tab key. This is a terminal limitation that fish can't do anything about. +Also, :kbd:`Escape` is the same thing as :kbd:`Alt` in a terminal. To distinguish between pressing :kbd:`Escape` and then another key, and pressing :kbd:`Alt` and that key (or an escape sequence the key sends), fish waits for a certain time after seeing an escape character. This is configurable via the ``fish_escape_delay_ms`` variable. + +If you want to be able to press :kbd:`Escape` and then a character and have it count as :kbd:`Alt`\ +\ that character, set it to a higher value, e.g.:: + + set -g fish_escape_delay_ms 100 + .. _killring: Copy and paste (Kill Ring)