mirror of
https://github.com/fish-shell/fish-shell.git
synced 2025-02-22 03:10:11 +08:00
docs: use monospace for inline code snippets more consistently
This commit is contained in:
parent
5ff2d38d4c
commit
4081d58577
@ -27,7 +27,7 @@ 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`` 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.
|
||||
|
||||
- ``-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.
|
||||
|
||||
|
@ -224,7 +224,7 @@ For instance, the control key modifies a character by setting the top three bits
|
||||
- Many characters + control are indistinguishable from other keys. :kbd:`Control`\ +\ :kbd:`I` *is* tab, :kbd:`Control`\ +\ :kbd:`J` *is* newline (`\n`).
|
||||
- Control and shift don't work simultaneously
|
||||
|
||||
Other keys don't have a direct encoding, and are sent as escape sequences. For example :kbd:`→` (Right) often sends `\e\[C`. These can differ from terminal to terminal, and the mapping is typically available in `terminfo(5)`. Sometimes however a terminal identifies as e.g. `xterm-256color` for compatibility, but then implements xterm's sequences incorrectly.
|
||||
Other keys don't have a direct encoding, and are sent as escape sequences. For example :kbd:`→` (Right) often sends ``\e\[C``. These can differ from terminal to terminal, and the mapping is typically available in `terminfo(5)`. Sometimes however a terminal identifies as e.g. ``xterm-256color`` for compatibility, but then implements xterm's sequences incorrectly.
|
||||
|
||||
.. _cmd-bind-escape:
|
||||
|
||||
|
@ -37,7 +37,7 @@ The following options change what part of the commandline is printed or updated:
|
||||
|
||||
- ``-b`` or ``--current-buffer`` select the entire buffer, including any displayed autosuggestion (default)
|
||||
|
||||
- ``-j`` or ``--current-job`` select the current job - a `job` here is one pipeline. It stops at logical operators or terminators (`;`, `&` or newlines).
|
||||
- ``-j`` or ``--current-job`` select the current job - a `job` here is one pipeline. It stops at logical operators or terminators (``;``, ``&`` or newlines).
|
||||
|
||||
- ``-p`` or ``--current-process`` select the current process - a `process` here is one simple command. It stops at logical operators, terminators or pipes.
|
||||
|
||||
@ -77,11 +77,11 @@ If the commandline contains
|
||||
|
||||
(with the cursor on the "o" of "flounder")
|
||||
|
||||
The `echo $flounder >&` is the first process, `less` the second and `and echo $catfish` the third.
|
||||
The ``echo $flounder >&`` is the first process, ``less`` the second and ``and echo $catfish`` the third.
|
||||
|
||||
`echo $flounder >&2 | less` is the first job, `and echo $catfish` the second.
|
||||
``echo $flounder >&2 | less`` is the first job, ``and echo $catfish`` the second.
|
||||
|
||||
`$flounder` is the current token.
|
||||
``$flounder`` is the current token.
|
||||
|
||||
More examples:
|
||||
|
||||
|
@ -65,7 +65,7 @@ There are numerous customization options, which can be controlled with git optio
|
||||
|
||||
A number of variables set characters and color used as indicators. Many of these have a different default if used with informative status enabled, or ``$__fish_git_prompt_use_informative_chars`` set. The usual default is given first, then the informative default (if it is different). If no default for the colors is given, they default to ``$__fish_git_prompt_color``.
|
||||
|
||||
- ``$__fish_git_prompt_char_stateseparator`` (' ', `|`) - the character to be used between the state characters
|
||||
- ``$__fish_git_prompt_char_stateseparator`` (' ', ``|``) - the character to be used between the state characters
|
||||
- ``$__fish_git_prompt_color`` (no default)
|
||||
- ``$__fish_git_prompt_color_prefix`` - the color of the ``(`` prefix
|
||||
- ``$__fish_git_prompt_color_suffix`` - the color of the ``)`` suffix
|
||||
|
@ -14,7 +14,7 @@ Synopsis
|
||||
Description
|
||||
-----------
|
||||
|
||||
``fish_indent`` is used to indent a piece of fish code. ``fish_indent`` reads commands from standard input or the given filenames and outputs them to standard output or a specified file (if `-w` is given).
|
||||
``fish_indent`` is used to indent a piece of fish code. ``fish_indent`` reads commands from standard input or the given filenames and outputs them to standard output or a specified file (if ``-w`` is given).
|
||||
|
||||
The following options are available:
|
||||
|
||||
|
@ -42,7 +42,7 @@ Valid format specifiers are taken from the C library function ``printf(3)``:
|
||||
|
||||
``%%`` signifies a literal "%".
|
||||
|
||||
Conversion can fail, e.g. "102.234" can't losslessly convert to an integer, causing printf to print an error. If you are okay with losing information, silence errors with `2>/dev/null`.
|
||||
Conversion can fail, e.g. "102.234" can't losslessly convert to an integer, causing printf to print an error. If you are okay with losing information, silence errors with ``2>/dev/null``.
|
||||
|
||||
A number between the ``%`` and the format letter specifies the width. The result will be left-padded with spaces.
|
||||
|
||||
@ -68,7 +68,7 @@ printf also knows a number of backslash escapes:
|
||||
|
||||
Errors and Return Status
|
||||
------------------------
|
||||
If the given argument doesn't work for the given format (like when you try to convert a number like `3.141592` to an integer), printf prints an error, to stderr. printf will then also return non-zero, but will still try to print as much as it can.
|
||||
If the given argument doesn't work for the given format (like when you try to convert a number like 3.141592 to an integer), printf prints an error, to stderr. printf will then also return non-zero, but will still try to print as much as it can.
|
||||
|
||||
It will also return non-zero if no argument at all was given, in which case it will print nothing.
|
||||
|
||||
@ -87,7 +87,7 @@ Will print "flounder fish" (separated with a tab character), followed by a newli
|
||||
|
||||
printf '%s: %d' "Number of bananas in my pocket" 42
|
||||
|
||||
Will print "Number of bananas in my pocket: 42", _without_ a newline.
|
||||
Will print "Number of bananas in my pocket: 42", `without` a newline.
|
||||
|
||||
See Also
|
||||
--------
|
||||
@ -96,4 +96,4 @@ See Also
|
||||
|
||||
Footnotes
|
||||
---------
|
||||
.. [#] (in fact while fish's ``echo`` supports ``--``, POSIX forbids it, so other implementations can't be used if the input contains anything starting with `-`)
|
||||
.. [#] (in fact while fish's ``echo`` supports ``--``, POSIX forbids it, so other implementations can't be used if the input contains anything starting with ``-``)
|
||||
|
@ -30,9 +30,9 @@ The following options are available:
|
||||
- ``-n NCHARS`` or ``--nchars=NCHARS`` makes ``read`` return after reading NCHARS characters or the end of
|
||||
the line, whichever comes first.
|
||||
|
||||
- ``-p PROMPT_CMD`` or ``--prompt=PROMPT_CMD`` uses the output of the shell command ``PROMPT_CMD`` as the prompt for the interactive mode. The default prompt command is `set_color green; echo read; set_color normal; echo "> "`
|
||||
- ``-p PROMPT_CMD`` or ``--prompt=PROMPT_CMD`` uses the output of the shell command ``PROMPT_CMD`` as the prompt for the interactive mode. The default prompt command is ``set_color green; echo read; set_color normal; echo "> "``
|
||||
|
||||
- ``-P PROMPT_STR`` or ``--prompt-str=PROMPT_STR`` uses the string as the prompt for the interactive mode. It is equivalent to `echo PROMPT_STR` and is provided solely to avoid the need to frame the prompt as a command. All special characters in the string are automatically escaped before being passed to the :ref:`echo <cmd-echo>` command.
|
||||
- ``-P PROMPT_STR`` or ``--prompt-str=PROMPT_STR`` uses the string as the prompt for the interactive mode. It is equivalent to ``echo PROMPT_STR`` and is provided solely to avoid the need to frame the prompt as a command. All special characters in the string are automatically escaped before being passed to the :ref:`echo <cmd-echo>` command.
|
||||
|
||||
- ``-R RIGHT_PROMPT_CMD`` or ``--right-prompt=RIGHT_PROMPT_CMD`` uses the output of the shell command ``RIGHT_PROMPT_CMD`` as the right prompt for the interactive mode. There is no default right prompt command.
|
||||
|
||||
|
@ -326,8 +326,8 @@ If you are familiar with these, it is useful to know how ``string`` differs from
|
||||
|
||||
In contrast to these classics, ``string`` reads input either from stdin or as arguments. ``string`` also does not deal with files, so it requires redirections to be used with them.
|
||||
|
||||
In contrast to ``grep``, ``string``\ s `match` defaults to glob-mode, while `replace` defaults to literal matching. If set to regex-mode, they use PCRE regular expressions, which is comparable to ``grep``\ s `-P` option. `match` defaults to printing just the match, which is like ``grep`` with `-o` (use `--entire` to enable grep-like behavior).
|
||||
In contrast to ``grep``, ``string``'s ``match`` defaults to glob-mode, while ``replace`` defaults to literal matching. If set to regex-mode, they use PCRE regular expressions, which is comparable to ``grep``'s ``-P`` option. ``match`` defaults to printing just the match, which is like ``grep`` with ``-o`` (use ``--entire`` to enable grep-like behavior).
|
||||
|
||||
Like ``sed``\ s `s/` command, ``string replace`` still prints strings that don't match. ``sed``\ s `-n` in combination with a `/p` modifier or command is like ``string replace -f``.
|
||||
Like ``sed``'s ``s/old/new/`` command, ``string replace`` still prints strings that don't match. ``sed``'s ``-n`` in combination with a ``/p`` modifier or command is like ``string replace -f``.
|
||||
|
||||
``string split somedelimiter`` is a replacement for ``tr somedelimiter \n``.
|
||||
|
@ -17,7 +17,7 @@ Description
|
||||
|
||||
For checking timing after a command has completed, check :ref:`$CMD_DURATION <variables-special>`.
|
||||
|
||||
Your system most likely also has a `time` command. To use that use something like `command time`, as in `command time sleep 10`. Because it's not inside fish, it won't have access to fish functions and won't be able to time blocks and such.
|
||||
Your system most likely also has a ``time`` command. To use that use something like ``command time``, as in ``command time sleep 10``. Because it's not inside fish, it won't have access to fish functions and won't be able to time blocks and such.
|
||||
|
||||
Example
|
||||
-------
|
||||
|
@ -97,14 +97,14 @@ If you want to modify your existing prompt, you can use :ref:`funced <cmd-funced
|
||||
|
||||
This also applies to :ref:`fish_right_prompt <cmd-fish_right_prompt>` and :ref:`fish_mode_prompt <cmd-fish_mode_prompt>`.
|
||||
|
||||
Why does my prompt show a `[I]`?
|
||||
--------------------------------
|
||||
Why does my prompt show a ``[I]``?
|
||||
----------------------------------
|
||||
|
||||
That's the :ref:`fish_mode_prompt <cmd-fish_mode_prompt>`. It is displayed by default when you've activated vi mode using ``fish_vi_key_bindings``.
|
||||
|
||||
If you haven't activated vi mode on purpose, you might have installed a third-party theme that does it.
|
||||
|
||||
If you want to change or disable this display, modify the `fish_mode_prompt` function, for instance via :ref:`funced <cmd-funced>`.
|
||||
If you want to change or disable this display, modify the ``fish_mode_prompt`` function, for instance via :ref:`funced <cmd-funced>`.
|
||||
|
||||
How do I customize my syntax highlighting colors?
|
||||
-------------------------------------------------
|
||||
@ -147,7 +147,7 @@ Why doesn't history substitution ("!$" etc.) work?
|
||||
--------------------------------------------------
|
||||
Because history substitution is an awkward interface that was invented before interactive line editing was even possible. Instead of adding this pseudo-syntax, fish opts for nice history searching and recall features. Switching requires a small change of habits: if you want to modify an old line/word, first recall it, then edit.
|
||||
|
||||
As a special case, most of the time history substitution is used as ``sudo !!``. In that case just press :kbd:`Alt`\ +\ :kbd:`S`, and it will recall your last commandline with `sudo` prefixed (or toggle a `sudo` prefix on the current commandline if there is anything).
|
||||
As a special case, most of the time history substitution is used as ``sudo !!``. In that case just press :kbd:`Alt`\ +\ :kbd:`S`, and it will recall your last commandline with ``sudo`` prefixed (or toggle a ``sudo`` prefix on the current commandline if there is anything).
|
||||
|
||||
In general, fish's history recall works like this:
|
||||
|
||||
|
@ -216,7 +216,7 @@ Some characters can not be written directly on the command line. For these chara
|
||||
- ``\$`` escapes the dollar character
|
||||
- ``\\`` escapes the backslash character
|
||||
- ``\*`` escapes the star character
|
||||
- ``\?`` escapes the question mark character (this is not necessary if the `qmark-noglob` :ref:`feature flag<featureflags>` is enabled)
|
||||
- ``\?`` escapes the question mark character (this is not necessary if the ``qmark-noglob`` :ref:`feature flag<featureflags>` is enabled)
|
||||
- ``\~`` escapes the tilde character
|
||||
- ``\#`` escapes the hash character
|
||||
- ``\(`` escapes the left parenthesis character
|
||||
@ -322,7 +322,7 @@ will attempt to build ``fish``, and any errors will be shown using the ``less``
|
||||
|
||||
As a convenience, the pipe ``&|`` redirects both stdout and stderr to the same process. (Note this is different from bash, which uses ``|&``).
|
||||
|
||||
.. [#] A "pager" here is a program that takes output and "paginates" it. `less` doesn't just do pages, it allows arbitrary scrolling (even back!).
|
||||
.. [#] A "pager" here is a program that takes output and "paginates" it. ``less`` doesn't just do pages, it allows arbitrary scrolling (even back!).
|
||||
|
||||
.. _syntax-background:
|
||||
|
||||
@ -568,11 +568,11 @@ Command substitution
|
||||
|
||||
The output of a command (or an entire :ref:`pipeline <pipes>`) can be used as the arguments to another command.
|
||||
|
||||
When you write a command in parenthesis like ``outercommand (innercommand)``, the `innercommand` will be executed first. Its output will be taken and each line given as a separate argument to `outercommand`, which will then be executed. [#]_
|
||||
When you write a command in parenthesis like ``outercommand (innercommand)``, the ``innercommand`` will be executed first. Its output will be taken and each line given as a separate argument to ``outercommand``, which will then be executed. [#]_
|
||||
|
||||
If the output is piped to :ref:`string split or string split0 <cmd-string-split>` as the last step, those splits are used as they appear instead of splitting lines.
|
||||
|
||||
The exit status of the last run command substitution is available in the `status <#variables-status>`_ variable if the substitution happens in the context of a :ref:`set <cmd-set>` command (so `if set -l (something)` checks if `something` returned true).
|
||||
The exit status of the last run command substitution is available in the `status <#variables-status>`_ variable if the substitution happens in the context of a :ref:`set <cmd-set>` command (so ``if set -l (something)`` checks if ``something`` returned true).
|
||||
|
||||
Only part of the output can be used, see :ref:`index range expansion <expand-index-range>` for details.
|
||||
|
||||
@ -663,7 +663,7 @@ In the simplest case, this is just something like::
|
||||
|
||||
echo $HOME
|
||||
|
||||
which will replace `$HOME` with the home directory of the current user, and pass it to :ref:`echo <cmd-echo>`, which will then print it.
|
||||
which will replace ``$HOME`` with the home directory of the current user, and pass it to :ref:`echo <cmd-echo>`, which will then print it.
|
||||
|
||||
Sometimes a variable has no value because it is undefined or empty, and it expands to nothing::
|
||||
|
||||
@ -846,7 +846,7 @@ However using variables as indices for command substitution is currently not sup
|
||||
set sequence (seq 5) # It needs to be written on two lines like this.
|
||||
echo $sequence[$index] # returns '2'
|
||||
|
||||
When using indirect variable expansion with multiple `$` (``$$name``), you have to give all indices up to the variable you want to slice::
|
||||
When using indirect variable expansion with multiple ``$`` (``$$name``), you have to give all indices up to the variable you want to slice::
|
||||
|
||||
> set -l list 1 2 3 4 5
|
||||
> set -l name list
|
||||
@ -905,7 +905,7 @@ Example::
|
||||
set pants_color red
|
||||
echo Papa smurf, who is $smurf_color, wears $pants_color pants
|
||||
|
||||
So you set a variable with ``set``, and use it with a `$` and the name.
|
||||
So you set a variable with ``set``, and use it with a ``$`` and the name.
|
||||
|
||||
.. _variables-scope:
|
||||
|
||||
@ -1268,7 +1268,7 @@ You can change the settings of fish by changing the values of certain variables.
|
||||
empty string, history is not saved to disk (but is still available within the interactive
|
||||
session).
|
||||
|
||||
- ``fish_trace``, if set and not empty, will cause fish to print commands before they execute, similar to `set -x` in bash. The trace is printed to the path given by the :ref:`--debug-output <cmd-fish>` option to fish (stderr by default).
|
||||
- ``fish_trace``, if set and not empty, will cause fish to print commands before they execute, similar to ``set -x`` in bash. The trace is printed to the path given by the :ref:`--debug-output <cmd-fish>` option to fish (stderr by default).
|
||||
|
||||
- ``fish_user_paths``, a list of directories that are prepended to ``PATH``. This can be a universal variable.
|
||||
|
||||
@ -1286,7 +1286,7 @@ Fish also provides additional information through the values of certain environm
|
||||
|
||||
- ``COLUMNS`` and ``LINES``, the current size of the terminal in height and width. These values are only used by fish if the operating system does not report the size of the terminal. Both variables must be set in that case otherwise a default of 80x24 will be used. They are updated when the window size changes.
|
||||
|
||||
- ``fish_kill_signal``, the signal that terminated the last foreground job, or `0` if the job exited normally.
|
||||
- ``fish_kill_signal``, the signal that terminated the last foreground job, or 0 if the job exited normally.
|
||||
|
||||
- ``fish_pid``, the process ID (PID) of the shell.
|
||||
|
||||
@ -1597,7 +1597,7 @@ Some bindings are shared between emacs- and vi-mode because they aren't text edi
|
||||
|
||||
- :kbd:`Alt`\ +\ :kbd:`V` Same as :kbd:`Alt`\ +\ :kbd:`E`.
|
||||
|
||||
- :kbd:`Alt`\ +\ :kbd:`S` Prepends `sudo` to the current commandline. If the commandline is empty, prepend `sudo` to the last commandline.
|
||||
- :kbd:`Alt`\ +\ :kbd:`S` Prepends ``sudo`` to the current commandline. If the commandline is empty, prepend ``sudo`` to the last commandline.
|
||||
|
||||
- :kbd:`Control`\ +\ :kbd:`Space` Inserts a space without expanding an :ref:`abbreviation <abbreviations>`. For vi-mode this only applies to insert-mode.
|
||||
|
||||
@ -1658,7 +1658,7 @@ It is also possible to add all emacs-mode bindings to vi-mode by using something
|
||||
|
||||
When in vi-mode, the :ref:`fish_mode_prompt <cmd-fish_mode_prompt>` function will display a mode indicator to the left of the prompt. To disable this feature, override it with an empty function. To display the mode elsewhere (like in your right prompt), use the output of the ``fish_default_mode_prompt`` function.
|
||||
|
||||
When a binding switches the mode, it will repaint the mode-prompt if it exists, and the rest of the prompt only if it doesn't. So if you want a mode-indicator in your ``fish_prompt``, you need to erase ``fish_mode_prompt`` e.g. by adding an empty file at `~/.config/fish/functions/fish_mode_prompt.fish`. (Bindings that change the mode are supposed to call the `repaint-mode` bind function, see :ref:`bind <cmd-bind>`)
|
||||
When a binding switches the mode, it will repaint the mode-prompt if it exists, and the rest of the prompt only if it doesn't. So if you want a mode-indicator in your ``fish_prompt``, you need to erase ``fish_mode_prompt`` e.g. by adding an empty file at ``~/.config/fish/functions/fish_mode_prompt.fish``. (Bindings that change the mode are supposed to call the `repaint-mode` bind function, see :ref:`bind <cmd-bind>`)
|
||||
|
||||
The ``fish_vi_cursor`` function will be used to change the cursor's shape depending on the mode in supported terminals. The following snippet can be used to manually configure cursors after enabling vi-mode::
|
||||
|
||||
@ -1675,7 +1675,7 @@ The ``fish_vi_cursor`` function will be used to change the cursor's shape depend
|
||||
|
||||
Additionally, ``blink`` can be added after each of the cursor shape parameters to set a blinking cursor in the specified shape.
|
||||
|
||||
If the cursor shape does not appear to be changing after setting the above variables, it's likely your terminal emulator does not support the capabilities necessary to do this. It may also be the case, however, that `fish_vi_cursor` has not detected your terminal's features correctly (for example, if you are using `tmux`). If this is the case, you can force `fish_vi_cursor` to set the cursor shape by setting `$fish_vi_force_cursor` in `config.fish`. You'll have to restart fish for any changes to take effect. If cursor shape setting remains broken after this, it's almost certainly an issue with your terminal emulator, and not fish.
|
||||
If the cursor shape does not appear to be changing after setting the above variables, it's likely your terminal emulator does not support the capabilities necessary to do this. It may also be the case, however, that ``fish_vi_cursor`` has not detected your terminal's features correctly (for example, if you are using ``tmux``). If this is the case, you can force ``fish_vi_cursor`` to set the cursor shape by setting ``$fish_vi_force_cursor`` in ``config.fish``. You'll have to restart fish for any changes to take effect. If cursor shape setting remains broken after this, it's almost certainly an issue with your terminal emulator, and not fish.
|
||||
|
||||
.. _vi-mode-command:
|
||||
|
||||
@ -1772,9 +1772,9 @@ If you want to be able to press :kbd:`Escape` and then a character and have it c
|
||||
Copy and paste (Kill Ring)
|
||||
--------------------------
|
||||
|
||||
Fish uses an Emacs-style kill ring for copy and paste functionality. For example, use :kbd:`Control`\ +\ :kbd:`K` (`kill-line`) to cut from the current cursor position to the end of the line. The string that is cut (a.k.a. killed in emacs-ese) is inserted into a list of kills, called the kill ring. To paste the latest value from the kill ring (emacs calls this "yanking") use :kbd:`Control`\ +\ :kbd:`Y` (the `yank` input function). After pasting, use :kbd:`Alt`\ +\ :kbd:`Y` (`yank-pop`) to rotate to the previous kill.
|
||||
Fish uses an Emacs-style kill ring for copy and paste functionality. For example, use :kbd:`Control`\ +\ :kbd:`K` (`kill-line`) to cut from the current cursor position to the end of the line. The string that is cut (a.k.a. killed in emacs-ese) is inserted into a list of kills, called the kill ring. To paste the latest value from the kill ring (emacs calls this "yanking") use :kbd:`Control`\ +\ :kbd:`Y` (the ``yank`` input function). After pasting, use :kbd:`Alt`\ +\ :kbd:`Y` (``yank-pop``) to rotate to the previous kill.
|
||||
|
||||
Copy and paste from outside are also supported, both via the :kbd:`Control`\ +\ :kbd:`X` / :kbd:`Control`\ +\ :kbd:`V` bindings (the `fish_clipboard_copy` and `fish_clipboard_paste` functions [#]_) and via the terminal's paste function, for which fish enables "Bracketed Paste Mode", so it can tell a paste from manually entered text.
|
||||
Copy and paste from outside are also supported, both via the :kbd:`Control`\ +\ :kbd:`X` / :kbd:`Control`\ +\ :kbd:`V` bindings (the ``fish_clipboard_copy`` and ``fish_clipboard_paste`` functions [#]_) and via the terminal's paste function, for which fish enables "Bracketed Paste Mode", so it can tell a paste from manually entered text.
|
||||
In addition, when pasting inside single quotes, pasted single quotes and backslashes are automatically escaped so that the result can be used as a single token simply by closing the quote after.
|
||||
|
||||
.. [#] These rely on external tools. Currently xsel, xclip, wl-copy/wl-paste and pbcopy/pbpaste are supported.
|
||||
@ -1897,7 +1897,7 @@ Note that ``~/.config/fish/config.fish`` is sourced `after` the snippets. This i
|
||||
|
||||
These files are all executed on the startup of every shell. If you want to run a command only on starting an interactive shell, use the exit status of the command ``status --is-interactive`` to determine if the shell is interactive. If you want to run a command only when using a login shell, use ``status --is-login`` instead. This will speed up the starting of non-interactive or non-login shells.
|
||||
|
||||
If you are developing another program, you may wish to install configuration which is run for all users of the fish shell on a system. This is discouraged; if not carefully written, they may have side-effects or slow the startup of the shell. Additionally, users of other shells will not benefit from the Fish-specific configuration. However, if they are absolutely required, you may install them to the "vendor" configuration directory. As this path may vary from system to system, the `pkgconfig` framework should be used to discover this path with the output of ``pkg-config --variable confdir fish``.
|
||||
If you are developing another program, you may wish to install configuration which is run for all users of the fish shell on a system. This is discouraged; if not carefully written, they may have side-effects or slow the startup of the shell. Additionally, users of other shells will not benefit from the Fish-specific configuration. However, if they are absolutely required, you may install them to the "vendor" configuration directory. As this path may vary from system to system, the ``pkgconfig`` framework should be used to discover this path with the output of ``pkg-config --variable confdir fish``.
|
||||
|
||||
Examples:
|
||||
|
||||
@ -1979,7 +1979,7 @@ To customize the syntax highlighting, you can set the environment variables list
|
||||
Programmable title
|
||||
------------------
|
||||
|
||||
When using most virtual terminals, it is possible to set the message displayed in the titlebar of the terminal window. This can be done automatically in fish by defining the ``fish_title`` function. The ``fish_title`` function is executed before and after a new command is executed or put into the foreground and the output is used as a titlebar message. The `status current-command` builtin will always return the name of the job to be put into the foreground (or 'fish' if control is returning to the shell) when the ``fish_prompt`` function is called. The first argument to fish_title will contain the most recently executed foreground command as a string, starting with fish 2.2.
|
||||
When using most virtual terminals, it is possible to set the message displayed in the titlebar of the terminal window. This can be done automatically in fish by defining the ``fish_title`` function. The ``fish_title`` function is executed before and after a new command is executed or put into the foreground and the output is used as a titlebar message. The ``status current-command`` builtin will always return the name of the job to be put into the foreground (or ``fish`` if control is returning to the shell) when the ``fish_prompt`` function is called. The first argument to fish_title will contain the most recently executed foreground command as a string, starting with fish 2.2.
|
||||
|
||||
Examples:
|
||||
The default fish title is::
|
||||
|
@ -51,7 +51,7 @@ Fish runs commands like other shells: you type a command, followed by its argume
|
||||
hello world
|
||||
|
||||
|
||||
This runs the command `echo` with the arguments `hello` and `world`.
|
||||
This runs the command ``echo`` with the arguments ``hello`` and ``world``.
|
||||
|
||||
You can include a literal space in an argument with a backslash, or by using single or double quotes::
|
||||
|
||||
@ -151,7 +151,7 @@ You can pipe between commands with the usual vertical bar::
|
||||
1 2 12
|
||||
|
||||
|
||||
stdin and stdout can be redirected via the familiar `<` and `>`. stderr is redirected with a `2>`.
|
||||
stdin and stdout can be redirected via the familiar ``<`` and ``>``. stderr is redirected with a ``2>``.
|
||||
|
||||
|
||||
|
||||
@ -247,7 +247,7 @@ Variable substitution also happens in double quotes, but not single quotes::
|
||||
My current directory is $PWD
|
||||
|
||||
|
||||
Unlike other shells, fish has no dedicated `VARIABLE=VALUE` syntax for setting variables. Instead it has an ordinary command: ``set``, which takes a variable name, and then its value.
|
||||
Unlike other shells, fish has no dedicated ``VARIABLE=VALUE`` syntax for setting variables. Instead it has an ordinary command: ``set``, which takes a variable name, and then its value.
|
||||
|
||||
::
|
||||
|
||||
@ -278,7 +278,7 @@ You can erase (or "delete") a variable with ``-e`` or ``--erase``
|
||||
Exports (Shell Variables)
|
||||
-------------------------
|
||||
|
||||
Sometimes you need to have a variable available to an external command, often as a setting. For example many programs like `git` or `man` read the `$PAGER` variable to figure out your preferred pager (the program that lets you scroll text). Other variables used like this include `$BROWSER`, `$LANG` (to configure your language) and `$PATH`. You'll note these are written in ALLCAPS, but that's just a convention.
|
||||
Sometimes you need to have a variable available to an external command, often as a setting. For example many programs like ``git`` or ``man`` read the ``$PAGER`` variable to figure out your preferred pager (the program that lets you scroll text). Other variables used like this include ``$BROWSER``, ``$LANG`` (to configure your language) and ``$PATH``. You'll note these are written in ALLCAPS, but that's just a convention.
|
||||
|
||||
To give a variable to an external command, it needs to be "exported". Unlike other shells, fish does not have an export command. Instead, a variable is exported via an option to ``set``, either ``--export`` or just ``-x``.
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user