Commit graph

1139 commits

Author SHA1 Message Date
Fabian Homborg
c1912e5624 docs: Change hybrid_binding function name
Just "hybrid_bindings" won't trigger the mode prompt.

(yes, this is cheesy)

[ci skip]
2020-09-23 18:15:53 +02:00
Fabian Homborg
8008dfda1e Reorder FAQ
Try to keep related things together - first the variable questions,
then the prompt questions, then more customization, then syntax
incompatibilities, ...

I'm not convinced all of these are actually frequently asked, or that
all frequently asked questions are here, but that's for later.

[ci skip]
2020-09-22 17:34:42 +02:00
Fabian Homborg
1da56f9937 Make history search smartcase
This makes history searches case-insensitive, unless the search string
contains an uppercase character.

This is what vim calls "smartcase".

Fixes #7273.
2020-09-22 16:13:24 +02:00
Fabian Homborg
a5c1d72bd0 docs: Use "fish" without markup in tutorial
Work towards #6785.

[ci skip]
2020-09-20 20:17:08 +02:00
ridiculousfish
5c3571d626 Revert accidental merge of #7340
This reverts back to commit d8e2cac83e.
I accidentally did a 'git push' during code review.
2020-09-19 19:31:44 -07:00
Andrew Prokhorenkov
32f8b0c531 docs: update "string pad" to "width" argument 2020-09-19 19:25:57 -07:00
Andrew Prokhorenkov
bfa699c556 docs: update string doc 2020-09-19 19:25:57 -07:00
Andrew Prokhorenkov
e8d9572b3e docs: remove quiet for "string pad" 2020-09-19 19:25:57 -07:00
Andrew Prokhorenkov
ac8482113c docs: string pad doc update 2020-09-19 19:25:57 -07:00
Andrew Prokhorenkov
2b9158ddab builtin_string: add "--max" for "string pad" 2020-09-19 19:25:57 -07:00
Andrew Prokhorenkov
b11d4c16b8 docs: fix rst formatting for "string pad" 2020-09-19 19:25:57 -07:00
Andrew Prokhorenkov
c8e1894c72 builtin_string: add pad command 2020-09-19 19:25:57 -07:00
Fabian Homborg
c4b7abc6ef docs: Misc changes
Some formatting improvements, an explanation of $PWD, and some updates
- --on-process-exit is gone, the fish_command_not_found event is gone,
nobody has sent enhancements via the mailing list in years.

[ci skip]
2020-09-18 17:19:44 +02:00
Fabian Homborg
c53107a3ad docs: Destuffify
There really is no need to show our technical writing prowess here, we
can use plain english.

[ci skip]
2020-09-18 17:10:40 +02:00
Fabian Homborg
d95dc15dac docs: Some more on custom bindings
Show another fish_key_reader run, explain what keys we pressed,
explain the escape delay.
2020-09-18 17:09:44 +02:00
Fabian Homborg
7845539990 docs: Change "Builtin Commands" section
This harkens back to the days of fish's "we don't need no stinkin'
echo" minimalism. That's long past, we have a bunch useful builtins
now just because they are useful, not because they have to be builtins.

[ci skip]
2020-09-18 17:03:56 +02:00
Fabian Homborg
dca6eee55f docs: Less "the user", more "you"
The person reading this is "you". It's completely okay and sounds
better to address them directly.

When we're talking about OS users or users of fish script the reader
writes, "the user" is still okay.

[ci skip]
2020-09-18 16:53:59 +02:00
Fabian Homborg
c188ecf6c7 docs: Reword Tab Completion section
[ci skip]
2020-09-18 16:46:52 +02:00
Fabian Homborg
63adb6871b docs: "fish" is a normal word
We don't need to emphasize it with a monospace block.

Just on index.rst for now.

Work towards #6785.

[ci skip]
2020-09-18 16:40:09 +02:00
Fabian Homborg
c932c03069 docs: Explain more variables for fish_git_prompt
Also some wording enhancements
2020-09-18 16:32:28 +02:00
Fabian Homborg
0072367512 fish_add_path: Don't resolve symlinks
The case for symlinked directories being duplicated a lot isn't there,
but there *is* a usecase for adding the symlink rather than the
target, and that's homebrew.

E.g. homebrew installs ruby into /usr/local/Cellar/ruby/2.7.1_2/bin,
and links to it from /usr/local/opt/ruby/bin. If we add the target, we
would miss updates.

Having path entries that point to the same location isn't a big
problem - it's a path lookup, so it takes a teensy bit longer. The
canonicalization is mainly so paths don't end up duplicated via weird
spelling and so relative paths can be used.
2020-09-12 19:28:01 +02:00
Fabian Homborg
568f9031aa builtin realpath: Add --no-symlinks option
Taken from GNU realpath, this one makes realpath not resolve symlinks.

It still makes paths absolute and handles duplicate and trailing
slashes.

(useful in fish_add_path)
2020-09-12 19:26:04 +02:00
Fabian Homborg
d688093f7a docs: Update repaint docs
force-repaint now does exactly the same thing as repaint and repaints
are no longer coalesced.
2020-09-11 19:38:55 +02:00
Fabian Homborg
c6cdc06a5b docs: Reword random
Don't SCREAMCAPS random, the command is `random`.

Also some stuffy verbiage.

[ci skip]
2020-09-10 20:48:13 +02:00
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