Commit Graph

1115 Commits

Author SHA1 Message Date
Fabian Homborg
7dae2b1e07 docs: Improve complete docs
A bit stuffy, some weird bits (I don't think GNU-style long options
can typically be abbreviated, ``true --v`` and ``bash --hel`` don't work).
2020-09-09 20:23:15 +02:00
Fabian Homborg
900a3c4049 complete: Remove removed options from the docs
These have been removed for ages, the complete docs are too verbose as
it is.
2020-09-09 20:23:15 +02:00
Fabian Homborg
903b7888d3 complete: Make -c optional
Currently, completions have to be specified like

```fish
complete -c foo -l opt
```

while

```fish
complete foo -l opt
```

just complains about there being too many arguments.

That's kinda useless, so we just assume if there is one left-over
argument that it's meant to be the command.

Theoretically we could also use *all* the arguments as commands to
complete, but that seems unlikely to be what the user wants.

(I don't think multi-command completions really happen)
2020-09-09 20:23:08 +02:00
Fabian Homborg
a8e237f0f9 Let complete show completions for one command if just given -c
Currently only `complete` will list completions, and it will list all
of them.

That's a bit ridiculous, especially since `complete -c foo` just does nothing.

So just make `complete -c foo` list all the completions for `foo`.
2020-09-09 18:37:39 +02:00
oui-ui
0f674435a3 correct description of -a param regarding _(\w*)
removed the word "not" to resolve an (unintended) negation of negation.
2020-09-08 18:02:50 +02:00
Fabian Homborg
340de73172 Call "fish_command_not_found" if a command wasn't found
Previously, when a command wasn't found, fish would emit the
"fish_command_not_found" *event*.

This was annoying as it was hard to override (the code ended up
checking for a function called `__fish_command_not_found_handler`
anyway!), the setup was ugly,
and it's useless - there is no use case for multiple command-not-found handlers.

Instead, let's just call a function `fish_command_not_found` if it
exists, or print the default message otherwise.

The event is completely removed, but because a missing event is not an error
(MEISNAE in C++-speak) this isn't an issue.

Note that, for backwards-compatibility, we still keep the default
handler function around even tho the new one is hard-coded in C++.

Also, if we detect a previous handler, the new handler just calls it.

This way, the backwards-compatible way to install a custom handler is:

```fish
function __fish_command_not_found_handler --on-event fish_command_not_found
    # do a little dance, make a little love, get down tonight
end
```

and the new hotness is

```fish
function fish_command_not_found
    # do the thing
end
```

Fixes #7293.
2020-09-06 11:15:54 +02:00
Aurelio Jargas
d4fe110f23 docs/isatty: Mention default value for FILE DESCRIPTOR
As seen in share/functions/isatty.fish (note the empty string):

    switch "$argv"
        case stdin ''
            set fd 0
2020-09-05 15:54:48 +02:00
Charles Gould
5e5b9d75e6 docs: Fix background color for interactive examples
For the few weird code blocks where default highlighting does not work,
we must add the 'highlight' class manually to get matching backgrounds.
This reuses the background color defined in pygments.css.
2020-09-04 19:46:38 +02:00
Fabian Homborg
bfb5b28d0f Let command, jobs and type take --query instead of --quiet
Now command, jobs, type, abbr, builtin, functions and set take `-q` to
query for existence, but the long option is inconsistent.

The first three use `--quiet`, the latter use `--query`. Add `--query`
to the first three, but keep `--quiet` around.

Fixes #7276.
2020-09-04 16:55:09 +02:00
Fabian Homborg
021d4157ca Fix hybrid binding instructions
This needs to have the vi-bindings take precedence, so they need to be
executed *last*.

It just needs to tell them that they shouldn't erase all the bindings.

[ci skip]
2020-08-28 20:50:24 +02:00
Fabian Homborg
bc715c6eb4 docs: Reword some of the Special Variables section
[ci skip]
2020-08-27 17:07:23 +02:00
Aurelio Jargas
0304135d2b
docs: Use \ instead of \\ in examples (#7286)
Instead of informing the bell character (hex 07), the example was using
an escaped \ followed by x07.

    $ echo \\x07
    \x07
    $ echo \x07

    $ echo \x07 | od -a
    0000000 bel  nl
    0000002
    $

* docs: Use \u instead of \\u

Instead of informing the Unicode character 慡, this example was using an
escaped \ followed by u6161.

    $ echo \\u6161
    \u6161
    $ echo \u6161
    慡

Before:

    $ string escape --style=var 'a1 b2'\\u6161 | string unescape --style=var
    a1 b2\u6161

Now:

    $ string escape --style=var 'a1 b2'\u6161 | string unescape --style=var
    a1 b2慡
2020-08-26 18:29:03 +02:00
Fabian Homborg
5eb4de4285 math: Implement tau 2020-08-26 17:48:58 +02:00
Fabian Homborg
f14a1d3a27 math: Document hex numbers 2020-08-26 17:48:58 +02:00
Fabian Homborg
5b1c000a2e math: Add bitwise and/or functions
Just as `math "bitand(5,3)"` and `math "bitor(6,2)"`.

These cast to long long before doing their thing,
so they truncate to an integer, producing weird results with floats.

That's to be expected because float representation is *very*
different, and performing bitwise operations on floats feels quite useless.

Fixes #7281.
2020-08-26 17:48:58 +02:00
Aurelio Jargas
6ec6076c16 docs/string: Fix duplicated {} in match example
Follow-up fix from c5f06cd.

[ci skip]
2020-08-25 15:56:18 +02:00
Xandor Schiefer
ed212c631c Correct Emacs bindings in vi insert mode
The original instruction does not actually enable Emacs key bindings in Vi mode. This fixes it.
2020-08-23 12:56:27 -07:00
Fabian Homborg
c9d2c99a98 Document that echo takes --
[ci skip]
2020-08-21 21:32:56 +02:00
Fabian Homborg
923f6174ab Adjust the FAQ 2020-08-21 20:46:23 +02:00
jonbakke
02d0e50b61 Fix typo (verb clarification) in math.rst
Was: "parameter expansion takes before expressions are evaluated."
Now: "parameter expansion happens before expressions are evaluated."

I suspect the original intent was to use "takes place," but I see "happens" as less idiomatic and therefore may benefit non-English-native users.
2020-08-19 12:18:52 -07:00
Fabian Homborg
7254dfecb2 fish_indent: Print the failed files with --check
Also return the number of failed files.

I decided to *just* print the filenames (newline-separated because
NULLs are annoying here) to make it easier to deal with.

See #7251.
2020-08-10 22:03:51 +02:00
Fabian Homborg
2cdd6df257 fish_indent: Add a "--check" option to only test indentation
Fixes #7251.
2020-08-08 20:23:14 +02:00
Fabian Homborg
616cd38d8e docs: Don't use force-repaint
It's not needed here and misleading. force-repaint isn't all that
useful and especially not something for a simple example.
2020-08-07 21:06:16 +02:00
Carlos Alexandro Becker
ef8c397e7b docs: fix small formatting issues 2020-08-07 22:05:05 +08:00
Soumya
a2b2bcef6e Add a $status_generation variable that's incremented for each interactive command that produces a status.
This can be used to determine whether the previous command produced a real status, or just carried over the status from the command before it. Backgrounded commands and variable assignments will not increment status_generation, all other commands will.
2020-08-05 12:23:49 -07:00
Johannes Altmanninger
242b60fdef history.rst: clarify that "history search" is the default command 2020-08-04 21:44:26 +02:00
ridiculousfish
af48d09ca6 Improve syntax highlighting variable docs
Make them a table instead of a list, which renders more nicely.
Shorten some of the descriptions.
2020-08-03 13:21:37 -07:00
ridiculousfish
201ca02893 Remove an errant space from the docs
Corrects fish_pager_color_secondary_prefix
2020-08-03 12:19:57 -07:00
Charles Gould
2740473a65 docs: use parsed-literal to highlight interactive examples
There are a few code blocks where the default highlighting does not
work and the documentation looks bad as a result. Usually this happens
when we are demonstrating an important interactive feature, such as
autosuggestions, syntax highlighting, or tab completion.

The pygments highlighter was not designed for code samples like these.
But it is important to show the behavior clearly in the docs. I am
attempting to make these weird examples look as much like the "normal"
code blocks as possible.

https://docutils.sourceforge.io/docs/ref/rst/directives.html#parsed-literal
2020-08-02 14:22:29 -07:00
Olivier FAURE
e7f0b5801d Add forward-single-char input command
This allows users to add custom keybindings to autocomplete only one
character at a time.

Resolves https://github.com/fish-shell/fish-shell/issues/4984
2020-08-01 12:09:31 +02:00
Olivier FAURE
6778d04aa5 Add or keybind input function 2020-08-01 12:09:31 +02:00
ridiculousfish
1c2323e76f Use dashes instead of underscores pervasively in tutorial anchors
This fixes some broken help completions.
2020-07-31 12:10:16 -07:00
ridiculousfish
c940af1600 Correct tut_combiners anchor to tut-combiners
dash is preferred in the tutorial. This fixes a broken link from the main
help page.
2020-07-31 11:53:47 -07:00
Fabian Homborg
6356912702 docs: Expand background section
It's not entirely clear why there's two sections right now, tbh.

[ci skip]
2020-07-26 17:33:11 +02:00
Fabian Homborg
50a40175f1 docs: More on conditionals directly
It's weird to force people to go to the separate pages, at least give
some simple examples here and link to the tutorial.

[ci skip]
2020-07-26 17:33:11 +02:00
Fabian Homborg
cbd3adaa63 docs: Mention psub in the command substitution chapter
[ci skip]
2020-07-26 17:33:10 +02:00
Fabian Homborg
65f932edd2 docs: Also mention functions and type
One of the nicest things about fish is how introspectable it is. We
should probably get people to just mess around and see what is
implemented how. This is a step in that direction.

[ci skip]
2020-07-23 22:27:32 +02:00
Fabian Homborg
b485daa987 docs: Rewrite "Functions" section
More examples, links to funced/funcsave, autoloading, wrappers

[ci skip]
2020-07-23 17:49:43 +02:00
Charles Gould
f1302d336a docs: fix a few links
- add missing links for some commands (control flow section)
- fix broken links that use the old syntax (#tut_ links)
- miscellaneous fixing of backticks/emphasis
2020-07-18 20:46:50 +02:00
Fabian Homborg
82de51b9d3 Document adding bindings
This was never made explicit.

[ci skip]
2020-07-16 17:47:35 +02:00
Charles Gould
14ccac4887 docs: fix broken links in FAQ 2020-07-16 17:10:36 +02:00
Charles Gould
cea941a061 docs: fix literals in quotes section 2020-07-16 17:10:36 +02:00
Charles Gould
a83f580174 docs: shebang line cleanup 2020-07-16 17:10:36 +02:00
Charles Gould
49c575c3a5 docs: executing bash addition 2020-07-16 17:10:36 +02:00
Charles Gould
e5ac2fa879 docs: default shell formatting 2020-07-16 17:10:36 +02:00
blinry
b178f0921e Rephrase confusing display of key binding in documentation
The binding Alt+., followed by a full stop, wasn't ideal. Rephrase the sentence to avoid that.
2020-07-14 20:29:14 +02:00
blinry
641f1b00e4 Fix link target for "other features"
Seems the link targets need a blank line above them, otherwise they will be rendered into the document.
2020-07-14 20:28:45 +02:00
Fabian Homborg
8a6a265c3e docs: Add word splitting example 2020-07-09 18:35:41 +02:00
David Adam
4a35248465 docs/bind: make list formatting consistent 2020-07-06 20:50:19 +08:00
David Adam
1b121bd9a6 docs/jobs: add example output and remove spurious header 2020-07-06 20:48:13 +08:00