This fixes the issue with nonexistant directories (some Linux
distributions put these for local modules), and also fixes the
issue of dot meaning any character instead of simply dot.
--inherit-variable takes a variable name and snapshots its current
value. When the function is executed, it will have a local variable with
this value already defined. Printing the function source will include
synthesized `set -l` lines for the values.
This is primarily useful for functions that are created on the fly, such
as in `psub`.
ENV_USER is intended to be used when setting any variable whose name is
controlled by the user. The names given to `function -a` certainly
qualifies. This wasn't an issue in practice because the only restriction
ENV_USER imposes is also imposed on ENV_LOCAL, but the rules may change
in the future.
# The first commit's message is:
Simplify default fish_prompt
No need for the set_color caching now that it's a builtin.
Also simplify the 3 classic prompts in fish_config's sample_prompts set.
Remove comment that AFAICT is not true anymore.
Ensure someone setting __fish_active_key_bindings as a universal
variable doesn't screw up the initial keybinding load.
env.cpp sets up $HOME based on the current user, if it's not inherited
from the environment. fishd_get_config should be using the same
calculated value of $HOME. To that end, move universal variable
initialization to after $HOME is set up, and read the value from the
fish environment instead of using getenv().
Fixes#1725.
If $HOME is unset in the environment, fish calculates it with
getpwnam(). However, it wasn't being exported. Just like the $USER
calculation, $HOME should probably be exported, because everyone will
assume that it's an environment variable (as opposed to an unexported
global variable).
Assists other packages in finding the path to install completions: call
`pkg-config --variable=completionsdir fish` or so (like
bash-completion).
As discussed in #1485.
Instead of globally marking the state as "in block" when evaluating
blocks/functions, update the "in block" status when pushing/popping
blocks on the parser stack.
Fixes#1729.
On a side note, `status -b` is actually pretty useless, because it
always returns 0 inside of a function (even without this patch).
Making `true` into a builtin is a significant optimization to `while
true` loops. As long as `true` is a builtin, we may as well make `false`
builtin as well (despite the fact that it's not typically executed in a
loop).
This makes two changes to parse trees:
1. Unmaterialized nodes no longer have an invalid source location
For example, with the code `while false;end` there are no tokens
associated with the while loop's job_list, and therefore it is
unmaterialized. Previously it would have had a SOURCE_OFFSET_INVALID.
But now it has a zero source length, but an offset equal to the end of
the while loop (i.e. the semicolon), and a zero length. Correspondingly,
the has_source function now checks the length instead of the offset.
2. Special (comment and error) nodes have always been "disconnected,"
meaning they are not the child of any other node. However, they now have
their parent offsets set to whatever the top of the node stack was when
the node was encountered. This gives us a sense of which node the
comment is "in", e.g. if we are constructing a job list then the
comment's parent will be the job list. This lets us determine the
comment's indent.
All opam subcommands and descriptions are covered, along with
all the flags that are common to all commands. However, only
`opam config` has complete subsubcommand coverage.
Apparently, in zsh, Meta+H can be used to display the manpage for
the current command. This commit adds this zsh feature to fish shell.
The F1 keybinding is left, although it's now secondary according to
fish help, as some terminal emulators don't let the user press F1 key.
my_wcswidth() was just a wrapper around fish_wcswidth() already.
Instead, add two convenience overrides of fish_wcswidth() to common.h
that make it a drop-in replacement for my_wcswidth().
If a wildcard or completion expands to a file that begins with
one or more dashes, prepend a ./ to it so that it doesn't get
parsed as an option.
Fixes#1519
history_lru_node_t has implicit destructor defined. However, because
it's being deleted as lru_node_t, it's not being actually called, as
lru_node_t doesn't have a virtual destructor.