mirror of
https://github.com/fish-shell/fish-shell.git
synced 2026-04-19 23:21:15 -03:00
As reported in
https://matrix.to/#/!YLTeaulxSDauOOxBoR:matrix.org/$CLuoHTdvcRj_8-HBBq0p-lmGWeix5khEtKEDxN2Ulfo
Running
fish -C '
fzf_key_bindings
echo fish_vi_key_bindings >>~/.config/fish/config.fish
fzf-history-widget
'
and pressing "enter" will add escape sequences like "[2 q" (cursor shape)
to fish's command line.
This is because fzf-history-widget binds "enter" to a filter
that happens to be a fish script:
set -lx FZF_DEFAULT_OPTS \
... \
"--bind='enter:become:string replace -a -- \n\t \n {2..} | string collect'" \
'--with-shell='(status fish-path)\\ -c)
The above ~/.config/fish/config.fish (redundantly) runs "fish_vi_key_bindings"
even in *noninteractive* shells, then "fish_vi_cursor" will print cursor
sequences in its "fish_exit" handler. The sequence is not printed to the
terminal but to fzf which doesn't parse CSI commands.
This is a regression introduced by a5dfa84f73 (fish_vi_cursor: skip if stdin
is not a tty, 2023-11-14). That commit wanted "fish -c read" to be able to
use Vi cursor. This is a noninteractive shell, but inside "read" we are
"effectively interactive". However "status is-interactive" does not tell
us that.
Let's use a more contained fix to make sure that we print escape sequences only
if either fish is interactive, or if we are evaluating an interactive read.
In general, "fish -c read" is prone to configuration errors, since we
recommend gating configuration (for bind etc) on "status is-interactive"
which will not run here.
115 lines
4.6 KiB
ReStructuredText
115 lines
4.6 KiB
ReStructuredText
.. _cmd-status:
|
|
|
|
status - query fish runtime information
|
|
=======================================
|
|
|
|
Synopsis
|
|
--------
|
|
|
|
.. synopsis::
|
|
|
|
status
|
|
status is-login
|
|
status is-interactive
|
|
status is-interactive-read
|
|
status is-block
|
|
status is-breakpoint
|
|
status is-command-substitution
|
|
status is-no-job-control
|
|
status is-full-job-control
|
|
status is-interactive-job-control
|
|
status current-command
|
|
status current-commandline
|
|
status filename
|
|
status basename
|
|
status dirname
|
|
status fish-path
|
|
status function
|
|
status line-number
|
|
status stack-trace
|
|
status job-control CONTROL_TYPE
|
|
status features
|
|
status test-feature FEATURE
|
|
status buildinfo
|
|
|
|
Description
|
|
-----------
|
|
|
|
With no arguments, ``status`` displays a summary of the current login and job control status of the shell.
|
|
|
|
The following operations (subcommands) are available:
|
|
|
|
**is-command-substitution**, **-c** or **--is-command-substitution**
|
|
Returns 0 if fish is currently executing a command substitution.
|
|
|
|
**is-block**, **-b** or **--is-block**
|
|
Returns 0 if fish is currently executing a block of code.
|
|
|
|
**is-breakpoint**
|
|
Returns 0 if fish is currently showing a prompt in the context of a :doc:`breakpoint <breakpoint>` command. See also the :doc:`fish_breakpoint_prompt <fish_breakpoint_prompt>` function.
|
|
|
|
**is-interactive**, **-i** or **--is-interactive**
|
|
Returns 0 if fish is interactive - that is, connected to a keyboard.
|
|
|
|
**is-interactive-read** or **--is-interactive-read**
|
|
Returns 0 if fish is running an interactive :doc:`read <read>` builtin which is connected to a keyboard.
|
|
|
|
**is-login**, **-l** or **--is-login**
|
|
Returns 0 if fish is a login shell - that is, if fish should perform login tasks such as setting up :envvar:`PATH`.
|
|
|
|
**is-full-job-control** or **--is-full-job-control**
|
|
Returns 0 if full job control is enabled.
|
|
|
|
**is-interactive-job-control** or **--is-interactive-job-control**
|
|
Returns 0 if interactive job control is enabled.
|
|
|
|
**is-no-job-control** or **--is-no-job-control**
|
|
Returns 0 if no job control is enabled.
|
|
|
|
**current-command**
|
|
Prints the name of the currently-running function or command, like the deprecated :envvar:`_` variable.
|
|
|
|
**current-commandline**
|
|
Prints the entirety of the currently-running commandline, inclusive of all jobs and operators.
|
|
|
|
**filename**, **current-filename**, **-f** or **--current-filename**
|
|
Prints the filename of the currently-running script. If the current script was called via a symlink, this will return the symlink. If the current script was received by piping into :doc:`source <source>`, then this will return ``-``.
|
|
|
|
**basename**
|
|
Prints just the filename of the running script, without any path components before.
|
|
|
|
**dirname**
|
|
Prints just the path to the running script, without the actual filename itself. This can be relative to :envvar:`PWD` (including just "."), depending on how the script was called. This is the same as passing the filename to ``dirname(3)``. It's useful if you want to use other files in the current script's directory or similar.
|
|
|
|
**fish-path**
|
|
Prints the absolute path to the currently executing instance of fish. This is a best-effort attempt and the exact output is down to what the platform gives fish. In some cases you might only get "fish".
|
|
|
|
**function** or **current-function**
|
|
Prints the name of the currently called function if able, when missing displays "Not a function" (or equivalent translated string).
|
|
|
|
**line-number**, **current-line-number**, **-n** or **--current-line-number**
|
|
Prints the line number of the currently running script.
|
|
|
|
**stack-trace**, **print-stack-trace**, **-t** or **--print-stack-trace**
|
|
Prints a stack trace of all function calls on the call stack.
|
|
|
|
**job-control**, **-j** or **--job-control** *CONTROL_TYPE*
|
|
Sets the job control type to *CONTROL_TYPE*, which can be **none**, **full**, or **interactive**.
|
|
|
|
**features**
|
|
Lists all available feature flags.
|
|
|
|
**test-feature** *FEATURE*
|
|
Returns 0 when FEATURE is enabled, 1 if it is disabled, and 2 if it is not recognized.
|
|
|
|
**buildinfo**
|
|
This prints information on how fish was build - which architecture, which build system or profile was used, etc.
|
|
This is mainly useful for debugging.
|
|
|
|
Notes
|
|
-----
|
|
|
|
For backwards compatibility most subcommands can also be specified as a long or short option. For example, rather than ``status is-login`` you can type ``status --is-login``. The flag forms are deprecated and may be removed in a future release (but not before fish 4.0).
|
|
|
|
You can only specify one subcommand per invocation even if you use the flag form of the subcommand.
|