Previously, elements already existing in the path variable would keep their position when the path was being constructed from the config files. This caused issues given that $PATH typically already contains "/usr/bin:/bin" when fish initializes within a macOS terminal app. In this case, these would keep their position at the front of the $PATH, even though the system path_helper configs explicitly place them _after_ other paths, like "/usr/local/bin". This would render binaries in "/usr/local/bin" as effectively "invisible" if they also happen to live in "/usr/bin" as well. This is not the intended
This change makes the __fish_macos_set_env config function emulate the macOS standard path_helper behavior more faithfully, with:
1. The path list being constructed *from scratch* based on the paths specified in the config files
2. Any distinct entries in the exist path environment variable being appended to this list
3. And then this list being used to *replace* the existing path environment variable
The result, for a vanilla fish shell on macOS, is that the $PATH is now set to:
/usr/local/bin /usr/local/sbin /usr/bin /bin /usr/sbin /sbin
Where previously it was set to:
/usr/bin /bin /usr/local/bin /usr/sbin /sbin
This new $PATH exactly matches the order of paths specified in `/etc/paths`.
Matches upstream path_helper which is invoked in /etc/profile and only
applies to login shells. Enables running interactive, non-login shells
with altered PATH values.
Reverts change in c0f832a7, which reverts change in adbaddf.
Our weird %-expanding function wrappers around kill et all defined
"--wraps" for the same name.
As it turns out, fish follows that one, and executes the completion
multiple times.
I didn't notice because these tend to be rather quick on linux, but on
macOS that's apparently a real issue.
Fixes#5541.
[ci skip]
Cleaned up the code to no longer replicate in fishscript what fish
already does (and caches to boot) in C++ in setting up the paths to the
user configuration directory.
Also introduced a `$__fish_user_data_dir` instead of the sporadic
definitions of `$userdatadir` that may or may not go through
`XDG_DATA_HOME`.
This allows snippets to use everything that is defined in config.fish,
which is our _base_ initialization.
Among other things, it enables snippets to use $PATH as it will appear
in the user's config.fish, or even to change $PATH.
Also, this is how it was in 2.7.1 and before (with the small change
that abbrs were upgraded after).
The job expansion wrapper was swallowing `-n` (and presumably `-e` and
others) when that was the literal argument we needed to emit. Using
`printf %s ...` instead.
fish reads paths out of /etc/paths.d. Prior to adbaddf it did
this on every shell invocation; with adbaddf it does so on only login
shells. This change wasn't justified so let's revert this behavior.
(and /etc/paths.d/*)
Do so by emulating the behavior of /usr/libexec/path_helper for login
shells, matching the behavior in /etc/profile.
Also add a path_helper command to reproduce the behavior of
/usr/libexec/path_helper for fish.
This also handles setting MANPATH if necessary.
Fixes issue #4336
* Only append paths if `MANPATH` is already set, to match behavior of macOS
`path_helper` utility.
* Use the same technique as is used above to set PATH from /etc/paths and
/etc/paths.d/*.
I had disabled having `make style-all` restyling fish scripts because a
majority of them did not conform to the style enforced by `fish_indent`.
I recently restyled most of the fish scripts with the exception of the
completion scripts. So this re-enables restyling all scripts with the
exception of completion scripts.
Adds a color reset thing, to ensure fish tries to use hard colors during
testing.
Also, work on a discrepancy (not introduced by my changes, afaik) when
with some combinations of color settings, and usage of --bold, caused super
flakey color paninting in the pager. Downwards movements that trigger
scrolling vs. upwards movement in the pager would only apply bold to
selections when moving upwards. The bold state of the command completions in
the pager was flipping flops on and off, depending on if there is a description
on the preceding line.
Implement a lame fix by reseting the color to normal and applying a
different style on the rightmost ')' which seems to be what was influencing it.
Makes fish use terminfo for coloring the newline glich char.