slog through documentation

I did.. a and b today.
This commit is contained in:
Aaron Gyes 2021-12-09 03:33:33 -08:00
parent e181d825fa
commit 79d1b3e085
9 changed files with 248 additions and 193 deletions

View File

@ -6,9 +6,7 @@ _ - call fish's translations
Synopsis
--------
::
_ STRING...
``_`` *STRING*
Description
-----------
@ -19,19 +17,17 @@ It is equivalent to ``gettext fish STRING``, meaning it can only be used to look
It requires fish to be built with gettext support. If that support is disabled, or there is no translation it will simply echo the argument back.
The language depends on the current locale, set with ``$LANG`` and ``$LC_MESSAGES``.
The language depends on the current locale, set with :envvar:`LANG` and :envvar:`LC_MESSAGES`.
Options
-------
``_`` has no options.
``_`` takes no options.
Examples
--------
::
> _ File

View File

@ -6,66 +6,70 @@ abbr - manage fish abbreviations
Synopsis
--------
::
abbr --add [SCOPE] WORD EXPANSION
abbr --erase WORD...
abbr --rename [SCOPE] OLD_WORD NEW_WORD
abbr --show
abbr --list
abbr --query WORD...
| ``abbr`` --add [*SCOPE*] *WORD* *EXPANSION*
| ``abbr`` --erase *WORD* ...
| ``abbr`` --rename [*SCOPE*] *OLD_WORD* *NEW_WORD*
| ``abbr`` --show
| ``abbr`` --list
| ``abbr`` --query *WORD* ...
Description
-----------
``abbr`` manages abbreviations - user-defined words that are replaced with longer phrases after they are entered.
For example, a frequently-run command like ``git checkout`` can be abbreviated to ``gco``. After entering ``gco`` and pressing :kbd:`Space` or :kbd:`Enter`, the full text ``git checkout`` will appear in the command line.
For example, a frequently-run command like ``git checkout`` can be abbreviated to ``gco``.
After entering ``gco`` and pressing :kbd:`Space` or :kbd:`Enter`, the full text ``git checkout`` will appear in the command line.
Options
-------
The following options are available:
- ``-a WORD EXPANSION`` or ``--add WORD EXPANSION`` Adds a new abbreviation, causing WORD to be expanded to EXPANSION.
**-a** *WORD* *EXPANSION* or **--add** *WORD* *EXPANSION*
Adds a new abbreviation, causing *WORD* to be expanded to *EXPANSION*
- ``-r OLD_WORD NEW_WORD`` or ``--rename OLD_WORD NEW_WORD`` Renames an abbreviation, from OLD_WORD to NEW_WORD.
**-r** *OLD_WORD* *NEW_WORD* or **--rename** *OLD_WORD* *NEW_WORD*
Renames an abbreviation, from *OLD_WORD* to *NEW_WORD*
- ``-s`` or ``--show`` Show all abbreviations in a manner suitable for export and import.
**-s** or **--show**
Show all abbreviations in a manner suitable for import and export
- ``-l`` or ``--list`` Lists all abbreviated words.
**-l** or **--list**
Lists all abbreviated words
- ``-e WORD`` or ``--erase WORD...`` Erase the given abbreviations.
**-e** *WORD* or **--erase** *WORD*...
Erase the given abbreviations
- ``-q`` or ``--query`` Return 0 (true) if one of the WORDs is an abbreviation.
**-q** or **--query**
Return 0 (true) if one of the *WORD* is an abbreviation.
In addition, when adding or renaming abbreviations:
- ``-g`` or ``--global`` to use a global variable.
- ``-U`` or ``--universal`` to use a universal variable (default).
**-g** or **--global**
Use a global variable
**-U** or **--universal**
Use a universal variable (default)
See the "Internals" section for more on them.
Examples
--------
::
abbr -a -g gco git checkout
Add a new abbreviation where ``gco`` will be replaced with ``git checkout`` global to the current shell. This abbreviation will not be automatically visible to other shells unless the same command is run in those shells (such as when executing the commands in config.fish).
Add a new abbreviation where ``gco`` will be replaced with ``git checkout`` global to the current shell.
This abbreviation will not be automatically visible to other shells unless the same command is run in those shells (such as when executing the commands in config.fish).
::
abbr -a -U l less
Add a new abbreviation where ``l`` will be replaced with ``less`` universal to all shells. Note that you omit the ``-U`` since it is the default.
Add a new abbreviation where ``l`` will be replaced with ``less`` universal to all shells.
Note that you omit the **-U** since it is the default.
::
@ -73,16 +77,12 @@ Add a new abbreviation where ``l`` will be replaced with ``less`` universal to a
Renames an existing abbreviation from ``gco`` to ``gch``.
::
abbr -e gco
Erase the ``gco`` abbreviation.
::
ssh another_host abbr -s | source
@ -91,20 +91,8 @@ Import the abbreviations defined on another_host over SSH.
Internals
---------
Each abbreviation is stored in its own global or universal variable. The name consists of the prefix ``_fish_abbr_`` followed by the WORD after being transformed by ``string escape style=var``. The WORD cannot contain a space but all other characters are legal.
Each abbreviation is stored in its own global or universal variable.
The name consists of the prefix ``_fish_abbr_`` followed by the WORD after being transformed by ``string escape style=var``.
The WORD cannot contain a space but all other characters are legal.
Defining an abbreviation with global scope is slightly faster than universal scope (which is the default). But in general you'll only want to use the global scope when defining abbreviations in a startup script like ``~/.config/fish/config.fish`` like this:
::
if status --is-interactive
abbr --add --global first 'echo my first abbreviation'
abbr --add --global second 'echo my second abbreviation'
abbr --add --global gco git checkout
# etcetera
end
You can create abbreviations interactively and they will be visible to other fish sessions if you use the ``-U`` or ``--universal`` flag or don't explicitly specify the scope and the abbreviation isn't already defined with global scope. If you want it to be visible only to the current shell use the ``-g`` or ``--global`` flag.
Abbreviations created with the **--universal** flag will be visible to other fish sessions, whilst **--global** will be limited to the current session.

View File

@ -6,11 +6,9 @@ alias - create a function
Synopsis
--------
::
alias
alias [OPTIONS] NAME DEFINITION
alias [OPTIONS] NAME=DEFINITION
| ``alias``
| ``alias`` [*OPTIONS*] *NAME* *DEFINITION*
| ``alias`` [*OPTIONS*] *NAME*=*DEFINITION*
Description
@ -27,17 +25,15 @@ You cannot create an alias to a function with the same name. Note that spaces ne
The following options are available:
- ``-h`` or ``--help`` displays help about using this command.
- **-h** or **--help** displays help about using this command.
- ``-s`` or ``--save`` Automatically save the function created by the alias into your fish configuration directory using :ref:`funcsave <cmd-funcsave>`.
- **-s** or **--save** Automatically save the function created by the alias into your fish configuration directory using :ref:`funcsave <cmd-funcsave>`.
Example
-------
The following code will create ``rmi``, which runs ``rm`` with additional arguments on every invocation.
::
alias rmi="rm -i"

View File

@ -1,14 +1,12 @@
.. _cmd-and:
and - conditionally execute a command
=====================================
=========================================
Synopsis
--------
::
COMMAND1; and COMMAND2
PREVIOUS; ``and`` *COMMAND*
Description
-----------

View File

@ -6,19 +6,17 @@ argparse - parse options passed to a fish script or function
Synopsis
--------
::
argparse [OPTIONS] OPTION_SPEC... -- [ARG...]
``argparse`` [*OPTIONS*] *OPTION_SPEC*... -- [*ARG*...]
Description
-----------
This command makes it easy for fish scripts and functions to handle arguments like how fish builtin commands handle their arguments. You pass arguments that define the known options, followed by a literal ``--``, then the arguments to be parsed (which might also include a literal ``--``). ``argparse`` then sets variables to indicate the passed options with their values, and sets $argv (and always $argv) to the remaining arguments. More on this in the :ref:`usage <cmd-argparse-usage>` section below.
This command makes it easy for fish scripts and functions to handle arguments like how fish builtin commands handle their arguments. You pass arguments that define the known options, followed by a literal **--**, then the arguments to be parsed (which might also include a literal **--**). ``argparse`` then sets variables to indicate the passed options with their values, and sets $argv (and always $argv) to the remaining arguments. More on this in the :ref:`usage <cmd-argparse-usage>` section below.
Each option specification (``OPTION_SPEC``) is written in the :ref:`domain specific language <cmd-argparse-option-specification>` described below. All OPTION_SPECs must appear after any argparse flags and before the ``--`` that separates them from the arguments to be parsed.
Each option that is seen in the ARG list will result in variables named ``_flag_X``, where ``X`` is the short flag letter and the long flag name (if they are defined). For example a ``--help`` option could cause argparse to define one variable called ``_flag_h`` and another called ``_flag_help``.
Each option that is seen in the ARG list will result in variables named ``_flag_X``, where **X** is the short flag letter and the long flag name (if they are defined). For example a **--help** option could cause argparse to define one variable called ``_flag_h`` and another called ``_flag_help``.
The variables will be set with local scope (i.e., as if the script had done ``set -l _flag_X``). If the flag is a boolean (that is, it just is passed or not, it doesn't have a value) the values are the short and long flags seen. If the option is not a boolean the values will be zero or more values corresponding to the values collected when the ARG list is processed. If the flag was not seen the flag variable will not be set.
@ -27,33 +25,33 @@ Options
The following ``argparse`` options are available. They must appear before all OPTION_SPECs:
- ``-n`` or ``--name`` is the command name for use in error messages. By default the current function name will be used, or ``argparse`` if run outside of a function.
**-n** or **--name**
the command name for use in error messages. By default the current function name will be used, or ``argparse`` if run outside of a function.
- ``-x`` or ``--exclusive`` should be followed by a comma separated list of short or long options that are mutually exclusive. You can use this more than once to define multiple sets of mutually exclusive options.
**-x** or **--exclusive** should be followed by a comma separated list of short or long options that are mutually exclusive. You can use this more than once to define multiple sets of mutually exclusive options.
- ``-N`` or ``--min-args`` is followed by an integer that defines the minimum number of acceptable non-option arguments. The default is zero.
- **-N** or **--min-args** is followed by an integer that defines the minimum number of acceptable non-option arguments. The default is zero.
- ``-X`` or ``--max-args`` is followed by an integer that defines the maximum number of acceptable non-option arguments. The default is infinity.
- **-X** or **--max-args** is followed by an integer that defines the maximum number of acceptable non-option arguments. The default is infinity.
- ``-i`` or ``--ignore-unknown`` ignores unknown options, keeping them and their arguments in $argv instead.
- **-i** or **--ignore-unknown** ignores unknown options, keeping them and their arguments in $argv instead.
- ``-s`` or ``--stop-nonopt`` causes scanning the arguments to stop as soon as the first non-option argument is seen. Among other things, this is useful to implement subcommands that have their own options.
- **-s** or **--stop-nonopt** causes scanning the arguments to stop as soon as the first non-option argument is seen. Among other things, this is useful to implement subcommands that have their own options.
- ``-h`` or ``--help`` displays help about using this command.
- **-h** or **--help** displays help about using this command.
.. _cmd-argparse-usage:
Usage
-----
To use this command, pass the option specifications (``OPTION_SPEC``), then a mandatory ``--``, and then the arguments you want to have parsed.
To use this command, pass the option specifications (**OPTION_SPEC**), a mandatory **--**, and then the arguments to be parsed.
A simple example::
argparse --name=my_function 'h/help' 'n/name=' -- $argv
or return
If ``$argv`` is empty then there is nothing to parse and ``argparse`` returns zero to indicate success. If ``$argv`` is not empty then it is checked for flags ``-h``, ``--help``, ``-n`` and ``--name``. If they are found they are removed from the arguments and local variables called ``_flag_OPTION`` are set so the script can determine which options were seen. If ``$argv`` doesn't have any errors, like a missing mandatory value for an option, then ``argparse`` exits with a status of zero. Otherwise it writes appropriate error messages to stderr and exits with a status of one.
The ``or return`` means that the function returns ``argparse``'s status if it failed, so if it goes on ``argparse`` succeeded.
@ -63,7 +61,6 @@ The ``--`` argument is required. You do not have to include any arguments after
set -l argv
argparse 'h/help' 'n/name' -- $argv
But this is not::
set -l argv
@ -78,17 +75,17 @@ Option Specifications
Each option specification consists of:
- An optional alphanumeric short flag letter, followed by a ``/`` if the short flag can be used by someone invoking your command or, for backwards compatibility, a ``-`` if it should not be exposed as a valid short flag (in which case it will also not be exposed as a flag variable).
- An optional alphanumeric short flag character, followed by a ``/`` if the short flag can be used by someone invoking your command or, for backwards compatibility, a ``-`` if it should not be exposed as a valid short flag (in which case it will also not be exposed as a flag variable).
- An optional long flag name. If not present then only the short flag letter can be used, and if that is not present either it's an error.
- An optional long flag name, which if not present the short flag can be used, and if that is also not present, an error is reported
- Nothing if the flag is a boolean that takes no argument or is an integer flag, or
- ``=`` if it requires a value and only the last instance of the flag is saved, or
- **=** if it requires a value and only the last instance of the flag is saved, or
- ``=?`` it takes an optional value and only the last instance of the flag is saved, or
- **=?** if it takes an optional value and only the last instance of the flag is saved, or
- ``=+`` if it requires a value and each instance of the flag is saved.
- **=+** if it requires a value and each instance of the flag is saved.
- Optionally a ``!`` followed by fish script to validate the value. Typically this will be a function to run. If the exit status is zero the value for the flag is valid. If non-zero the value is invalid. Any error messages should be written to stdout (not stderr). See the section on :ref:`Flag Value Validation <flag-value-validation>` for more information.

View File

@ -6,10 +6,7 @@ begin - start a new block of code
Synopsis
--------
::
begin; [COMMANDS...;] end
``begin``; [*COMMANDS* ...]; ``end``
Description
-----------
@ -22,14 +19,11 @@ The block is unconditionally executed. ``begin; ...; end`` is equivalent to ``if
``begin`` does not change the current exit status itself. After the block has completed, ``$status`` will be set to the status returned by the most recent command.
Example
-------
The following code sets a number of variables inside of a block scope. Since the variables are set inside the block and have local scope, they will be automatically deleted when the block ends.
::
begin
@ -45,8 +39,6 @@ The following code sets a number of variables inside of a block scope. Since the
In the following code, all output is redirected to the file out.html.
::
begin
@ -57,4 +49,3 @@ In the following code, all output is redirected to the file out.html.
end
...
end > out.html

View File

@ -6,9 +6,7 @@ bg - send jobs to background
Synopsis
--------
::
bg [PID...]
``bg`` [*PID* ...]
Description
-----------

View File

@ -5,14 +5,12 @@ bind - handle fish key bindings
Synopsis
--------
::
bind [(-M | --mode) MODE] [(-m | --sets-mode) NEW_MODE] [--preset | --user] [(-s | --silent)] [(-k | --key)] SEQUENCE COMMAND [COMMAND...]
bind [(-M | --mode) MODE] [(-k | --key)] [--preset] [--user] SEQUENCE
bind (-K | --key-names) [(-a | --all)] [--preset] [--user]
bind (-f | --function-names)
bind (-L | --list-modes)
bind (-e | --erase) [(-M | --mode) MODE] [--preset] [--user] (-a | --all | [(-k | --key)] SEQUENCE [SEQUENCE...])
| ``bind`` [(**-M** | **--mode**) *MODE*] [(*-m* | *--sets-mode*) **NEW_MODE**] [*--preset* | *--user*] [*-s* | *--silent*] [**-k** | **--key**] *SEQUENCE* *COMMAND* ...
| ``bind`` [**-M** | **--mode** *MODE*] [**-k** | **--key**] [**--preset**] [**--user**] *SEQUENCE*
| ``bind`` **-K** | **--key-names** [**-a** | **--all**] [**--preset**] [**--user**]
| ``bind`` **-f** | **--function-names**
| ``bind`` **-L** | **--list-modes**
| ``bind`` **-e** | **--erase** [**-M** | **--mode** *MODE*] [**--preset**] [**--user**] [**-a** | **--all**] | [**-k** | **--key**] *SEQUENCE* ...
Description
-----------
@ -47,179 +45,269 @@ Options
-------
The following options are available:
- ``-k`` or ``--key`` Specify a key name, such as 'left' or 'backspace' instead of a character sequence
``-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. Specifying ``-a`` or ``--all`` includes keys that don't have a known mapping
``-K`` or ``--key-names``
Display a list of available key names. Specifying ``-a`` or ``--all`` includes keys that don't have a known mapping
- ``-f`` or ``--function-names`` Display a list of available input functions
``-f`` or ``--function-names``
Display a list of available input functions
- ``-L`` or ``--list-modes`` Display a list of defined bind modes
``-L`` or ``--list-modes``
Display a list of defined bind modes
- ``-M MODE`` or ``--mode MODE`` Specify a bind mode that the bind is used in. Defaults to "default"
``-M MODE`` or ``--mode MODE``
Specify a bind mode that the bind is used in. Defaults to "default"
- ``-m NEW_MODE`` or ``--sets-mode NEW_MODE`` Change the current mode to ``NEW_MODE`` after this binding is executed
``-m NEW_MODE`` or ``--sets-mode NEW_MODE``
Change the current mode to ``NEW_MODE`` after this binding is executed
- ``-e`` or ``--erase`` Erase the binding with the given sequence and mode instead of defining a new one. Multiple sequences can be specified with this flag. Specifying ``-a`` or ``--all`` with ``-M`` or ``--mode`` erases all binds in the given mode regardless of sequence. Specifying ``-a`` or ``--all`` without ``-M`` or ``--mode`` erases all binds in all modes regardless of sequence.
``-e`` or ``--erase``
Erase the binding with the given sequence and mode instead of defining a new one.
Multiple sequences can be specified with this flag.
Specifying ``-a`` or ``--all`` with ``-M`` or ``--mode`` erases all binds in the given mode regardless of sequence.
Specifying ``-a`` or ``--all`` without ``-M`` or ``--mode`` erases all binds in all modes regardless of sequence.
- ``-a`` or ``--all`` See ``--erase`` and ``--key-names``
``-a`` or ``--all``
See ``--erase`` and ``--key-names``
- ``--preset`` and ``--user`` specify if bind should operate on user or preset bindings. User bindings take precedence over preset bindings when fish looks up mappings. By default, all ``bind`` invocations work on the "user" level except for listing, which will show both levels. All invocations except for inserting new bindings can operate on both levels at the same time (if both ``--preset`` and ``--user`` are given). ``--preset`` should only be used in full binding sets (like when working on ``fish_vi_key_bindings``).
``--preset`` and ``--user``
Specify if bind should operate on user or preset bindings.
User bindings take precedence over preset bindings when fish looks up mappings.
By default, all ``bind`` invocations work on the "user" level except for listing, which will show both levels.
All invocations except for inserting new bindings can operate on both levels at the same time (if both ``--preset`` and ``--user`` are given).
``--preset`` should only be used in full binding sets (like when working on ``fish_vi_key_bindings``).
Special input functions
-----------------------
The following special input functions are available:
- ``and``, only execute the next function if the previous succeeded (note: only some functions report success)
``and``
only execute the next function if the previous succeeded (note: only some functions report success)
- ``accept-autosuggestion``, accept the current autosuggestion completely
``accept-autosuggestion``
accept the current autosuggestion completely
- ``backward-char``, moves one character to the left
``backward-char``
moves one character to the left
- ``backward-bigword``, move one whitespace-delimited word to the left
``backward-bigword``
move one whitespace-delimited word to the left
- ``backward-delete-char``, deletes one character of input to the left of the cursor
``backward-delete-char``
deletes one character of input to the left of the cursor
- ``backward-kill-bigword``, move the whitespace-delimited word to the left of the cursor to the killring
``backward-kill-bigword``
move the whitespace-delimited word to the left of the cursor to the killring
- ``backward-kill-line``, move everything from the beginning of the line to the cursor to the killring
``backward-kill-line``
move everything from the beginning of the line to the cursor to the killring
- ``backward-kill-path-component``, move one path component to the left of the cursor to the killring. A path component is everything likely to belong to a path component, i.e. not any of the following: `/={,}'\":@ |;<>&`, plus newlines and tabs.
``backward-kill-path-component``
move one path component to the left of the cursor to the killring. A path component is everything likely to belong to a path component, i.e. not any of the following: `/={,}'\":@ |;<>&`, plus newlines and tabs.
- ``backward-kill-word``, move the word to the left of the cursor to the killring. The "word" here is everything up to punctuation or whitespace.
``backward-kill-word``
move the word to the left of the cursor to the killring. The "word" here is everything up to punctuation or whitespace.
- ``backward-word``, move one word to the left
``backward-word``
move one word to the left
- ``beginning-of-buffer``, moves to the beginning of the buffer, i.e. the start of the first line
``beginning-of-buffer``
moves to the beginning of the buffer, i.e. the start of the first line
- ``beginning-of-history``, move to the beginning of the history
``beginning-of-history``
move to the beginning of the history
- ``beginning-of-line``, move to the beginning of the line
``beginning-of-line``
move to the beginning of the line
- ``begin-selection``, start selecting text
``begin-selection``
start selecting text
- ``cancel``, cancel the current commandline and replace it with a new empty one
``cancel``
cancel the current commandline and replace it with a new empty one
- ``cancel-commandline``, cancel the current commandline and replace it with a new empty one, leaving the old one in place with a marker to show that it was cancelled
``cancel-commandline``
cancel the current commandline and replace it with a new empty one, leaving the old one in place with a marker to show that it was cancelled
- ``capitalize-word``, make the current word begin with a capital letter
``capitalize-word``
make the current word begin with a capital letter
- ``complete``, guess the remainder of the current token
``complete``
guess the remainder of the current token
- ``complete-and-search``, invoke the searchable pager on completion options (for convenience, this also moves backwards in the completion pager)
``complete-and-search``
invoke the searchable pager on completion options (for convenience, this also moves backwards in the completion pager)
- ``delete-char``, delete one character to the right of the cursor
``delete-char``
delete one character to the right of the cursor
- ``delete-or-exit``, deletes one character to the right of the cursor or exits the shell if the commandline is empty.
``delete-or-exit``
deletes one character to the right of the cursor or exits the shell if the commandline is empty.
- ``down-line``, move down one line
``down-line``
move down one line
- ``downcase-word``, make the current word lowercase
``downcase-word``
make the current word lowercase
- ``end-of-buffer``, moves to the end of the buffer, i.e. the end of the first line
``end-of-buffer``
moves to the end of the buffer, i.e. the end of the first line
- ``end-of-history``, move to the end of the history
``end-of-history``
move to the end of the history
- ``end-of-line``, move to the end of the line
``end-of-line``
move to the end of the line
- ``end-selection``, end selecting text
``end-selection``
end selecting text
- ``expand-abbr``, expands any abbreviation currently under the cursor
``expand-abbr``
expands any abbreviation currently under the cursor
- ``execute``, run the current commandline
``execute``
run the current commandline
- ``exit``, exit the shell
``exit``
exit the shell
- ``forward-bigword``, move one whitespace-delimited word to the right
``forward-bigword``
move one whitespace-delimited word to the right
- ``forward-char``, move one character to the right
``forward-char``
move one character to the right
- ``forward-single-char``, move one character to the right; if an autosuggestion is available, only take a single char from it
``forward-single-char``
move one character to the right; if an autosuggestion is available, only take a single char from it
- ``forward-word``, move one word to the right
``forward-word``
move one word to the right
- ``history-search-backward``, search the history for the previous match
``history-search-backward``
search the history for the previous match
- ``history-search-forward``, search the history for the next match
``history-search-forward``
search the history for the next match
- ``history-prefix-search-backward``, search the history for the previous prefix match
``history-prefix-search-backward``
search the history for the previous prefix match
- ``history-prefix-search-forward``, search the history for the next prefix match
``history-prefix-search-forward``
search the history for the next prefix match
- ``history-token-search-backward``, search the history for the previous matching argument
``history-token-search-backward``
search the history for the previous matching argument
- ``history-token-search-forward``, search the history for the next matching argument
``history-token-search-forward``
search the history for the next matching argument
- ``forward-jump`` and ``backward-jump``, read another character and jump to its next occurence after/before the cursor
``forward-jump`` and ``backward-jump``
read another character and jump to its next occurence after/before the cursor
- ``forward-jump-till`` and ``backward-jump-till``, jump to right *before* the next occurence
``forward-jump-till`` and ``backward-jump-till``
jump to right *before* the next occurence
- ``repeat-jump`` and ``repeat-jump-reverse``, redo the last jump in the same/opposite direction
``repeat-jump`` and ``repeat-jump-reverse``
redo the last jump in the same/opposite direction
- ``kill-bigword``, move the next whitespace-delimited word to the killring
``kill-bigword``
move the next whitespace-delimited word to the killring
- ``kill-line``, move everything from the cursor to the end of the line to the killring
``kill-line``
move everything from the cursor to the end of the line to the killring
- ``kill-selection``, move the selected text to the killring
``kill-selection``
move the selected text to the killring
- ``kill-whole-line``, move the line to the killring
``kill-whole-line``
move the line to the killring
- ``kill-word``, move the next word to the killring
``kill-word``
move the next word to the killring
- ``or``, only execute the next function if the previous succeeded (note: only some functions report success)
``or``
only execute the next function if the previous succeeded (note: only some functions report success)
- ``pager-toggle-search``, toggles the search field if the completions pager is visible.
``pager-toggle-search``
toggles the search field if the completions pager is visible.
- ``repaint``, reexecutes the prompt functions and redraws the prompt (also ``force-repaint`` for backwards-compatibility)
``repaint``
reexecutes the prompt functions and redraws the prompt (also ``force-repaint`` for backwards-compatibility)
- ``repaint-mode``, reexecutes the :ref:`fish_mode_prompt <cmd-fish_mode_prompt>` and redraws the prompt. This is useful for vi-mode. If no ``fish_mode_prompt`` exists or it prints nothing, it acts like a normal repaint.
``repaint-mode``
reexecutes the :ref:`fish_mode_prompt <cmd-fish_mode_prompt>` and redraws the prompt. This is useful for vi-mode. If no ``fish_mode_prompt`` exists or it prints nothing, it acts like a normal repaint.
- ``self-insert``, inserts the matching sequence into the command line
``self-insert``
inserts the matching sequence into the command line
- ``self-insert-notfirst``, inserts the matching sequence into the command line, unless the cursor is at the beginning
``self-insert-notfirst``
inserts the matching sequence into the command line, unless the cursor is at the beginning
- ``suppress-autosuggestion``, remove the current autosuggestion. Returns true if there was a suggestion to remove.
``suppress-autosuggestion``
remove the current autosuggestion. Returns true if there was a suggestion to remove.
- ``swap-selection-start-stop``, go to the other end of the highlighted text without changing the selection
``swap-selection-start-stop``
go to the other end of the highlighted text without changing the selection
- ``transpose-chars``, transpose two characters to the left of the cursor
``transpose-chars``
transpose two characters to the left of the cursor
- ``transpose-words``, transpose two words to the left of the cursor
``transpose-words``
transpose two words to the left of the cursor
- ``togglecase-char``, toggle the capitalisation (case) of the character under the cursor
``togglecase-char``
toggle the capitalisation (case) of the character under the cursor
- ``togglecase-selection``, toggle the capitalisation (case) of the selection
``togglecase-selection``
toggle the capitalisation (case) of the selection
- ``insert-line-under``, add a new line under the current line
``insert-line-under``
add a new line under the current line
- ``insert-line-over``, add a new line over the current line
``insert-line-over``
add a new line over the current line
- ``up-line``, move up one line
``up-line``
move up one line
- ``undo`` and ``redo``, revert or redo the most recent edits on the command line
``undo`` and ``redo``
revert or redo the most recent edits on the command line
- ``upcase-word``, make the current word uppercase
``upcase-word``
make the current word uppercase
- ``yank``, insert the latest entry of the killring into the buffer
``yank``
insert the latest entry of the killring into the buffer
- ``yank-pop``, rotate to the previous entry of the killring
``yank-pop``
rotate to the previous entry of the killring
Additional functions
--------------------
The following functions are included as normal functions, but are particularly useful for input editing:
- ``up-or-search`` and ``down-or-search``, which move the cursor or search the history depending on the cursor position and current mode
``up-or-search`` and ``down-or-search``
move the cursor or search the history depending on the cursor position and current mode
- ``edit_command_buffer``, open the visual editor (controlled by the ``VISUAL`` or ``EDITOR`` environment variables) with the current command-line contents
``edit_command_buffer``
open the visual editor (controlled by the ``VISUAL`` or ``EDITOR`` environment variables) with the current command-line contents
- ``delete-or-exit``, quit the shell if the current command-line is empty, or delete the character under the cursor if not
``delete-or-exit``
quit the shell if the current command-line is empty, or delete the character under the cursor if not
- ``fish_clipboard_copy``, copy the current selection to the system clipboard
``fish_clipboard_copy``
copy the current selection to the system clipboard
- ``fish_clipboard_paste``, paste the current selection from the system clipboard before the cursor
``fish_clipboard_paste``
paste the current selection from the system clipboard before the cursor
- ``fish_commandline_append``, append the argument to the command-line. If the command-line already ends with the argument, this removes the suffix instead. Starts with the last command from history if the command-line is empty.
``fish_commandline_append``
append the argument to the command-line. If the command-line already ends with the argument, this removes the suffix instead. Starts with the last command from history if the command-line is empty.
- ``fish_commandline_prepend``, prepend the argument to the command-line. If the command-line already starts with the argument, this removes the prefix instead. Starts with the last command from history if the command-line is empty.
``fish_commandline_prepend``
prepend the argument to the command-line. If the command-line already starts with the argument, this removes the prefix instead. Starts with the last command from history if the command-line is empty.
Examples
--------

View File

@ -167,11 +167,14 @@ latex_engine = 'xelatex'
def get_command_description(path, name):
""" Return the description for a command, by parsing its synopsis line """
with open(path) as fd:
for line in fd:
if line.startswith(name + " - "):
_, desc = line.split(" - ", 1)
with open(path) as opened:
for line in opened:
if line.startswith(name + ' - '):
_, desc = line.split(' - ', 1)
return desc.strip()
elif line.startswith('``' + name + '`` - '):
_, desc = line.split('`` - ', 1)
return desc.strip('`')
raise SphinxWarning("No description in file %s" % os.path.basename(path))
# Newer sphinxen apparently create another subdirectory which breaks our man lookup.