This only uses the functions fish ships with, but still doesn't allow
any *customization*, which is the point of no-config.
This makes it a lot more usable, given that the actual normal prompt
and things are there.
This still doesn't set any colors, because we don't run
__fish_config_interactive because we don't read config.fish (any
config.fish), because that would run the snippets.
It's a bit weird to *have* to fire up a browser to get fish_config to
choose a prompt.
So this adds a `prompt` subcommand to `fish_config`:
- `fish_config prompt list` shows all the available prompt names
- `fish_config prompt show` demos the available sample prompts
- `fish_config prompt choose` sources a prompt
- `fish_config prompt save` makes the choice permanent
A bare `fish_config` or `fish_config browse` opens the web UI.
Part of #3625.
TODO: This shows the right prompt on a new line. Showing it in-line is awkward
to do because we'd have to move it to the right.
Because MacOS' apropos is bad and doesn't support the `--` option
separator, this apparently spews errors.
Because the argument _can't_ start with a `-` (because we add a `^`),
we can just remove it.
Fixes#7965.
This prints a description of the "host". Currently that's
`(chroot:debianchroot) $USER@$hostname`
with the chroot part when needed.
This also switches the default and terlar prompts to use it, the other
prompts have slightly different coloring or logic here.
In many cases we currently discard escaped newlines, since they
are often unnecessary (when used around &|;). Escaped newlines
are useful for structuring argument lists. Allow them for variable
assignments since they are similar.
Closes#7955
When building the docs with an old sphinx (like e.g. on Debian), this
would break links in the search results.
This happens because we've nabbed the searchtools.js from a sphinx to
add our special handling of short builtins like "and", "end", "cd" (as
part of #7757).
I don't believe this will change *a lot* in practice, so it's probably
still okay, but this hack is still worthwhile.
See #7946
I'm not entirely sure this *has* to be given via
CMAKE_EXE_LINKER_FLAGS, but this would have stopped at least one
person from trying.
Static linking 1. does not work at the moment, 2. is not *useful*. You
don't get a single-file fish you can just copy somewhere because
you're missing our functions. On glibc systems you also can't
statically link glibc. Given all that, it does not appear to be worth
putting in any effort to make it work (if it's possible at all).
See #7947.
This would print the default "Argument is invalid" error string, which
is *true* but not super obvious, because `test` doesn't always perform
numeric conversion, and that's the bit that failed here.
These were hard to read in the browser, but not in the terminal.
The palette in color.cpp lists #000080 for blue, which is *even darker*. I'm not sure if that's actually a thing - I was under the impression that table was taken from xterm.
Either way, listing it in this color doesn't do anyone any favors. It's just a rough approximation anyway.
Otherwise this has filesystem order, which on my system is quite
chaotic.
An alternative would be to randomize the order so people see different
prompts each time.
Some features:
- A nice `►` prompt char with a fallback for non-utf8 systems
- The $PWD is colored depending on its sha, so different directories
are colored differently, but each directory stays the same
- User@Host is only shown if not on the local machine (ssh or
virtualization)
- A right prompt with a nice git display, date, duration of the last
command (if it took over 100ms), and virtualenv
This gets fish to print the right prompt of any sample if it has any,
and then shows it separately.
If there is a right prompt, it will also save it. If not, it will *not* overwrite an existing right prompt.
This refactors the behavior of string match with capture groups to
correctly handle multiple arguments. Now the variable capture applies to
the first match, as documented. Fixes#7938.
This called `uname` just to check if we *should* shorten "cygdrive"
directories.
That's more annoying than just doing it by default - on my system `pwd
| string replace` takes about 100 *micro*seconds, and this is done
once per prompt. Anyway, using $PWD further speeds it up to ~30
microseconds (compared to 10-20 for just `pwd`). This is hard to
measure because it's heavily impacted by system hitter.
The alternative is to ask cygwin to ship this feature as a patch.
string match is documented as setting an unset variable if a capture group
is unmatched in an otherwise matched regex, and if the `--all` flag is not
provided. However prior to this fix, it instead set a variable containing
the empty string as a single value. Correct the implementation to match
the documentation.
Note that if the `--all` flag is provided we continue to set empty
strings, which is documented.
This came out of an investigation into making strings immutable.
This code did "lazy" lowercasing but we can simplify it by just
providing our own case-insensitive compare routine, which is good
enough for colors.