Only the first non-switch parameter to python must be a .py file, but
everything thereafter is "just another argument". This enables file
completions for 2nd+ arguments.
Akin to __fish_complete_suffix, __fish_complete_directories now attempts
to complete the current commandline token if no token is explicitly
passed in as an argument.
The prompt is a fallback that is overridden via a function file
anyway.
Do that with the title as well, so we can use just builtins.
This removes error messages when $fish_function_path is borked.
Introduced by #4849 (add wait for processes by name)
../src/builtin_wait.cpp:23:14: warning: using the result of an assignment as a condition without parentheses [-Wparentheses]
while (j = jobs.next()) {
~~^~~~~~~~~~~~~
../src/builtin_wait.cpp:23:14: note: place parentheses around the assignment to silence this warning
while (j = jobs.next()) {
^
( )
../src/builtin_wait.cpp:23:14: note: use '==' to turn this assignment into an equality comparison
while (j = jobs.next()) {
^
==
1 warning generated.
Turns out that `make -pn` actually takes a while - about 300ms on
fish's makefile.
That's quite a bit of time just to throw away the output and use the
exit code.
So we just check for "GNU" in the version string.
It would be nice to just _do_ the completion and fall back on the
BSD-style if it doesn't work, but that is tricky to do with the pipe
to `awk` - the awk expression actually does not fail if `make` does
not print output.
And I don't know enough about awk to change that.
While this is a bit faster (mostly because it needs less processing on fish's side),
it lacks the neat description bit and the ":/" stuff doesn't work.
The boost is also not large in absolute terms (a few milliseconds).
This reverts commit 1f8e4dad9f.
This uses the same logic that git uses to determine the satus of files
and doesn't require any parsing on our end. Brings in support for
relative paths (such as `git add ../f<TAB>`). Should be faster and more
reliable than manually parsing porcelain status.
This doesn't support as many cases as the old `__git_ls_files` function
did (e.g. `renamed` is not supported, nor is `added`), both of which
_can_ be implemented on top of the new logic - but neither of which were
actually being used, anyway.
Usefulness is decreased by #4970, speed still bottlenecked by #4969.
cc @faho
This is based on what the official git completions do, and it's quite
fast.
Also only complete files after a "--" separator for `checkout`.
Fixes#4858.
This is much quicker - on the order of 100ms vs 50ms.
We shorten to 10 characters, which is statistically suitable - 3 out
of 600k commits in the linux kernel need 11 characters.
Turns out the segfaults we've been getting in our tests are because we set $TERM to "dumb".
So we only clear the line if the terminal isn't dumb.
This reverts commit 745a88f2f6.
Fixes#2320.
One key use of process expansion, used in currently-shipped code, is for running a function on
current shell exit.
Restore the use of %self as a valid argument (and add `self`) and document this change.
(faho: Remove bare "self")
For usage in completion scripts.
Unlike `__fish_is_first_token` (which is probably not correctly named),
`__fish_is_first_arg` returns true regardless of whether existing tokens start with `-`
or not, to be used when an arg cannot be used with any other argument.
`__fish_prev_arg_in` is similar to `__fish_seen_...` but it explicitly
tests the preceding token only, for arguments that take only a single
parameter.
This enables users to opt in (or out) of specific features by setting
the fish_features environment variable.
For example `set -U fish_features stderr-nocaret` to opt into removing the
caret redirection.
This partially reverts 5b489ca30f, with
carets acting as redirections unless the stderr-nocaret flag is set.
This flag is off by default but may be enabled on the command line:
fish --features stderr-nocaret
This introduces a new command line option --features which can be used for
enabling or disabling features for a particular fish session.
Examples:
fish --features stderr-nocaret
fish --features 3.0,no-stderr-nocaret
fish --features all
Note that the feature set cannot be changed in an existing session.
This teaches the status command to work with features.
'status features' will show a table listing all known features and whether
they are currently on or off.
`status test-feature` will test an individual feature, setting the exit status to
0 if the feature is on, 1 if off, 2 if unknown.
This introduces a new type features_t that exposes feature flags. The intent
is to allow a deprecation/incremental adoption path. This is not a general
purpose configuration mechanism, but instead allows for compatibility during
the transition as features are added/removed.
Each feature has a user-presentable short name and a short description. Their
values are tracked in a struct features_t.
We start with one feature stderr_nocaret, but it's not hooked up yet.
As it turns out, for some terminals backspace is \b but only when
preceded by \e.
All this makes about as much sense as the english language.
Fixes#4955.
This was done in share/config.fish, but leads to surprising results if
that isn't read - e.g. because someone just built fish in the git
directory to test it without installing.
It's also not something that is any more or less complicated.
For compatibility, keep it in config.fish as well for the time being.