\section bind bind - handle fish key bindings \subsection bind-synopsis Synopsis bind [OPTIONS] SEQUENCE COMMAND \subsection bind-description Description The bind builtin causes fish to add a key binding from the specified sequence. SEQUENCE is the character sequence to bind to. Usually, one would use fish escape sequences to express them. For example, because pressing the Alt key and another character sends that character prefixed with an escape character, Alt-based key bindings can be written using the \c \\e escape. For example, Alt-w can be written as \\ew. Control character can be written in much the same way using the \c \\c escape, for example Control-x can be written as \\cx. Note that Alt-based key bindings are case sensitive and Control base key bindings are not. This is not a design choice in fish, it is simply how terminals work. 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. bind '' self-insert 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 bind --key-names 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 --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 function and simply 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. - -a or --all 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. - -e or --erase Erase mode. All non-switch arguments are interpreted as character sequences and any commands associated with those sequences are erased. - -h or --help Display help and exit - -k or --key Specify a key name, such as 'left' or 'backspace' instead of a character sequence - -K or --key-names Display a list of available key names - -f or --function-names Display a list of available input functions \subsection bind-example Example bind \\cd 'exit' causes fish to exit on Control-d bind -k ppage history-search-backward Causes fish to perform a history search when the page up key is pressed