aboutsummaryrefslogtreecommitdiffhomepage
path: root/doc_src
diff options
context:
space:
mode:
authorGravatar liljencrantz <liljencrantz@gmail.com>2007-09-29 07:36:54 +1000
committerGravatar liljencrantz <liljencrantz@gmail.com>2007-09-29 07:36:54 +1000
commitf4f10a822675bc1e470f6b25a6b8ea98109812cd (patch)
treef8841112b38e5f5153e28df6a711b545951be527 /doc_src
parentd6c7e25bea173d60d3196946b570d990886765da (diff)
Documentation improvements on new key binding system
darcs-hash:20070928213654-75c98-a4845fb417b0b29a75d4a337df18250bc488e271.gz
Diffstat (limited to 'doc_src')
-rw-r--r--doc_src/bind.txt23
-rw-r--r--doc_src/index.hdr.in16
2 files changed, 19 insertions, 20 deletions
diff --git a/doc_src/bind.txt b/doc_src/bind.txt
index e899b0bd..6c4e7148 100644
--- a/doc_src/bind.txt
+++ b/doc_src/bind.txt
@@ -12,32 +12,43 @@ fish escape sequences to express them. For example, Alt-w can be
written as <tt>\\ew</tt>, and Control-x can be written as
<tt>\\cx</tt>.
+If SEQUENCE is the empty string, i.e. an empty set of quotes, this is
+interpreted as the default keybinding. It will be used whenever no
+other binding matches. For most key bindings, it makes sense to use
+the \c self-insert function (i.e. <tt>bind '' self-insert</tt> as the
+default keybining. This will insert any keystrokes not specifically
+bound to into the editor. Non-printable characters are ignored by the
+editor, so this will not result in e.g. control sequences being
+printable.
+
If the -k switch is used, the name of the key (such as down, up or
backspace) is used instead of a sequence. The names used are the same
as the corresponding curses variables, but without the 'key_'
prefix. (See man 5 terminfo for more information, or use <tt>bind
---names</tt> for a list of all available named keys)
+--key-names</tt> for a list of all available named keys)
COMMAND can be any fish command, but it can also be one of a set of
special input functions. These include functions for moving the
cursor, operating on the kill-ring, performing tab completion,
-etc. Use 'bind -N' for a complete list of these input functions.
+etc. Use 'bind --function-names' for a complete list of these input
+functions.
When COMMAND is a shellscript command, it is a good practice to put
the actual code into a <a href="#function">function</a> and simply
-bind to the function name.
+bind to the function name. This way it becomes significantly easier to
+test the function while editing, and the result is usually more
+readable as well.
-- <tt>-a</tt> or <tt>--all</tt> If --print-key-names is specified, show all key names, not only the ones that actually are defined for the current terminal. If erase mode is specified, this switch will cause all current bindings to be erased.
+- <tt>-a</tt> or <tt>--all</tt> If --key-names is specified, show all key names, not only the ones that actually are defined for the current terminal. If erase mode is specified, this switch will cause all current bindings to be erased.
- <tt>-e</tt> or <tt>--erase</tt> Erase mode. All non-switch arguments are interpreted as character sequences and any commands associated with those sequences are erased.
- <tt>-h</tt> or <tt>--help</tt> Display help and exit
- <tt>-k</tt> or <tt>--key</tt> Specify a key name, such as 'left' or 'backspace' instead of a character sequence
- <tt>-K</tt> or <tt>--key-names</tt> Display a list of available key names
- <tt>-f</tt> or <tt>--function-names</tt> Display a list of available input functions
-
\subsection bind-example Example
-<tt>bind \cd 'exit'</tt> causes fish to exit on Control-d
+<tt>bind \\cd 'exit'</tt> causes fish to exit on Control-d
<tt>bind -k ppage history-search-backward</tt> Causes fish to perform a history search when the page up key is pressed
diff --git a/doc_src/index.hdr.in b/doc_src/index.hdr.in
index 53db33c9..3a6530d5 100644
--- a/doc_src/index.hdr.in
+++ b/doc_src/index.hdr.in
@@ -1053,14 +1053,8 @@ Here are some of the commands available in the editor:
- Alt-l lists the contents of the current directory, unless the cursor is over a directory argument, in which case the contents of that directory will be listed
- Alt-p adds the string '| less;' to the end of the job under the cursor. The result is that the output of the command will be paged.
-You can change these key bindings by making an inputrc file. To do
-this, copy the file /etc/fish/fish_inputrc to your home directory and
-rename it to '.config/fish/fish_inputrc'. Now you can edit the file
-to change your key bindings. The file format of this file is described
-in the manual page for readline. Use the command <code>man readline</code>
-to read up on this syntax. Please note that the list of key binding
-functions in fish is different to that offered by readline. Currently,
-the following functions are available:
+You can change these key bindings using the
+<a href="commands.html#bind">bind</a> builtin command.
- \c backward-char, moves one character to the left
@@ -1087,12 +1081,6 @@ the following functions are available:
- \c yank, insert the latest entry of the killring into the buffer
- \c yank-pop, rotate to the previous entry of the killring
-You can also bind a pice of shellscript to a key using the same
-syntax. For example, the Alt-p functionality described above is
-implemented using the following keybinding.
-
-<pre>"\M-p": if commandline -j|grep -v 'less *$' &gt;/dev/null; commandline -aj "|less;"; end;</pre>
-
If such a script produces output, the script needs to finish by
calling 'commandline -f repaint' in order to tell fish that a repaint
is in order.