`eval` has always been implemented as a function, which was always a bit
of a hack that caused some issues such as triggering the creation of a
new scope. This turns `eval` into a decorator.
The scoping issues with eval prevented it from being usable to actually
implement other shell components in fish script, such as the problems
described in #4442, which should now no longer be the case.
Closes#4443.
No longer uses global vars to cache set_color output, this was
from before set_color was a builtin, it is pointless now.
This is also a prompt from before we had bright named colors,
and it appears it was relying on -o red to get bright red.
so use brred, etc.
If we switch the bind mode, we add a "force-repaint" there just to
redraw the mode indicator.
That's quite wasteful and annoying, considering that sometimes the prompt can take
half a second.
So we add a "repaint-mode" function that just reexecutes the
mode-prompt and uses the cached values for the others.
Fixes#5783.
* Add "expand-abbr" bind function
This can be used to explictly allow expanding abbreviations.
* Make expanding abbr explicit
NOTE: This accepts them for space only, we currently also do it for \n
and \r.
* Remove now dead code
We no longer trigger an abbr implicitly, so we can remove the code
that does it.
* Fix comment
[ci skip]
This searched for package.json in any parent, so just like finding
.git and .hg directories it _needs_ to use the physical pwd because
that's what git/hg/yarn use.
In general, if you do _any_ logic on $PWD, it should be the physical
path. Logical $PWD is basically only good for display and cd-ing
around with symlinks.
[ci skip]
This called `eval $fish_browser --version` to figure out if it is
lynx.
That's really not worth it just to support edge-cases using a rather
unusual browser, to work around a bug in it.
Instead we just see if the browser name starts with "lynx", which
should work in 99.9% of cases.
This created another local version of the variable just for the if-block.
Can't say I love the space prefix, but then I think we have too many
of these modes anyway.
If you use these to figure out if there _are_ staged files, or dirty
or whatever, you currently need to check the output, which relies on
the configured character.
Instead, we let them also return a useful status.
Notably, this is *not* simply the status of the git call.
__fish_git_prompt_X returns 0 if the repo is X.
This works for untracked, but the "diff" things return 1 if there is a
diff, so we invert the status for them.
See #5748.
[ci skip]
Classic case of not seeing `and` as a new command:
`__fish_git_using_command config and anotherthing`
causes `and anotherthing` to be passed as arguments to
`__fish_git_using_command` instead of being executed.
[ci skip]
A function file for a function used only by one completion (and
unlikely to be used anywhere else).
If another user shows up, we can move it out again.
Part of #5279
[ci skip]
This should be the last call to `grep` outside of a script
specifically related to `grep`.
(With the exception of `zpool`, which I've already written, but which
will probably be merged later)