Arrow keys are often not conveniently located on keyboards, so the use of arrow keys for common keyboard shortcuts can be a turn-off for some.
I found that fish supports alternate keybindings for these cases but I didn't seem them documented in these places where the arrow keys versions are highlighted.
This exitted if the cursor was at the end of the line as well (i.e. if
delete-char failed). That's a bit too eager.
Also documentation, which should have already been included.
$__fish_git_prompt_use_informative_chars will use the informative
chars without requiring informative mode (which is really frickin'
slow!).
See #5726.
[ci skip]
This was clearly intended for index, but because it was called "fish"
it was overwritten by the "fish" command man page.
I also added the tutorial and faq. Both of those might not be *ideal*
as man pages (the tutorial makes references to colors that won't show
up), but it's better to provide them than not.
Hat-tip to @wwared
See #5521.
[ci skip]
* Prevent not-yet-loaded functions from loaded when erased
Today, `functions --erase $function` does nothing if the function
hasn't been autoloaded yet.
E.g. run, in an interactive session
> functions --erase ls
> type ls
and be amazed that it still shows our default `ls --color=auto`
wrapper function.
This seems counter-intuitive - removing a function ought to remove it,
whether it had been executed before or not.
* doc/changelog
Instead of requiring a flag to enable newline trimming, invert it so the
flag (now `--no-trim-newlines`) disables newline trimming. This way our
default behavior matches that of sh's `"$(cmd)"`.
Also change newline trimming to trim all newlines instead of just one,
again to match sh's behavior.
The `string collect` subcommand behaves quite similarly in practice to
`string split0 -m 0` in that it doesn't split its output, but it also
takes an optional `--trim-newline` flag to trim a single trailing
newline off of the output.
See issue #159.
It's always a bit annoying that `*` requires quoting.
So we allow "x" as an alternative, only it needs to be followed by
whitespace to distinguish it from "0x" hexadecimal notation.
We also might want to remove the mailing list and/or IRC channel as I
think most devs aren't on them anymore, but let's just add the channel
that I prefer first.
[ci skip]
Someone has hit the 10MiB limit (and of course it's the number of
javascript packages), and we don't handle it fantastically currently.
And even though you can't pass a variable of that size in one go, it's
plausible that someone might do it in multiple passes.
See #5267.
This adds a new mechanism for logging, intended to replace debug().
The entry points are FLOG and FLOGF. FLOG can be used to log a sequence of
arguments, FLOGF is for printf-style formatted strings.
Each call to FLOG and FLOGF requires a category. If logging for a category
is not enabled, there is no effect (and arguments are not evaluated).
Categories may be enabled on the command line via the -d option.
This displays a colored prompt, which we emulate by adding explicit
roles that are translated to css classes.
For other things, like "eror" this might not be enough because those
often need the rest of the line to still be styled, and I've not found
a way to add some explicit styling to a code block.
See #5696.
[ci skip]
Allows `fish_indent -w **.fish` to restyle all fish files under the
current directory.
(This also has the sideeffect of reducing style.fish time by ~10s, as
we only need to invoke `fish_indent` once, instead of once per-file)
Brace expansion with single words in it is quite useless - `HEAD@{0}`
expanding to `HEAD@0` breaks git.
So we complicate the rule slightly - if there is no variable expansion
or "," inside of braces, they are just treated as literal braces.
Note that this is technically backwards-incompatible, because
echo foo{0}
will now print `foo{0}` instead of `foo0`. However that's a
technicality because the braces were literally useless in that case.
Our tests needed to be adjusted, but that's because they are meant to
exercise this in weird ways.
I don't believe this will break any code in practice.
Fixes#5869.
We previously checked if fish_mode_prompt existed as a function, but
that's a bad change for those who already set it to an empty function
to have a mode display elsewhere.
We were flip-flopping between the two terms, so we now use one. We
still mention "array" in the chapter, and it's still `read --array`,
though.
Fixes#5846.
[ci skip]
This runs build_tools/style.fish, which runs clang-format on C++, fish_indent on fish and (new) black on python.
If anything is wrong with the formatting, we should fix the tools, but automated formatting is worth it.
fish_indent_lexer formats lines not starting with a prompt indicator
as output, as long as there is a prompt indicator elsewhere.
So these tags are useless and wrong.
See #5696.
[ci skip]
This keeps all unknown options in $argv, so
```fish
argparse -i a/alpha -- -a banana -o val -w
```
results in $_flag_a set to banana, and $argv set to `-o val -w`.
This allows users to use multiple argparse passes, or to simply avoid
specifying all options e.g. in completions - `systemctl` has 46 of
them, most not having any effect on the completions.
Fixes#5367.
Universal newlines behaves differently between Python 2.7 and 3.x,
leading to problems when running Sphinx with Python 2.7.
fish_indent always uses \n, so there's no need to use universal newline
detection.
This also allows full UTF-8 in documentation sources.
Closes#5808.
This adds an option --print-rusage-self to the fish executable. When set,
this option prints some getrusage stats to the console in a human-readable
way. This will be used by upcoming benchmarking support.
There's an explicit label for "cartesian-product", but the title is
"Cartesian Product*s*". So linking via with `thing <#link>`_ links the
title, so without the "s" it doesn't work.
From what I know, linking via :ref:`thing <label>` is preferred and
works better with other exports and across files?
I think I should take a doc holiday.
[ci skip]
This adds a reference to one specific FAQ, so it adds a label for that
one question. It does not add the rest, because they currently aren't
linked. If you add a reference to an FAQ, you should add the label as
well.
[ci skip]
We don't refer to "readline functions" anywhere else, and "injecting"
them "into the reader" is an overly jargony way of expressing it that
only makes sense to someone familiar with the internals. And even then
the term "readline" is already taken by the "readline" library, used
by bash et al, but not by us.
So we pick the term "input functions", like we did in bind.
See https://stackoverflow.com/questions/55542839/what-does-commandline-f-repaint-in-fish-shell/55543411#55543411.
[ci skip]
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]