This addresses the discussion regarding the dependency on `hostname` and
the addition of a `$hostname` variable to replace it.
`$hostname` is a read-only, GLOBAL_ENV, non-electrified, lowercased,
non-exported variable that is read once at the start of a fish session.
The finer points of this can be debated endlessly, but this is a shared
starting point that any changes can build on (ref #4422).
Regarding performance: @krader1961 brought up some good points in #4422
regarding potential DNS timeouts (but they really don't apply except if
the host name is not hardcoded in resolv.conf, which quickly manifests
with a cascade of errors on most *nix systems in all cases), but note
that gethostname() was already being called by fish so that would be
more of a future optimization than a "must" at this point.
The value is not electrified or tied and is read-only. It isn't cached
in the get_hostname_identifier() function as the ENV_GLOBAL $hostname
will cache it for its duration.
The behavior of `gethostname` in case of an insufficient buffer is
library and version dependent. Work around this by using a big enough
buffer then truncating the output to our desired max length.
The 0th index of the array was tested inside the loop instead of just
once outside it.
Also explain `input_mapping_is_match` control code behavior and
reasoning and simplify control flow.
Removed misleading statement about read requiring an argument, as the
note about read's new behavior when no arguments are provided covers
that and is less confusing.
In similar vein to how fish_default_key_bindings works, parameters
passed to the function are automatically passed to bind upstream.
Additionally, -s is automatically added if no parameters had been
specified to prevent startup error messages. See 46d1334.
Closes#4494
Drops the % notation for process expansion. The existing notation was a
mess and expanded jobs, process ids, and process names via dark magic.
With this change, % is no longer a special character and can be used
unescaped with impunity.
The variables %self and %last, referring to fish's own pid and the pid
of the last backgrounded job respectively, have been replaced with $pid
and $last_pid. These are read-only variables, protected against being
redefined by the user.
Author's note: I would have personally preferred $fish_pid instead of
$pid but since we debated changing $version to $fish_version and then
reverted that change (with much acrimony), it makes no sense to break
with that precedent here. Additionally, $fish_last_pid is quite wordy.
Closes#4230. Closes#1202.
When number is infinite, not a number, larger than LONG_MAX or smaller
than LONG_MIN, print a corresponding error and return STATUS_CMD_ERROR.
This should fix the worst of the problems, by at least making them clear.
Fixes#4479.
Fixes#4768.
This allows prompts to react to $COLUMNS by e.g. omitting some parts.
We still fallback to a ">" prompt if that's still not short enough,
but now the user has a way of making a nicer prompt.
Fixes#904.
Fixes#4381.