This behavior matches the way completions are found for `cargo run`,
`cargo test`, etc., and is more robust and correct compared to looking
at filenames.
This was supposed to act like `type -q` or `command -q`, in that it
returns 0 if at least 1 exists.
But because it used the wrong variable it didn't.
Fixes#8431.
Foot has several terminfos:
* foot - the default one
* foot-direct - 24-bit color terminfo, similar to xterm-direct (used by e.g. emacs)
* foot-extra - alternative to the ncurses provided terminfo, with a couple of extra, non-standard
capabilities
* foot-extra-direct - 24-bit color version of the above
There may also be other distro-custom terminfo names (serving the same purpose as foot-extra*)
Otherwise, with a light-theme, the selected entry uses black text with
"bright black" background, which can be low contrast thus hard to read.
The description background is different, maybe we can fix that later.
See #8376
This is nroff/groff being broken. It turns "→" into "â". This is even if we select `-Tutf8` and friends.
So, if mandoc exists, we prefer that, and otherwise, run preconv on
the file first (if it exists).
Really, what we would need to to is tell nroff to pass `-KUTF-8` to
groff, but that doesn't appear to be possible.
- Introduce BUILTIN_ERR_COMBO2_EXCLUSIVE
- Distill generally more terse, unambiguous error descriptions.
Remember English is not everyone's language.
- Do not capitalize sentence fragments
- Use the modality where problem input is in a %s: prefix, then
is explained.
- Do not address the user (the "You cannot do ..." kraderism)
- Spell out 'arguments' rather than 'args' for consistency
- Mention 'function' as a scope
This basically disables syntax highlighting. That doesn't mean we use
absolutely no colors - the search match, suggestion, selection and the
pager have coloring, but only reverse or brblack.
The idea is that this disables anything that tells you about
the *syntax*, but it still tells you about the state of the
commandline. If we didn't highlight the selection it would be entirely
invisible, and if we didn't highlight the suggestion you would have no
idea where it begins.
So this basically brings colors on-par with bash, where the search
match is colored (in reverse) and suggestions aren't a thing.
An alternative is to add a $fish_highlighting_enabled variable like
the one for suggestions. That's still possible, but would require some
internal changes to avoid coloring some things with $fish_color_normal
and other things with the normal terminal color.
One thing this also does not do is set the git prompt colors. These
are currently disallowed from being set in theme files because they
start with `__fish` instead of just `fish`. We should probably rename
them.
This program uses the Cobra framework for argument parsing and completion generation.
Just source the completions supplied by upstream.
This works around "go install" not being able to install completions files (only binaries).
Usually local branches have remote branches with the same name, and in
completion they are currently overshadowed by unique remote branches, making
local branches hard to find. Define local branch completion after unique
remote branch completion to show local branches before unique remote branches.
If $xdg_chache_home is empty, this is not a valid fish expression:
[ \( -z \) -o \( ! -d \) ]
and results into an error.
While at it, also use $XDG_CACHE_HOME if that directory does not exist.
This seems better than falling back to $HOME/.cache, which the user has
explicitly overridden via $XDG_CACHE_HOME.
In 'simple terminal' the delete key prints \e[P by default, which is
related to the different approach the authors of st are taking on the
matter of shell configuration. The main problem is the malfunction of
the delete key, so we have to use a workaround like this.
Suggest files to "man -l", but only if the "-l" option is supported
(so not on BSD). Technically we should accept multiple files but this
seems good enough.
Also suggest files when the token-at-cursor contains a slash, because
man will treat arguments as file paths if they contain a /.
git-status --porcelain prints status letter T when a file changed type
between either regular file, symlink or submodule. It can occur in
exactly the same cases as M (modified), so extend the fix for #8311
accordingly.
For submodules, our completions are probably not always correct,
hopefully those cases are rare.
This is weirdly undocumented (as of git 2.33.0), but `git status` prints a "T" state if
the file has its "T"ype changed, e.g. from a regular file to a symlink.
For our purposes that's just another kind of modification.
Fixes#8311.
* Hide whatis database building from the user
It's really an internal detail, but shows up in prompts that display how many
background jobs are running.
By disowning it keeps running but won't show up in `jobs` or get killed if the user
exits the shell.
* Update __fish_apropos.fish
The less -F / --quit-if-one-screen option is buggy before v530. To work
around this, pass --no-init less versions older than 530.
The --no-init option was previously passed; it was removed in d15a51897d
for mouse support. Unfortunately it looks like we can't have mouse
support and --quit-if-one-screen on macOS shipped less (version 487).
It's worth fixing this because otherwise history and help is just not
printed on stock macOS.
Relevant is https://unix.stackexchange.com/questions/107315/less-quit-if-one-screen-without-no-initFixes#8157.
Commit c3374ffd0 ("Use read --tokenize instead of eval for $BROWSER &
$EDITOR") converted uses of "eval" for environment variables to use the
safer "read -at", which performs word splitting but no other expansion.
funced contained a leftover instance of "eval". Remove it in favor
of using the editor command that was already word-split.
This means that we don't accidentally evaluate the file name.
(Also "set -gx EDITOR=~/my-editor" won't work anymore because the ~
is not expanded anymore but no one has complained about that behavior
in edit_command_buffer.)
Fixes#8289
*Problem:*
edit_command_buffer uses `cat` to return the modified content.
If a person has an alias for `cat` to a different command such `bat`** the editing will not be useful anymore since bat decorates the text with frames, line counts, etc
*Solution*
Appending command to cat, fish will ignore the alias and execute the real command according to this https://fishshell.com/docs/current/cmds/command.html
** https://github.com/sharkdp/bat
* Fix ls.fish: add -l option to GNU ls
* Sort alphabetically and remove --lcontext and --scontext (what are these?) on shared and GNU part.
* Revert --lcontext and --scontext options.
This should add all the sections that aren't linked internally,
including "identifiers".
(also give up on the line breaking because it makes it annoying to do
automatically)
Fixes#8245.
This was semi-automated with
```fish
for file in $argv
set -l varname (string replace -r '.*/(.*).html' '$1' -- $file | string escape --style=var)pages
set -l sections (string replace -rf '.*class="headerlink" href="#([^"]*)".*' '$1' <$file)
echo set -l $varname $sections
end
```
(where $argv contains the path to faq, fish_for_bash_users,
interactive, language and tutorial.html)
Building help.fish at compile time would work, but only for users who
build the docs.
The same hack that is used for `pkg remove <foo>` is required here, too.
Due to the massive number of results, we use `head -n 250` to prevent
the completion from hanging or the shell from being overencumbered by
too many possibe completions. However, this would only generate matches
for any of the first 250 packages, rather than printing the first 250
packages that match.
[ci skip]
As functions know where they are loaded from now, there is no point in
them being marked as loaded from a temporary file that has been removed.
Source the function via a redirect instead.
support for ping from iputils (version 20210202)
support for ping from inetutils (version 2.1)
support for ping from busybox (version 1.33.1)
support for ping from FreeBSD and macOS (by @juntuu)
Ubuntu's fish package on WSL 1 has xsel as recommended dependency,
even though there is no X server available. This change makes us
use Windows' native clipboard even when xsel is installed.
We keep __fish_is_nth_token for compatibility and edit the
implementations of __fish_is_nth_token, __fish_is_first_token and
__fish_is_token_n to use fish_is_nth_token
Using `complete -F -c git -n __fish_git_needs_subcommand -a $command -d
$description` causes file completions to be forced on entire git command
which is not a desired result. Morever without the `-F` flag file
completions work just as expected and is useless addition
This injected filenames into fish script, which could inject things
that looked like fish script.
E.g. create a file called `~/.config/fish/themes/"; rm -rf ~/*"`.
Note that the prompts are all shipped by us, but the themes can
technically be added by the user, and they might not be dilligent in
what filenames they allow.
`fish_config theme`:
- `list` to list all available themes (files in the two theme
directories - either the web_config/themes one or
~/.config/fish/themes!)
- `show` to show select (or all) themes right in the terminal - this
starts another fish that reads the theme file and prints the sample
text, manually colored
- `choose` to load a theme *now*, setting the variables globally
- `save` to load a theme and save the variables universally
- `dump` to write the current theme in .theme format (to stdout)
- `demo` to display the current theme
In the variable handler, we just go through the entire thing and keep
every element once.
If there's a duplicate, we set it again, which calls the handler
again.
This takes a bit of time, to be paid on each startup. On my system,
with 100 already deduplicated elements, that's about 4ms (compared to
~17ms for adding them to $PATH).
It's also semantically more complicated - now this variable
specifically is deduplicated? Do we just want "unique" variables that
can't have duplicates?
However: This entirely removes the pathological case of appending to
$fish_user_paths in config.fish (which should be an FAQ entry!), and the implementation is quite simple.