Commit graph

1402 commits

Author SHA1 Message Date
elpres
aaeb7d107c Fixed sentence in fish_hg_prompt docs 2020-12-28 19:39:27 +01:00
Matthew Dutson
0136db0a22 Revise through "Input/Output Redirection" section 2020-12-27 17:49:52 -07:00
Matthew Dutson
bc91a13ba3 Revise through "Quotes" section 2020-12-27 17:57:09 +01:00
Matthew Dutson
f3fee832d4 Revise through "Quotes" section 2020-12-26 14:45:48 -07:00
Fabian Homborg
39e1494c56 docs: A bit more on variables 2020-12-24 10:30:59 +01:00
Johannes Altmanninger
bae75c96d9 __fish_complete_suffix: complete all files, but sort files with matching suffix first
See #7040 and others.
2020-12-23 19:14:10 +01:00
ridiculousfish
f61f45748e Document insert-line-under and insert-line-over bindings 2020-12-19 14:32:17 -08:00
Fabian Homborg
6e9364ab50 fish_indent: Change --debug-level to --debug with flog categories
The "debug-level" flag makes little sense since we have no more
debug *levels* left.
2020-12-14 19:36:18 +01:00
Fabian Homborg
ab5d7f80d0 Restyle codebase
And again clang-format does something I don't like:

-    if (found != end && std::strncmp(found->name, name, len) == 0 && found->name[len] == 0) return found;
+    if (found != end && std::strncmp(found->name, name, len) == 0 && found->name[len] == 0)
+        return found;

I *know* this is a bit of a long line. I would still quite like having
no brace-less multi-line if *ever*. Either put the body on the same
line, or add braces.

Blergh
2020-12-06 15:39:54 +01:00
Fabian Homborg
6bbb709c5d docs: Simplify regex importing
[ci skip]
2020-12-06 11:32:01 +01:00
Michael Jarvis
eb22a9c4db Reword text, based on suggestion by @zanchey 2020-12-05 15:00:11 -08:00
Michael Jarvis
350714775a Use "*n*\ th" instead
Escaping the space seems to be a better solution.
2020-12-05 15:00:11 -08:00
Michael Jarvis
74915489e3 Fix sphinx-docs warning
When building from source, there is a warning:

     ../doc_src/cmds/string-match.rst:13: WARNING: Inline emphasis
     start-string without end-string.

One fix appears to be putting a space after the epmhasized 'n' character,
e.g., `*n* th` instead of `*n*th`.
2020-12-05 15:00:11 -08:00
Fabian Homborg
720982a3cb string: Quit early if --quiet is satisfied
E.g. if we do `string match -q`, and we find a match, nothing about
the input can change anything, so we quit early.

This is mainly useful for performance, but it also allows `string`
with `-q` to be used with infinite input (e.g. `yes`).

Alternative to #7495.
2020-12-01 18:55:01 +01:00
Johannes Altmanninger
7c7eac1182 fixup! docs: use monospace for inline code snippets more consistently 2020-11-29 05:59:16 +01:00
Fabian Homborg
27039ed46f docs: Double-up "`"
Otherwise sphinx complains "WARNING: Inline emphasis start-string without end-string"

[ci skip]
2020-11-27 19:46:18 +01:00
Fabian Homborg
5872f4522d math: Add --base option
Currently a bit limited, unfortunately printf's `%a` specifier is
absolutely unreadable.

So we add `hex` and `octal` with `0x` and `0` prefixes respectively,
and also take a number but currently only allow 16 and 8.

The output is truncated to integer, so scale values other than 0 are
invalid and 0 is implied.

The docs mention this may change.
2020-11-27 19:33:27 +01:00
Mahmoud Al-Qudsi
f172b215cf Add documentation for regex import 2020-11-26 14:41:31 -06:00
Fabian Homborg
f8289d69d8 docs: Add a :issue: role and use it in the CHANGELOG
This allows us to write the changelog reasonably simply.

The biggest downside is that pandoc won't be able to handle it anymore
when converting to markdown, but
sphinx-markdown-builder (https://github.com/codejamninja/sphinx-markdown-builder)
should be able to handle it.
2020-11-22 16:47:44 +01:00
Fabian Homborg
2e55e34544 Reformat 2020-11-22 14:39:48 +01:00
Fabian Homborg
4ef6490a26 docs: Some fixes to the erase section of set's exit status
[ci skip]
2020-11-20 16:09:24 +01:00
Fabian Homborg
ad138ecef8 docs: Document sets $status peculiarities harder
[ci skip]
2020-11-20 16:07:22 +01:00
Fabian Homborg
9c2d22e452 Remove debug_stack_frames
This was unused with FLOG. We leave the option stubbed out for now, so
we don't error out for well-meaning calls.
2020-11-15 11:32:52 +01:00
Marcus Atilius Regulus
7b9c1a6076 escape a backslash (in 2 places) in argparse docs 2020-11-13 14:27:12 +01:00
Fabian Homborg
e5061bcda1 docs: Use string split -n for pkg-config
It can in some cases give a trailing space, which causes us to return
an empty element.

Fixes #7465.
2020-11-08 13:40:00 +01:00
Fabian Homborg
6aed132224 docs: More links to commands in index 2020-10-28 17:44:45 +01:00
Fabian Homborg
5ae7be1603 docs: Add fish_title and fish_greeting 2020-10-28 17:44:45 +01:00
Johannes Altmanninger
4081d58577 docs: use monospace for inline code snippets more consistently 2020-10-26 19:25:41 +01:00
Johannes Altmanninger
5ff2d38d4c builtin time: print help on invalid syntax
I always mix up the order with variable assignments.
2020-10-26 19:25:41 +01:00
Fabian Homborg
9eb2649319 docs/fish_for_bash_users: Document a simple prompt 2020-10-26 18:28:46 +01:00
Fabian Homborg
4bfda47449 Bind ctrl-r to search history if the commandline isn't empty
This is super cheesy.

One of the most common feature requests we get is "control-r must
search", even tho just using history-search-backward via e.g. up-arrow
is perfectly capable. The only real difference is that ctrl-r search
in other shells allows editing the search term by default, while we
stop the history search and edit the new commandline in those cases.

So, since the major problem is muscle-memory on ctrl-r,
let's just use that!

This makes ctrl-r do nothing on empty commandlines, and do
history-search-backward otherwise, so the basic flow of "press ctrl-r
to start history search, enter your search term, press ctrl-r to cycle
through matches" just works (except the first ctrl-r is useless and it
doesn't show anything).

See #602.
2020-10-23 13:42:54 +02:00
Ilan Cosman
13459d4d3a Make rationale spacing consistent 2020-10-12 20:25:35 +02:00
Charles Gould
f73ee30111 docs: Fix markup for code blocks 2020-10-10 21:49:33 +02:00
Johannes Altmanninger
eca2a8ba55 complete: print completions without the implied -c switch
This switch is no longer necessary when only one command is given.
Internally completions are stored separately for each command,
so we only every print one command name per "complete" line anyway.
2020-10-10 11:54:52 +02:00
Fabian Homborg
5f3070220a docs: Make somewhat usable on mobile
The sidebar had a fixed 230px, which is absolutely untenable if your
phone has 700px in total and we only use 85% of that.

So this moves the sidebar to the bottom for now, which isn't *great*,
but at least it leaves the text readable and allows navigating the ToC.

One of these days I'll understand what the heck CSS is.

[ci skip]
2020-10-08 21:27:47 +02:00
Fabian Homborg
e46995d764 docs: Make a bit wider
85% and smaller margins - we were wasting a bit too much space there

[ci skip]
2020-10-08 21:25:34 +02:00
Fabian Homborg
fdae48fa0e docs: Build fish-for-bash-users as a manpage
[ci skip]
2020-10-08 17:43:04 +02:00
Fabian Homborg
0eeaa796fd docs: Fix argparse chapter
Missing a label.

Oops.

[ci skip]
2020-10-08 17:35:29 +02:00
Fabian Homborg
6859ca2405 docs: Link to fish-for-bash-users
Seems fitting as the first question.

[ci skip]
2020-10-08 17:32:57 +02:00
Fabian Homborg
392b61014b docs: Some more argparse rewordings
[ci skip]
2020-10-07 21:52:35 +02:00
Fabian Homborg
48e274591a docs: Fix code-block background in old sphinxen
Apparently they set a background-color for these, when we just want
them to inherit the background-color from the highlight div.

[ci skip]
2020-10-06 15:30:10 +02:00
Fabian Homborg
0fd7e9d0a4 docs: Add a brief summary of the changes to the theme
This is required by the license

[ci skip]
2020-10-04 15:09:20 +02:00
Fabian Homborg
b45ff12bf6 Add docs theme license
Also some minor formatting improvements.

[ci skip]
2020-10-04 14:51:05 +02:00
Fabian Homborg
194f4f3734 Update docs for multi-erase in abbr and set
[ci skip]
2020-10-04 12:39:32 +02:00
Fabian Homborg
aecd639fee docs: Reduce min-width
This was 450px, which is still quite wide, it also shows up weird in
firefox.

So let's use 150px, which is still basically readable.

[ci skip]
2020-10-04 11:28:22 +02:00
Fabian Homborg
8c0469245d Adapt styling from fish-site 2020-10-04 11:05:48 +02:00
Fabian Homborg
038b7dacd0 Remove copyright link
We do not have a copyright file, the license is linked in the TOC
2020-10-04 11:05:48 +02:00
Fabian Homborg
c378b11eb4 Remove genindex
It does not work, so we don't want a link to it.
2020-10-04 11:05:48 +02:00
Fabian Homborg
bec23967d5 Find theme via html_theme_path
Seems easier
2020-10-04 11:05:48 +02:00
Fabian Homborg
3a5b0964f0 Use the small lcd version of our logo
Yoinked from fish-site, this looks alright.
2020-10-04 11:05:48 +02:00
Fabian Homborg
04663e0e21 Replace the doc theme with the pydoctheme
Released under the Python Software Foundation License, this one
doesn't look awful (no green top bar, huzzah!).

Lightly forked it to remove the donation footer (we don't take any)
and to change the python references to fish references.

The image is just our favicon, which is a stylized "f" and therefore
not fantastic (are we facebook?), but it's the best I found, and the
thing before had no images at all.

Fixes #6500
(as far as I'm concerned)
2020-10-04 11:05:48 +02:00
Ilan Cosman
067ec6ca97 Synopses examples for vcs services now function as intended 2020-10-02 23:45:38 +02:00
Fabian Homborg
17157b3516 docs: Update example prompt in fish_prompt docs
This used `whoami` and `hostname` and lacked spaces.

[ci skip]
2020-10-02 19:02:10 +02:00
Aurelio Jargas
8d2e4bbef5 Fix string match example
The `?` requires a char, so `foo` cannot match.
2020-09-28 18:49:55 +02:00
Johannes Altmanninger
286ad97cbd Improve string pad examples and add a cross-reference
The old examples were not really showcasing that it's nice for aligning text.
2020-09-28 18:42:02 +02:00
Fabian Homborg
d6d3abf59a Introduce $FISH_DEBUG and $FISH_DEBUG_OUTPUT variables
Same as the `--debug` and `--debug-output` options, can be enabled
when the option can't be passed, e.g. in linux shebangs.

Fixes #7359.
2020-09-28 17:46:37 +02:00
Johannes Altmanninger
f758d39535 string pad: handle padding characters of width > 1
If the padding is not divisible by the char's width without remainder,
we pad the remainder with spaces, so the total width of the output is correct.

Also add completions, changelog entry, adjust documentation, add examples
with emoji and some tests.  Apply some minor style nitpicks and avoid extra
allocations of the input strings.
2020-09-27 21:59:15 +02:00
Johannes Altmanninger
30f821c8f4 Fix example in string length docs
Technically the equivalence would be something like

	string length -q $str
	test -n (string join \n -- $str | string collect)

To handle when str has multiple empty strings;
but quoting is easier to remember and enough for most practical purposes.
2020-09-27 21:59:15 +02:00
Andrew Prokhorenkov
92511b09c4 New command "string pad" to pad text to a given width (#7340)
Pads text to a given width, or the maximum width of all inputs.
2020-09-27 21:59:15 +02:00
Fabian Homborg
fa0c9f90f8 Read arguments with fish -c
This reads any additional positional arguments given to `fish -c` into
$argv.

We don't handle the first argument specially (as `$0`) as that's confusing and
doesn't seem very useful.

Fixes #2314.
2020-09-26 14:47:20 +02:00
Fabian Homborg
06f6436943 reader: Return true if suppress-autosuggestion suppressed
This allows

bind -k backspace suppress-autosuggestion or backward-delete-char

To remove the suggestion on the first press and then delete
chars.

Note: This requires that we then don't reenable suggestions
immediately afterwards. Currently we don't after deletion.

Fixes #1419.
2020-09-26 10:09:55 +02:00
Johannes Altmanninger
16ae532368 Fix typos in docs 2020-09-25 19:33:01 +02:00
Fabian Homborg
7cac8886bf docs: Some more on argument handling
Reword and expand the list section, and add another explicitly on
argument handling.

Fixes #4630

[ci skip]
2020-09-23 18:48:05 +02:00
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
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
Gokul Soumya
6212a584a7 docs/jobs: Header is stripped in command substitution 2020-07-04 13:25:17 +02:00
Fabian Homborg
eb35975c0f Make cancel-commandline actual bind function
This was always awkward as fish script, and had problems with
interrupting the autoloading.

Note that we still leave the old function intact to facilitate easier
upgrading for now.

Fixes #7145.
2020-07-01 20:56:56 +02:00
Johannes Altmanninger
8b961a0ca8 Bind undo to Control-Z in addition to Control-/
See #7152
2020-07-01 00:40:32 +02:00
Jeff Cook
b27440d536 Fix paste-o that duplicated documentation header. 2020-06-30 23:45:41 +02:00
Aadi Bajpai
7c5b19ec2c
Change natural number to non-negative integer (#7161)
* natural → whole

* positive whole

* positive whole number → non-negative integer
2020-06-29 20:26:53 +02:00
Daniel Bengtsson
e2f03fa8a7 Add a function to check if the user is root.
Add a helper function to check if the user is root. This function can be
useful for the prompts for example. Modify the prompts made root checked
to use the function instead. Add also the support of Administrator like
a root user.

Fixes: #7031
2020-06-26 21:25:13 +02:00
Daniel Bengtsson
b8d0de1b88 Typo.
Replace the tabulation by space.
2020-06-20 18:17:11 +02:00
Fabian Homborg
c5f06cde82 docs/string: Fix match examples
One was just cosmetic (too many \\), one was actually broken because
it had duplicated `{{`, possibly resulting from the doxygen conversion?

[ci skip]
2020-06-19 21:23:51 +02:00
Fabian Homborg
547f649797 docs: Slight reword of argparse's optional argument section
[ci skip]
2020-06-17 15:36:50 +02:00
David Adam
7838b47e6b docs: formatting fixes in initialization section 2020-06-15 21:46:20 +08:00
David Adam
5dd7944d0b faq: add SSH/SFTP/SCP interactive guard suggestions
See #2160, #2405, #3742, #4432 & #4745, among others.
2020-06-15 21:46:20 +08:00
Fabian Homborg
d9b0a3b272 Revert "docs/tutorial: Fix duplicate sentence"
This reverts commit 9d1129f14c.

Probably a bad rebase, at the time this appeared on master the sentence was already removed.
2020-06-11 18:40:35 +02:00
Fabian Homborg
5cae62a266 docs: Document comments
Turns out they weren't.

Fixes #7106.
2020-06-10 17:39:04 +02:00
Fabian Homborg
e094e770e8 docs: Some more work on fish_for_bash_users
[ci skip]
2020-06-08 20:44:56 +02:00
Fabian Homborg
7791457bbb docs: Add string-collect link 2020-06-07 20:04:31 +02:00
Fabian Homborg
a6e4e082b7 docs: Include "fish for bash users" document
Not 100% done, but it should be okay as an overview.

Fixes #2382.
2020-06-07 20:04:05 +02:00
Mikel Ward
96425d2231 Fix string collect examples
collect -N leaves the trailing newline, not the other way around.
2020-06-07 19:33:27 +02:00
Awal Garg
cb5eb72c6b Skip pre/post exec events for empty commands (#4829) 2020-06-06 16:31:33 -07:00
David Adam
c5e535e794 docs: link and explicit instructions on creating a blank fish_mode_prompt
Work on #5783.

[ci skip]
2020-06-06 22:52:13 +08:00
Fabian Homborg
ab2db135ba docs: Add first draft of fish-vs-bash
That name's probably not the correct one.

The idea is to have a quick primer document for people coming from bash.
2020-06-05 19:19:23 +02:00
Fabian Homborg
801ab95fd0 docs: Explain $XDG_CONFIG_HOME 2020-06-05 19:18:09 +02:00
Fabian Homborg
77fc83c293 docs: Reword history substitution
That prepend-sudo note was a bit awkward. I'm still not super happy
with it, but it should be better.

Also remove the "simple but effective" comment.
2020-06-05 19:17:19 +02:00
Fabian Homborg
e646285bcb
Let __fish_prepend_sudo use the last commandline if there is no current one (#7079)
* docs/faq: Mention prepend_sudo

[ci skip]

* __fish_prepend_sudo: Use $history[1] if commandline is empty

Currently, if you press alt+s with an empty commandline, it inserts
"sudo", which seems fairly useless.

Now, it inserts "sudo " followed by the last history entry, which
makes it a replacement for `sudo !!`.

* docs
2020-06-04 18:25:02 +02:00
Fabian Homborg
44184f68e4 Add status dirname and status basename convenience commands
There's a terrible number of fishscripts that start with

    set path (dirname (status filename))

And that's really just a bit boring.

So let's let it be

    set path (status dirname)
2020-06-04 18:23:32 +02:00
Fabian Homborg
5efe1a09ce docs/argparse: Add note on optional arguments
Yeah I had to answer this one again.

[ci skip]
2020-06-04 17:28:02 +02:00
Fabian Homborg
99c2c599f3 docs: Mention that reloading can take a bit
Fixes #7064.
2020-05-30 10:07:21 +02:00
Fabian Homborg
4f6851b19f Add CHANGELOG to the docs
This uses a cheesy trampoline file, but it seems to work alright.
2020-05-30 10:07:21 +02:00
Fabian Homborg
4785440f65
Add an "_" builtin to call into gettext (#7036)
* Add an "_" builtin to call into gettext

We already have gettext in C++ (if available), so it seems weird to
fork off a command to start it from script.

This is only for fish's own translations. There's no way to call into
other catalogs, it just translates all arguments separately.

This is faster by a factor of ~1000, which allows us to call
translations much more, especially from scripts.

E.g. making fish_greeting global by default would hurt cost-wise,
given that my fish starts up in 8ms and just calling the current `_`
function takes 2ms, and that would have two calls.

Incidentally, this also makes us rely on a weirdly defined function
less, so it:
Fixes #6804.

* docs: Add `_` docs

Let's see if that filename works out.

* Reword _ docs
2020-05-29 20:53:44 +02:00
Fabian Homborg
1e17a68133 docs/tutorial: Recommend fish_add_path over $fish_user_paths 2020-05-29 20:51:09 +02:00
Fabian Homborg
9354dd6971 Add fish_add_path, a simple way to add to $PATH
This is a function you can either execute once, interactively, or
stick in config.fish, and it will do the right thing.

Some options are included to choose some slightly different behavior,
like setting $PATH directly instead of $fish_user_paths, or moving
already existing components to the front/back instead of ignoring
them, or appending new components instead of prepending them.

The defaults were chosen because they are the most safe, and
especially because they allow it to be idempotent - running it again
and again and again won't change anything, it won't even run the
actual `set` because it skips that if all components are already in.

Fixes #6960.
2020-05-29 20:51:05 +02:00
Jason
90b9dd3627 Reword sentence 2020-05-28 17:39:37 +02:00
Donovan
bc2eb383d4
Funcsave with --directory option (#7041)
* funcsave: add option --directory

Signed-off-by: Donovan Jean <commit@dkrm.dev>

* funcsave: fix synopsis

Signed-off-by: Donovan Jean <commit@dkrm.dev>

* funcsave: fix completion

Signed-off-by: Donovan Jean <commit@dkrm.dev>

* funcsave: fix error message

Signed-off-by: Donovan Jean <commit@dkrm.dev>

* funcsave: fix parameter expansion

Signed-off-by: Donovan Jean <commit@dkrm.dev>
2020-05-27 20:13:44 +02:00
Fabian Homborg
2f7ac8767e Fix wordo
English! It's a thing!

[ci skip]
2020-05-27 18:12:56 +02:00
Fabian Homborg
1dfc701ec6 docs: Slight rewording on the unmatched globs faq
[ci skip]
2020-05-27 18:11:59 +02:00
Fabian Homborg
ec267a1d54 Document how fish does not pass along unmatched globs
See #7043.

[ci skip]
2020-05-27 18:09:53 +02:00
Fabian Homborg
1879b4e697 docs: Some rewording in Special Variables 2020-05-24 20:23:31 +02:00
Fabian Homborg
420f68b1e3 docs: Some rewording in the variable scope section 2020-05-24 20:23:31 +02:00
Fabian Homborg
82d720ca2a docs: Rewrite variables section 2020-05-24 20:23:31 +02:00
Fabian Homborg
87660d3d87 docs: Rewrite identifiers and move it down
Weird to mention it before even explaining variables.
2020-05-24 20:23:31 +02:00
David Adam
b6eb95abad docs: minor spelling/style corrections
[ci skip]
2020-05-24 16:14:23 +08:00
Fabian Homborg
07e6ccd444 docs: Rewrite index range section 2020-05-24 09:33:24 +02:00
Fabian Homborg
2522249145 docs: Rewrite cartesian product section 2020-05-24 09:33:20 +02:00
Fabian Homborg
c2a8557c38 docs: Reword brace expansion 2020-05-23 18:31:33 +02:00
Fabian Homborg
255ab2f140 docs: Reword command substitution 2020-05-23 18:31:33 +02:00
Fabian Homborg
85c970187b docs: Reword parameter expansion/globbing
Why it said "Parameter expansion ("globbing")" no idea.
2020-05-23 18:31:07 +02:00
Fabian Homborg
1eb2bd13ca docs: Reword autoloading
This is hard to understand, so it needs polish polish polish.
2020-05-23 18:24:43 +02:00
Fabian Homborg
25d51bf093 docs: Reword redirection/piping
Less emphasis on the file descriptors
2020-05-23 18:24:43 +02:00
Fabian Homborg
840663bc0b docs: Reword quotes section 2020-05-23 18:24:37 +02:00
Fabian Homborg
814efb5569 docs: More on variable scoping
Specifically more examples, and more *real* examples. Some of it is
copied straight from my config.fish.
2020-05-23 16:42:54 +02:00
Fabian Homborg
9d1129f14c docs/tutorial: Fix duplicate sentence
Fixes #7024.
2020-05-20 19:20:12 +02:00
Charles Gould
b673f32b93 Add fish debugging examples 2020-05-19 21:07:33 +02:00
Fabian Homborg
e3c4692031 docs/bind: Overhaul 2020-05-18 20:48:36 +02:00
Fabian Homborg
ec759fb45e printf: Overhaul docs 2020-05-18 20:48:36 +02:00
Fabian Homborg
56f24f08d7 printf: Don't print an error if not given an argument 2020-05-18 20:48:36 +02:00
Johannes Altmanninger
27f9920c7f docs: sort some electric variables 2020-05-16 12:18:21 +02:00
Johannes Altmanninger
e03c375ee3 Purge remnants of process expansion, document {fish,last}_pid 2020-05-16 11:58:12 +02:00
Johannes Altmanninger
67531acc25 fish --help: remove outdated information about exit status 2020-05-16 10:33:13 +02:00
Moritz Reiter
f318da436e Remove text duplicate in tutorial 2020-05-15 20:09:07 +08:00
LawAbidingCactus
f71737e58a Add $fish_force_vi_cursor variable to allow cursor setting on unsupported terminals 2020-05-14 22:25:20 +02:00
Fabian Homborg
389c5e7ece Update set --show docs
See #6944
2020-04-26 17:55:17 +02:00
Fabian Homborg
1f459622cb docs: Add fish_posterror
Also remove the "event will be emitted even if the command is invalid"
because it's not the case anymore, AFAICT.

See #6880.
2020-04-25 09:25:03 +02:00
Jason Nader
18efd7dd48 Fix string split docs 2020-04-21 18:36:56 +02:00
Jason Nader
ea65db9421 string split: update docs 2020-04-20 22:39:48 +02:00
Charles Gould
2421eb6180 docs: Add completions for fish_key_reader 2020-04-19 07:06:31 +02:00
Weisi Dai
6ab2d78936 Doc: Fix dead link to POSIX man page "test". 2020-04-19 04:25:04 +02:00
Delapouite
8d20748f4a doc: add section about directory history / stack
This PR also adds "See Also" section in the related commands.
2020-04-18 10:40:48 +02:00
Charles Gould
d3e720a045 docs: Use underscore in argument placeholder 2020-04-17 22:29:12 +02:00
Charles Gould
44976a5d31 docs: Remove extra colon to fix formatting 2020-04-17 22:29:12 +02:00
Johannes Altmanninger
1634a3b15c docs: don't quote code snippets
The added single quotes don't look great in HTML, and it's already clear
that the monospaced text is to be interpreted literally.
2020-04-13 22:56:22 +02:00
exploide
8025e80fdb new function __fish_preview_current_file to open file at the cursor in pager
bound to Alt+O by shared key bindings
created with help from @krobelus
fixes #6838
2020-04-07 22:30:05 +02:00
Soumya
639ea3caa0 Update docs for fish_kill_signal, use "job" rather than "command" 2020-04-04 19:23:44 +02:00
Johannes Altmanninger
89c4ff9eae Fix some inconsistencies in docs 2020-04-04 19:19:50 +02:00
Jason Nader
7cb1d3a646 Add string split --fields 2020-04-04 15:30:08 +02:00
Fabian Homborg
5bc3ec846e docs: Reword variable scope section
Should be a bit easier to read.

[ci skip]
2020-04-04 13:17:12 +02:00
Delapouite
6c3732b99f doc: add kbd markup to Tab Completion section 2020-04-04 10:45:13 +02:00
Delapouite
b8281f1284 doc: homogenize commands titles 2020-04-04 10:44:53 +02:00
Soumya
61a9cdaa74 Add $fish_kill_signal to track the signal that terminated a command.
Set to `0` if the command exited normally.
2020-04-02 09:32:32 +02:00
jneem
3cf1de1b7f Suggest string split -n for separating on spaces.
At least on some versions/systems, pkg-config outputs a trailing
space. Since the usually-desired behavior isn't to have a blank argument,
recommend using `string split -n` instead of `string split`.

Fixes #6836.

[ci skip]
2020-03-30 20:42:39 +02:00
fcd
3246f736b8 docs: Fix repeated word in argparse documentation 2020-03-25 18:23:19 +01:00
Johannes Altmanninger
1547a22659 docs: remove some spurious backslashes 2020-03-23 21:02:15 +01:00
George Christou
a3436110c1
Add string sub --end (#6765) 2020-03-22 15:53:09 +01:00
Fabian Homborg
b61913ee74 docs: Add FAQ about unicode issues
This is an actual Frequently Asked Question.

[ci skip]
2020-03-21 18:01:17 +01:00
Fabian Homborg
638a66c8ff pwd: Add "--physical" and "--logical" long options
These were already mentioned in the completions, and we don't
typically add short-only options.

Fixes #6787.
2020-03-21 16:21:15 +01:00
Fabian Homborg
fd45877848 docs: Link builtins
When we say "the XYZ command/builtin", we should typically include a
link. The exceptions are

- In the documentation for that command - no need to link to ulimit in
  the ulimit page
- When we've already linked before - not every thing needs to be
  clickable, or clicking it will cause the browser to mark fifty words
  as visited. This is roughly what wikipedia does for crosslinks.

[ci skip]
2020-03-21 15:31:25 +01:00
Fabian Homborg
8ddd512fba Refine when we expand abbreviations
- ctrl-space will insert a space without expanding abbrs
- ")" or alt-enter will expand abbrs

Fixes #6658
2020-03-21 13:55:15 +01:00
Delapouite
401e5d1f6b doc: add links to 'source' command from 'eval' and 'functions' 2020-03-21 13:21:38 +01:00
Charles Gould
54da5b82ba docs: Fix spacing on key combinations 2020-03-21 13:20:34 +01:00
Charles Gould
90b46c72c8 docs: Use arrow symbols consistently 2020-03-21 13:20:34 +01:00
Charles Gould
fb6257ebc3 docs: Capitalize all keystroke characters 2020-03-21 13:20:34 +01:00
Fabian Homborg
0bb923dcec docs: Make a fish-completions manpage
[ci skip]
2020-03-21 12:07:30 +01:00
Fabian Homborg
469e81e01d docs: Remove weird ", Left"
This was meant as an alternative key name or something, but it's just
rendered. It seems clear what the glyph refers to and we explain it
where we explain the left/right bindings anyway.

[ci skip]
2020-03-19 19:48:24 +01:00
Fabian Homborg
ffd930e35b docs: Format keychords as two :kbd: entries
Looks better in the html - see #6752.

Also this converts the "ctrl-something" instances I could find to
proper markup.

[ci skip]
2020-03-19 19:43:49 +01:00
Delapouite
0152ba87c8 doc: make <kbd> style more prominent 2020-03-19 18:22:40 +01:00
Fabian Homborg
06b317c07f Document funced/funcsave harder
[ci skip]
2020-03-19 18:02:16 +01:00
Fabian Homborg
65d277a581 docs: Move left/right arrow to shared bindings
This is a shared binding, so documenting it in emacs was wrong.
2020-03-15 13:24:45 +01:00
Fabian Homborg
463b9b99c6 Move ctrl-left/right forward-word to shared bindings
These also work in vim.

Fixes #6755.
2020-03-15 13:24:45 +01:00
Delapouite
71243ffbdc chore: bump copyright year 2019 → 2020 2020-03-14 14:03:09 -07:00
Delapouite
84c95324e1 doc: add links to count and contains commands in list section 2020-03-14 12:57:51 +01:00
Delapouite
8320467bb0 doc: add links between the string-split and read commands 2020-03-10 18:25:40 +01:00
Delapouite
a9eeca0d14 doc: add interlinks between break and continue commands 2020-03-09 19:24:38 +01:00
ridiculousfish
2e4cb15880 Add self-insert-notfirst readline command
This adds a new readline command self-insert-notfirst, which is
analogous to self-insert, except that it does nothing if the cursor
is at the beginning. This will serve as a higher-performance implementation
for stripping leading spaces on paste.
2020-03-07 13:31:55 -08:00
ridiculousfish
73a2097f63 Place bind.rst readline function docs in more alphabetical order 2020-03-07 13:31:55 -08:00
Johannes Altmanninger
0bb3efb1ad Docs: add missing backticks 2020-03-07 18:33:39 +01:00
Johannes Altmanninger
da7b762f4a Make default hg prompt leaner
The default hg prompt is slow on large repositories (hg status takes
2-3 seconds on mozilla-central) which is unacceptable as a default.

Mimick our git prompt: by default, only show the current branch.
If the new variable $fish_prompt_hg_show_informative_status is set,
then use the old behavior.

[ci skip]
2020-03-07 13:02:58 +01:00
Delapouite
5e3328ef1f doc(end): mention the 'function' command and add links to all block starters 2020-03-06 22:14:53 +01:00
Fabian Homborg
17f989edf4 docs: Move completion tutorial out into its own document
This is useful, but it's a rather large thing that's uninteresting to
many users. So we put it into its own (top-level, for now) document.
2020-03-06 22:14:30 +01:00
Delapouite
fba6da983b doc: add section about abbreviations in the index
Fix: #3861
2020-03-04 11:13:59 -08:00
Jason Nader
19e43a5df7 docs: remove undefined label 2020-03-04 10:39:55 -08:00
Delapouite
8530a4bd9e doc: add interlinks between echo ←→ printf commands 2020-03-03 20:01:48 +01:00
Fabian Homborg
bfc1de9ef4 argparse: Pass validation variables as exported
This was written before local-exported variables did anything useful.

Passing these vars as local-exports removes the need to define the
validation function with `--no-scope-shadowing` which is quite the
hack.
2020-03-01 19:28:51 +01:00
Fabian Homborg
0f34459fce Disable svn prompt by default
This is apparently quite slow on large svn repos (like 40 seconds
slow), and we don't have a good thing to display other than the full
file information.

So we'll have to disable it for now.

Fixes #6681.

[ci skip]
2020-03-01 17:04:02 +01:00
Delapouite
c0271a71d1 doc: fix 404 error for set_color command 2020-02-26 19:30:46 +01:00
Delapouite
a53405a7be doc(ulimit): add missing backquotes around -H, -S and -a options 2020-02-26 16:33:56 +01:00