Because macOS' `apropos` is just using grep, and we only need
a prefix match for __fish_describe_command, we can shave off
some ok total execution time here.
No longer uses the __fish_apropos hack on every version of macOS.
Juat Catalina+.
The whatis database generated and replaced daily is 2 megabytes on
my computer, and in ~/.cache on a home dir might wind up on a net
mount or something annoying. or, definitely it's backed up by default.
It's wiser to throw that junk in with other cache files on the system
aka DARWIN_USER_CACHE_DIR, and only use the XDG directory if
someone specifically configured that.
Mainly, this just means at least it won't automatically get backed
up by Time Machine and stuff every day, which is no big deal but
y'know...
Rearranged stuff a little to not shell out every time.
The default vi mode prompt is kind of ugly, mostly because we include
this `[I]` with a super bright green background and white text,
which is particularly grating because most prompts don't actually have
a background.
So we get a ton of people asking "How do I remove this [I]" when they
could really benefit from having the mode shown.
There's a few ways to make this look nicer, the simplest is to just
keep the same colors but use them as foreground instead of background
colors, which looks much more understated.
The mode prompt is important, but not more than the actual contents of
the commandline, so it shouldn't have ALARMING colors.
This allows us to stop descending into untracked directories, which
can be faster.
It's still not *good* - git can still be quite slow here, but if
there's an untracked directory you probably don't care about the
number of files in that.
Fixes#7871.
This is all of the sections in interactive, language and for_bash_users.
The faq names are so long that we're not adding them, also not all of
these have descriptions yet.
Given that we no longer have that massive "index" page with
everything, it's become harder to open the correct section
immediately.
So this hardcodes the section titles for each page in help itself.
This was half-automated with
grep -o 'a class="headerlink" href="#[^"]*"' /usr/share/doc/fish/faq.html | sort -u | string replace -r '.*#' '' | string trim -c '"'
The completions still need to be adjusted.
In vim p means paste *after* current character, so go forward a char before pasting.
Also in vim, P means paste *at* current position (like at '|' with cursor = line),
so there's no need to go back a char, just paste it without moving.
Prior to this commit "builtin -h" would silently fail when no
documentation is installed. This happens when running fish without
installing it, or when the docs are not installed.
See #7824
After a fish installation is upgraded to 3.2.0, active shells could
throw an error attempting to load Git completions. It's just a
transient error but also easily avoidable by using the old style.
See #7822
Previously, this message told the user to "set $BROWSER and try again". However,
when I first saw this error, I didn't know how I can set `BROWSER` in fish. Moreover,
I often see this error in situations when no browser will work. For instance, I might be
using fish over ssh, and I might either not know whether that system has a text-mode
browser installed or not want to use it.
A further improvement would be to report this message if a browser fails to start.
This actually *worked* in my tests which confuses me.
It really shouldn't, `apropos -foo` will complain about "-o" not being
a valid option.
It should be `apropos -- -foo`.
Now, of course there are awful apropos implementations, so let's see
if someone complains
When `fish` is running in the Chrome OS Linux VM (Crostini),
both `help` and `fish_config` opened a "file not found"
page. That is because on Crostini, `BROWSER` is usually set to
`garcon-url-handler`, which opens URLs in the host OS Chrome
browser. That browser lacks access to the Linux file system.
This commit fixes these commands. `help` now opens the URL on
www.fishshell.com. `fish_config` now opens the URL for the
server it starts. Previously, it opened a local file that
redirects to the same URL.
In the case of `help`, the situation could be improved further
by starting a web server to serve help. I don't know of another
way to access `/share/fish` from outside the VM without user
intervention, and I think that might be a part of the security
model for the Crostini VM.
It's hard to write a test for this. I checked that `help math`,
`python2 webconfig.py`, and `python3 webconfig.py` work on my
machine running in Crostini.
This was a handler for various prompt variables that called a repaint.
Unfortunately, if you set one of those *inside* the prompt (a logical
place for it), this would lead to something like #7775.
So, because this isn't actually *useful* as far as I can see (how do
you set these variables in a way that you're not already inside a
prompt or about to draw a prompt? in a key binding?), we remove it,
like we removed the repaint from git's variable handlers.
This `set -e` had a cartesian product that caused it to remove the
indexes separately, so the later indexes were off - removing the first
and then the second ends up removing the first and then the
old-*third* which is now the second.
Just quote the expansion so it runs in one go.
Fixes#7776
Because we removed repaint coalescing, currently setting any of the
git prompt variables in fish_prompt leads to a repaint loop (that
presumably aborts once it reaches the recursion limit).
Since repainting on these variables isn't really useful (when you
`set` them interactively you already get a new prompt), just remove
it.
There's two cases this "breaks":
- When you set a variable *after* the call to fish_git_prompt
- When you set a variable via a binding
In both of these it's not too much to expect an explicit "commandline
-f repaint", especially since for bindings that's already needed in
most cases, and setting a variable after using it isn't normal.
Fixes#7775.
Called as
__fish_print_pipestatus "[foo" "oof]" "|" (set_color green) (set_color --bold blue) 0 1 2
it would make the closing `oof]` bold green.
Fixes#7771.
* Ensure web_config works on WSL
web_config could sometimes fail on WSL if the user chose not to append
windows directories to their linux $PATH. This change ensures that the
cmd.exe executable is found in most cases even if windows directories
are not appended to $PATH on linux.
An error message letting the user know that cmd.exe was not found, and
that they should add the cmd.exe dir to their $PATH before running
fish_config is displayed if cmd.exe is still not found.
* Exit with a non 0 status code if cmd.exe is not found
In this context, as it stands, $last_pid will give fish's pid (because
of pgroup shenanigans).
Since that doesn't really work, just `disown` without and let fish
figure out what the last process was.
Theoretically this has an issue if someone started a background
process *before* the python script *and* that exits before we run
disown.
That's a vanishingly small window and this is only run on first start,
so it seems acceptable.
Fixes#7739.
This still showed the background gradient, which is just a waste and
looks weird.
Instead make the actual content fullscreen (except for the border
radius, for now)
When pasting a multiline command with indented blocks, extra indentation
from spaces, or tabs, is generally undesirable, because fish already indents
pipes and blocks. Discard the indentation unless the cursor or the pasted
part is inside quotes.
Users who copied fish_clipboard_paste need to update it because
__fish_commandline_is_singlequoted had an API change and was renamed.
I ran into problems described in https://github.com/fish-shell/fish-shell/issues/718 when using this prompt. This seems to be a bug in the prompt -- this change fixes it, at least on my system.
I tried this in tmux (TERM=screen) and gnome-terminal (TERM=xterm-256) with fish 3.1.2, on Linux.
__fish_print_commands just prints the commands we have man pages for,
and help uses that to figure out whether it should link
a command or a section. If the docs aren't installed it won't find
anything.
At least check the builtins, because we document them and it's easy.
This probably needs to be added at build time - glob
doc_src/cmds/*.rst.
Some third party Git tools provide a man page, which we can at least use
for completing options.
The old logic excluded all generated completions for Git subcommands.
Instead, try to load completions for all available external subcommands.
We can use $PATH/git-* because /bin/git-add and friends were removed in Git
1.6.0 in 2008.
Closes#4358 (the "git-foo" wrapping was added in #7652)
This was only a thing in cygwin, and only a workaround because
cygwin's hostname was broken in 2013 and our sample prompts called it,
which caused errors in fish_config.
Our sample prompts no longer call `hostname` at all (they use
`prompt_hostname`, which uses the variable), and it's possible
cygwin's hostname was fixed in the meantime.
Fixes#7669.
* completions/userdbctl: init
userdbctl:
Show user and group information.
A part of systemd.
* completions/userdbctl: fix complete services
Complete the services at the completion time.
This goes to a separate file because that makes option parsing easier
and allows profiling both at the same time.
The "normal" profile now contains only the profile data of the actual
run, which is much more useful - you can now profile a function by
running
fish -C 'source /path/to/thing' --profile /tmp/thefunction.prof -c 'thefunction'
and won't need to filter out extraneous information.
We were soucing it manually, and implicitly via the `complete -C "git-foo "`
wrapper. Always use the latter, so fish knows that the completion is already
loaded.
This had a classic float:left layout, which led to awkward gaps and
stuff.
Since what we want here is basically 100% exactly a flexbox, just use that.
Note: No flexbox for the prompts, atm, because having multiple of
those next to each other looks a bit weird.
Since #7075, git-foo.fish files are sourced when Git completions are loaded.
However, at least Cobra (CLI framework for Go) provides completions like
complete git-foo ...
This means that completions are only offered when typing "git-foo <TAB>"
and not on "git foo <TAB>". Fix this by forwarding the completion requests.
Take care to only forward if there are actually completions for "git-foo",
to avoid adding filename completions.
Over in https://github.com/wez/wezterm/issues/115#issuecomment-765869705 one of my users noted that fish had automatic OSC 7, but that it wasn't enabled under WezTerm.
You can detect WezTerm through the `$TERM_PROGRAM` environment. In practical terms, all versions of wezterm in the wild support OSC 7 so a version check is not needed.
I'm not a fish user myself, but I did give the equivalent change to this a try on my Fedora 33 machine (it has an older version of fish).
I can see in this file that there's some stuff with `__fish_enable_focus` that you may also want to enable under wezterm; the escape sequence is supported as are panes, tabs and windows.
* Include completion for all pkg alias subcommands
* Formatting and dynamic evaluation of alias subcommands
* only set package_name completion once
* fixed syntax error
Fix 1: The --quiet flag must be at the end of the command. The way it was I would never get any status symbol in my prompt as the command failed.
Fix 2: After adding files to git, but before committing them, git status is unsorted. This gave me the output "M A M A" after `uniq`, which resulted in 4 status symbols instead of 2. Sorting them before filtering them fixed the problem.