Commit graph

1465 commits

Author SHA1 Message Date
Johannes Altmanninger
5999d660c0 Docs for "$(cmd)" and $(cmd) 2021-07-13 21:33:42 +02:00
Johannes Altmanninger
4437a0d02a Minor doc rewording to use active voice 2021-07-13 21:33:42 +02:00
Fabian Homborg
ab2108cadc docs: Ignore github issues in linkcheck
This allows

    sphinx-build -blinkcheck . /dev/null

To be used without getting rate-limited to hell by github because the
release notes include hundreds of links to our own issues. Just assume
all issue numbers are valid.
2021-07-13 17:53:21 +02:00
Fabian Homborg
0ae6d34845 docs: Make lAtEX output *work*
pdflatex simply doesn't cut it.

This still results in an awkward pdf that starts with "Further
Reading" (the intro section is placed before it, but doesn't have a
chapter marker!) and ends with a massive "Other help pages" chapter
that includes *the entire rest of the docs*.

But it's generally readable and acceptably formatted (with a lot of
empty pages in between).
2021-07-13 17:53:21 +02:00
Fabian Homborg
bacb1efc72 docs/conf: Remove some unneeded guff 2021-07-13 17:53:21 +02:00
David Adam
70eca5e204 function: note limits on signal triggers in documentation
See #5160.
2021-07-11 23:03:39 +08:00
Fabian Homborg
0e1f5108ae
string: Allow collect --allow-empty to avoid empty ellision (#8054)
* string: Allow `collect --no-empty` to avoid empty ellision

Currently we still have that issue where

    test -n (thing | string collect)

can return true if `thing` doesn't print anything, because the
collected argument will still be removed.

So, what we do is allow `--no-empty` to be used, in which case we
print one empty argument.

This means

    test -n (thing | string collect -n)

can now be safely used.

"no-empty" isn't the best name for this flag, but string's design
really incentivizes reusing names, and it's not *terrible*.

* Switch to `--allow-empty`

`--no-empty` does the exact opposite for `string split` and split0.

Since `-a`/`--allow-empty` already exists, use it.
2021-07-09 21:20:58 +02:00
ewtoombs
670636885c docs: Made the abort/edit history feature more discoverable.
First, I changed "the escape key" to :kbd:`Esc`. This makes this information
easier to find when scanning the docs because it stands out and because it is
more consistent with the docs's formatting of keyboard keys.

Additionally, emphasize that escape/page-down can be used to edit
the original search sting.

Finally, I added a link from the FAQ to history-search to make this mechanism
easier to discover.

This was all to address confusion in former zsh and bash users as to how to
edit a search that is in progress, but this will also help new users. See
https://github.com/fish-shell/fish-shell/pull/6686#issuecomment-872960760
2021-07-03 16:39:32 +02:00
Fabian Homborg
768a9b1fd3 docs: Stop making code *smaller*
Why would we change font-size to "96.5%"?

This was inherited from the python docs theme.
2021-07-01 17:50:25 +02:00
Fabian Homborg
866df31c9d docs: Increase contrast
Especially in dark-mode this was often too close to the background.

Should make it easier to read.

As always, colors not checked for artistic merit for I have none.
2021-07-01 17:48:08 +02:00
Fabian Homborg
c241b782e7 docs: Use white instead of black for some highlighting colors
Fixes #8100
2021-07-01 17:06:20 +02:00
David Adam
eaa6149b87 docs: fix a missing reference 2021-06-28 22:45:29 +08:00
Fabian Homborg
c5bcd3cc95 Document $pipestatus/not harder 2021-06-25 18:28:30 +02:00
Johannes Altmanninger
7c2dd694e0 Provide functions to toggle commandline prefix/suffix
This introduces two functions to
- toggle a process prefix, used for adding "sudo"
- add a job suffix, used for adding "&| less"

Not sure if they are very useful; we'll see.

Closes #7905
2021-06-23 20:51:20 +02:00
Johannes Altmanninger
be0b451207 commandline: allow to get/set cursor position relative to token/process/job
With a command line like

	a | b <cursor> | c

 "commandline -C 0 --current-process" will place the cursor just left of "b".
2021-06-23 20:51:20 +02:00
Fabian Homborg
85522036f5 docs: Undo sphinx awkwardness with code blocks
This set "clear: both", which resulted in code blocks sometimes being
pushed down a lot, resulting in weird empty space.

Just undo it, I have no idea why it's there, presumably it makes sense
with sphinx' stock theme?
2021-06-23 17:33:40 +02:00
Fabian Homborg
8787179a40 docs: Document fallback colors
A third column in the table is overkill given that we have two
exceptions.
2021-06-20 22:13:50 +02:00
Fabian Homborg
f6a6537f7b css: Some minor adjustments
Make borders less bright in dark version, add some padding to the body.
2021-06-10 21:00:18 +02:00
Fabian Homborg
d2b210ee15 docs: Mention all set_color modifiers
This spoke of "--bold" and "-b", which are two different things - "-b"
is short for "--background", bold is "-o".

Instead let's just mention the long versions of all the switches.

See #8053.
2021-06-10 10:50:51 +02:00
Fabian Homborg
71b9463165 docs: Some tweaks to "Syntax overview" 2021-06-06 21:36:04 +02:00
Fabian Homborg
b0b8cb0129 docs: Move color variables to interactive
A bunch of our variables are only relevant for interactive use, but
this is two whole sections on them. Simply move them inside "Syntax
highlighting" and leave the link in Special Variables.
2021-06-06 17:43:06 +02:00
Fabian Homborg
046db09f90
Try to set LC_CTYPE to something UTF-8 capable (#8031)
* Try to set LC_CTYPE to something UTF-8 capable

When fish is started with LC_CTYPE=C (even just effectively, often via
LC_ALL=C!), it's basically broken. There's no way to handle non-ASCII
characters with a C locale unless we want to write our
locale-independent replacements for all of the system functions.

Since we're not going to do that, let's try to find *some locale* for
LC_CTYPE.

We already do that in __fish_setlocale, but that's

- a bit of a weird thing that reads unstandardized system
  configuration files
- allows setting locale to C explicitly

So it's still easily possible to end up in a broken configuration.

Now, the issue with this is that there is (AFAICT) no portable way to
get a list of all allowed locales and C.UTF-8 is not standardized, so
we have no one locale to fall back on and are forced to try a few. The
list we have here is quite arbitrary, but it's a start.

Python does something similar and only tries C.UTF-8, C.utf8 and
"UTF-8".

Once C.UTF-8 is (hopefully) standardized, that will just start
working (tm).

Note that we do not *export* the fixed LC_CTYPE variable, so external
programs still have to deal with the C locale, but we have no real
business messing with the user's environment.

To turn it off: $fish_allow_singlebyte_locale, if set to something true (like "1"),
will re-run the locale initialization and skip the bit where we force
LC_CTYPE to be utf8-capable.

This is mainly used in our tests, but might also be useful if people
are trying to do something weird.
2021-06-06 09:28:32 +02:00
Fabian Homborg
7a5e192607 Make background a bit more blue, brighter 2021-06-05 11:17:53 +02:00
Fabian Homborg
c2b35d3171 Adjust colors a teensy bit
Make a bit less ultra-dark blue
2021-06-05 11:17:53 +02:00
Fabian Homborg
606a8a7a1a Darkmode for docs
This uses the prefers-color-scheme media query to pick between dark and light mode,
so the user automatically gets the colorscheme they prefer.
2021-06-05 11:17:53 +02:00
Fabian Homborg
1fc6f77378 docs: Make toctree more spread out
Easier to tap on a phone
2021-06-03 20:55:36 +02:00
Fabian Homborg
a17f7468b7 docs: Make sidebar more readable
and tappable - more line-height, larger fonts in narrow mode.

In turn the search box really doesn't need that massive margin above.
2021-06-03 20:55:36 +02:00
Fabian Homborg
44a6795ead webconfig: Set image height explicitly
Chrome says that's better, presumably because it can then tell how
large the image is before it's loaded. Not that this tiny image really
is a massive problem, but let's be good, not acceptable.
2021-06-03 20:55:36 +02:00
Fabian Homborg
c18c7a4ce4 Document vi-visual mode keys 2021-06-03 10:03:43 +02:00
Fabian Homborg
850419d127 docs: Style footnote-references like footnotes
Emphasizes that they belong together
2021-06-02 17:48:16 +02:00
Fabian Homborg
1fed36d005 docs: Deduplicate some styles 2021-06-02 17:47:07 +02:00
Fabian Homborg
843c9383aa docs: Remove non-functional link 2021-06-02 17:33:55 +02:00
Fabian Homborg
bc00188ca8 docs: Make footnotes stand out a teensy bit 2021-06-02 17:12:45 +02:00
Fabian Homborg
553ce7a006 docs: Inherit some more background colors
Unfortunately sphinx hardcodes these again in classic.css, and if we
want to change them we need to make these the same again.
2021-06-02 17:12:45 +02:00
Fabian Homborg
884768dded docs: Make some background-colors dependent
This is so we can more easily change the background.
2021-06-02 17:12:45 +02:00
Fabian Homborg
eed2173860 docs: Stop including main css in pygments.css
This led to pydoctheme.css being included *twice*, which led to
everything it included being included twice, which was annoying in
firefox when playing with the styles.

I don't *think* it had any performance impact?
2021-05-28 20:49:57 +02:00
Fabian Homborg
470258ffd1 docs: Some rewording to the tutorial
Add a link to fish-for-bash-users, mention string collect, some reformatting
2021-05-28 20:49:57 +02:00
Fabian Homborg
21f5032a55 docs: Don't speak of "initialization files"
The file is called "config.fish", not "init.fish". We'll call it
"configuration" now.

"Initialization" might be slightly more precise, but in an irritating
way.

Also some wording improvements to the section. In particular we now
mention config.fish *early*, before the whole shebang.
2021-05-28 20:49:57 +02:00
Fabian Homborg
cfc8d14a8d docs: Force sections to be full-width
Otherwise there's this weird *gap*, where the sections are narrow even
tho there's plenty of space?

So you have this screen layout:

```table
| sidebar | text        |
| sidebar | narr        |
| sidebar | ower        |
| sidebar | than        |
| sidebar | need        |
| sidebar | ed          |
```

For some gosh-forsaken reason.
2021-05-27 22:40:04 +02:00
Fabian Homborg
21cb791557 docs: Let the sidebar move
This means the nice navigation to other chapters always stays on
screen, instead of scrolling away.
2021-05-27 22:17:30 +02:00
Fabian Homborg
0e771590e6 docs: Remove stray mention of the IRC channel
This was apparently missed in 1f976a5041.
2021-05-27 21:41:52 +02:00
ridiculousfish
73998b81b4 Correct the docs for commandline --current-buffer
commandline current-buffer was incorrectly documented as returning the
autosuggestion. Clarify that it does not.
2021-05-25 17:15:42 -07:00
ridiculousfish
33f3c03dae Allow on-job-exit handlers to be added for any pid in the job
Prior to this change, a function with an on-job-exit event handler must be
added with the pgid of the job. But sometimes the pgid of the job is fish
itself (if job control is disabled) and the previous commit made last_pid
an actual pid from the job, instead of its pgroup.

Switch on-job-exit to accept any pid from the job (except fish itself).
This allows it to be used directly with $last_pid, except that it now
works if job control is off. This is implemented by "resolving" the pid to
the internal job id at the point the event handler is added.

Also switch to passing the last pid of the job, rather than its pgroup.
This aligns better with $last_pid.
2021-05-25 15:28:53 -07:00
Fabian Homborg
e81b3e06c5 docs: Add a section on subshells to fish-for-bash-users 2021-05-22 17:30:45 +02:00
Fabian Homborg
406bc6a5d6 docs: Remove obsolete part from functions
This was forgotten in #5951, which allowed `functions --erase` to
prevent functions from being autoloaded.

Fixes #8014
2021-05-19 19:09:46 +02:00
Fabian Homborg
d5a30ed103 docs: Split off links to other pages into its own section
This is an attempt to make these more visible - the intro section
explains what this is, and then we mention where to go, and after that
we go into installation and stuff.

I don't think putting "where to go" *after* the installation
instruction is correct, but maybe it is? For the time being, we keep
the order as it is.
2021-05-18 22:53:13 +02:00
Fabian Homborg
0991e0b27f docs: Mention cursor in the wrong position for unicode FAQ
This is now more likely than the staircase thing since
0660ea5be758a25cbfd5703055af122842c10cb0..25595a94c72c8fd1385bfa66b5efecd26839488b.
2021-05-18 13:18:35 +02:00
ridiculousfish
c0b33774ca Update docs on detecting fish_private_mode
fish_private_mode is active if set to something non-empty, but the docs
suggested checking if it is set at all. Switch the docs to match the
implementation through `test -n "$fish_private_mode"`

Fixes #8001
2021-05-17 18:42:52 -07:00
Fabian Homborg
b63b511b0a docs: Clarify when on-variable handlers will be run
Fixes #8010.
2021-05-17 17:20:36 +02:00
Fabian Homborg
c38f4980f9 docs: Some tweaks on initialization 2021-05-16 21:27:00 +02:00
Fabian Homborg
af84c35282 docs: A bit more on autoloading 2021-05-16 21:27:00 +02:00
Johannes Altmanninger
e10cab8104 Tweak documentation wording to include non-option arguments 2021-05-16 20:48:53 +02:00
Fabian Homborg
240fb9fd45 docs: Unbreak sphinx' man directories
Apparently new sphinxen want to create an *additional* section
directory, so things end up in /usr/share/fish/man/man1/1, instead of /usr/share/fish/man/man1

Why? No idea.

I can't reproduce it but I'm told this section fixes it.

Fixes #7996
2021-05-13 18:20:47 +02:00
Fabian Homborg
678fa2e6a9 docs: A bit on index ranges
Try to make list-ness more accessible.
2021-05-12 19:40:43 +02:00
Fabian Homborg
127eaded96 docs: Mention set in variable expansion
This isn't strictly speaking variable expansion, but it's so related
that we should at least tease it.

See #7990.
2021-05-12 19:28:34 +02:00
Fabian Homborg
9fd69acd1a docs: Clean up set a bit
More links! Links good! Link link linky link!
2021-05-12 18:52:24 +02:00
ripytide
8c19b6105f Not quite accurate code example heading 2021-05-10 19:28:06 +02:00
ripytide
40704ba7a2 Explanation of list range example wrong way round.
I'm assuming the first number before the **..** is the FROM and the number after it is the TO.
2021-05-10 17:01:12 +02:00
Fabian Homborg
aa84a4ba30 docs: Links for the function-related commands 2021-05-08 12:12:56 +02:00
ridiculousfish
d338c45205 Fix a Sphinx warning
Add a newline to fix "Literal block ends without a blank line."
2021-05-04 13:50:09 -07:00
ridiculousfish
f0f10618df Improve the documentation for pushd
Correct the examples so that the directory stack is correct.
Fixes #7940
2021-05-04 13:21:46 -07:00
Fabian Homborg
c435d8b9b3 docs: Document enter/alt+enter harder
These were mentioned in "multiline editing", but not in the shared bindings
2021-05-04 20:00:46 +02:00
Fabian Homborg
d00576c9ea docs: More on join0 2021-05-04 14:14:27 +02:00
Fabian Homborg
d5f9fc84dc docs: Remove "note that"
It's one of my verbal tics, and I don't want it.
2021-05-03 18:39:54 +02:00
Fabian Homborg
1e13c60059 docs: Link relevant language sections from the tutorial
This allows us to keep the tutorial more focussed and leave the more
in-depth information in the "language" part of the documentation.
2021-05-03 18:15:24 +02:00
Fabian Homborg
0631bc509b Update copyright years
I hate this on principle, but as far as I know it has to be done.
2021-05-03 13:12:11 +02:00
Fabian Homborg
4728d1772f Fix doc reference 2021-05-01 19:44:15 +02:00
Fabian Homborg
2b74affaf0 Add prompt selector
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.
2021-05-01 18:50:05 +02:00
Fabian Homborg
2cea5b8eb1 Add a "prompt_login" helper function
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.
2021-04-30 17:07:54 +02:00
Fabian Homborg
58885fbd0b docs: Handle undefined LINK_SUFFIX
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
2021-04-25 09:42:02 +02:00
Karolina Gontarek
9d66ddc840 Rename variable to fish_killring 2021-04-21 16:39:29 -07:00
Karolina Gontarek
da97daa800 Add variable to Special variables section 2021-04-21 16:39:29 -07:00
Karolina Gontarek
539837f317 Add variable to documentation 2021-04-21 16:39:29 -07:00
Josh Leichtung
f99127a158 Fix spelling of wheel in Wildcards docs 2021-04-18 07:47:52 +02:00
Fabian Homborg
4bcecc8983 docs: Make background at least one screen tall
Otherwise this would look ugly by stopping the gradient after the
content, so in e.g. the `end` or `false` page it would leave an ugly stripe at
the bottom.
2021-04-17 17:36:32 +02:00
Fabian Homborg
d9b212f60b docs: Move some more sections from index to language
These aren't a 100% *exact* fit, but they're mostly language features.
2021-04-16 18:06:33 +02:00
Fabian Homborg
8bc7a85a69 docs: Remove #anchor links
Fixes at least one broken link to syntax
2021-04-16 18:06:33 +02:00
Fabian Homborg
9850f8d18a docs: Update status docs
`status --current-function` is not a thing.
2021-04-14 21:46:51 +02:00
David Adam
9db846a5a7 docs: some improvements to the notes on key bindings
Includes acknowledgement that these are not full editors. Closes #4023.
2021-04-14 21:43:14 +08:00
Fabian Homborg
d31d7e4880 docs: Add missing newline 2021-04-11 18:44:19 +02:00
David Adam
b05275cedc docs: remove undo-group functions from documentation
As discussed in
85ffa77b4e
these functions are not intended for long term use.

Also fix a typo introduced in 85ffa77.
2021-04-06 21:18:21 +08:00
Fabian Homborg
f1d3e7a0db docs: Reorder ToC
Roughly the order I expect these to be used in.
2021-03-31 17:21:46 +02:00
Fabian Homborg
b5a5d98f80 docs: Add missing "`"
Fixes a sphinx warning.
2021-03-31 17:21:46 +02:00
David Adam
85ffa77b4e docs: note undocumented input functions
Noted in #7828.
2021-03-31 10:41:21 +08:00
Fabian Homborg
ed9268f99c
math: Make function parentheses optional (#7877)
* math: Make function parentheses optional

It's a bit annoying to use parentheses here because that requires
quoting or escaping.

This allows the parens to be omitted, so

math sin pi

is the same as

math 'sin(pi)'

Function calls have the lowest precedence, so

math sin 2 + 6

is the same as

math 'sin(2 + 6)'

* Add more tests

* Add a note to the docs

* even moar docs

Moar docca

* moar tests

Call me Nikola Testla
2021-03-30 17:21:28 +02:00
Fabian Homborg
18e332772d functions: Add "--no-details" flag and use it in funced
This inhibits the function path comment which is annoying in `funced`.

Fixes #7879.
2021-03-30 16:54:26 +02:00
Fabian Homborg
e1d19cf571 Don't touch $SHLVL if not interactive
It's not super clear what $SHLVL is useful for, but the current
definition is essentially
"number of shells in the parent processes + 1"

which isn't *super useful*?

Bash's behavior here is a bit weird in that it increments $SHLVL
basically always, but since it auto-execs the last process it will
decrement it again, so in practice it's often not incremented.

E.g.

```
> echo $SHLVL
1
> bash -c 'echo $SHLVL; bash'
2
>> echo $SHLVL
2
```

Both bashes here end up having the same $SHLVL because this is
equivalent to `echo $SHLVL; exec bash`. Running `echo $SHLVL` and then
`bash -c 'echo $SHLVL'` in an interactive bash will have a different
result (1 and 2) because that doesn't *exec* the inner bash.

That's not something we want to get into, so what we do is increment
$SHLVL in every interactive fish. Non-interactive fish will simply
import the existing value.

That means if you had e.g. a bash that runs a fish script that ends up
opening a new fish session, you would have a $SHLVL of *2* - one for the
bash, and one for the inner fish.

We key this off is_interactive_session() (which can also be enabled
via `fish -i`) because it's easy and because `fish -i` is asking for
fish to be, in some form, "interactive".

That means most of the time $SHLVL will be "how many shells am I deep,
how often do I have to `exit`", except for when you specifically asked
for a fish to be "interactive". If that's a problem, we can rethink it.

Fixes #7864.
2021-03-29 17:44:13 +02:00
Ilan Cosman
c762c62464 Add max and min math functions 2021-03-28 13:22:44 -07:00
Fabian Homborg
e7abb52526 Remove special "default" value for $fish_history
This is really of very little use and makes checking $fish_history
harder because it makes two values mean the same thing.

Fixes #7650
2021-03-28 12:09:58 +02:00
Fabian Homborg
93eaa61294 Split up documentation
This breaks apart the massive "index" document into

1. An "index" document that explains how to install and set up fish
and links to the other documents
2. A "fish-language" document that describes the syntax and semantics
of the language
3. A "fish-interactive" document that describes how to use fish
interactively

No change to the content has been made, only the parts have been moved
from index and some of the formatting (links and header levels) were
fixed.

See #7348.
2021-03-27 15:44:17 +01:00
Fabian Homborg
58177ba091 docs: Replace all internal links with :ref:s
Unlike links, these are checked by sphinx and it complains if they
don't match.

Also they have a better chance of doing something useful in outputs
other than html.
2021-03-26 19:32:14 +01:00
Fabian Homborg
8e6cfa1311 docs: Explicity link a few more sections
This makes it easier to move them around.
2021-03-26 19:32:14 +01:00
Fabian Homborg
cbd8f5f63e math: Add log2
This was already in the documentation as an example, now it is
actually working.

Fixes #7734
2021-03-26 19:30:38 +01:00
Fabian Homborg
018f1f7e20 docs: Document the math functions better 2021-03-11 19:46:52 +01:00
Fabian Homborg
4218c1f1a4 faq: Reword ssh question
This was a bit stuffy

Also let's mention tmux because that's another thing that may cause this.
2021-03-08 22:28:26 +01:00
Fabian Homborg
c96a07dc96 Revert "Prevent redirecting internal processes to file descriptors above 2"
FDs are inherited, and redirecting those is harmless, and forbidding
that is worse than allowing all.

Fixes #7769.

This reverts commit 11a373f121.
2021-03-03 22:26:33 +01:00
Fabian Homborg
54ff7b29a9 docs: Give logo a specific width 2021-03-02 17:03:32 +01:00
Fabian Homborg
5b4db4a6ea docs: Remove some useless wrappers
The "classic" theme is a mostly useless wrapper around the basic theme
that just adds a collapsible sidebar (that we no longer have).

Moving to basic directly drops a layer of indirection and a file that
needs to be transferred over the net.

Same thing goes for "default.css" which literally just includes
classic.css (WHYYYY???)

(also this removes some useless javascript)
2021-03-02 16:59:38 +01:00
Fabian Homborg
edfa6746c6 docs: Move pygments css 2021-03-02 16:52:28 +01:00
Fabian Homborg
bf801afef8 docs: Move custom.css into the main css
There's no real separation here so one file is preferable.

We'll leave the pygments.css intact because that handles a different thing
2021-03-02 16:49:23 +01:00
Fabian Homborg
12e059adf8 docs: Hardcode a list of short builtins for unmatched search
Unfortunately this has both stopwords and a length limit, and things
like "and" just are tough to search.

So what we do is leave everything as it is, but when a search fails,
we show a list of things that are hard to search for, currently that's
"and", "for", "if" and such.

Fixes #7757.
2021-03-02 14:17:29 +01:00
David Adam
c402ce0152 docs: note that function --on-variable is not fired for every change
As discussed in #7735.
2021-02-28 21:24:22 +08:00
David Adam
3e8e864c7c docs: note job expansion in bg/fg/jobs arguments
Discussed in #5019.
2021-02-28 20:56:23 +08:00
David Adam
39230978b3 docs: call the CHANGELOG "release notes" 2021-02-25 22:46:24 +08:00
David Adam
e9ec95f875 docs: minor updates to math documentation
Closes #7734.
2021-02-21 21:34:15 +08:00
ridiculousfish
11a373f121 Prevent redirecting internal processes to file descriptors above 2
The user may write for example:

    echo foo >&5

and fish would try to output to file descriptor 5, within the fish process
itself. This has unpredictable effects and isn't useful. Make this an
error.

Note that the reverse is "allowed" but ignored:

    echo foo 5>&1

this conceptually dup2s stdout to fd 5, but since no builtin writes to fd
5 we ignore it.
2021-02-20 16:16:45 -08:00
Ethel Morgan
5a0aa7824f Saturate exit codes to 255 for all builtins
After commit 6dd6a57c60, 3 remaining
builtins were affected by uint8_t overflow: `exit`, `return`, and
`functions --query`.

This commit:
- Moves the overflow check from `builtin_set_query` to `builtin_run`.
- Removes a conflicting int -> uint8_t conversion in `builtin_return`.
- Adds tests for the 3 remaining affected builtins.
- Simplifies the wording for the documentation for `set --query`.
- Does not change documentation for `functions --query`, because it does
  not state the exit code in its API.
- Updates the CHANGELOG to reflect the change to all builtins.
2021-02-13 08:41:51 +01:00
Ethel Morgan
6dd6a57c60 Saturate return value in builtin_set_query
builtin_set_query returns the number of missing variables. Because the
return value passed to the shell is an 8-bit unsigned integer, if the
number of missing variables is a multiple of 256, it would overflow to 0.

This commit saturates the return value at 255 if there are more than 255
missing variables.
2021-02-08 20:38:56 +01:00
Fabian Homborg
b3626d48e7 Highlight keywords differently
This introduces a new variable $fish_color_keyword that will be used
to highlight keywords. If it's not defined, we fall back on
$fish_color_command as before.

An issue here is that most of our keywords have this weird duality of
also being builtins *if* executed without an argument or with
`--help`.

This means that e.g.

    if

is highlighted as a command until you start typing

    if t

and then it turns keyword.
2021-02-07 21:18:51 +01:00
Fabian Homborg
c8a91cb067 docs: Fix link in bind
Found while replacing links with :ref: roles, which are checked.
2021-02-05 20:19:28 +01:00
Fabian Homborg
b70600e070 docs: Remove errant space 2021-02-05 17:11:29 +01:00
Michael Jarvis
496d7c44a1 Fix sphinx doc warning
~/src/fish-shell/doc_src/cmds/argparse.rst:103: WARNING: Literal block ends without a blank line; unexpected unindent.
~/src/fish-shell/doc_src/cmds/argparse.rst:103: WARNING: Literal block ends without a blank line; unexpected unindent.
2021-02-05 11:07:58 +01:00
Fabian Homborg
3eef295990 docs/argparse: Remove more of the vestigial shortopt mentions
It should only be mentioned as a backwards-compatibility measure,
because it is useless - not even the short flag variable is set.
2021-02-03 19:13:53 +01:00
Fabian Homborg
d2d18e2a6a docs: Remove references to read history
This hasn't been kept since #5904 in 3.1.0.
2021-02-02 09:42:57 +01:00
Fabian Homborg
bb1aa5e72f docs: Make more code lines shorter 2021-02-02 08:35:38 +01:00
Fabian Homborg
8bb3d1198f docs: Make code lines shorter 2021-02-02 08:29:31 +01:00
Fabian Homborg
2faf814da4 docs: Point away from set -x
This is a common anti-pattern, we should try to get people to do `set -gx`.
2021-02-01 18:12:24 +01:00
Fabian Homborg
6442dc96d6 docs: Add a loops section to index
This was only in the tutorial - we really should improve the split here.
2021-01-31 13:15:03 +01:00
Fabian Homborg
7eb616b787 docs: Make some things subsections
E.g. autoloading and aliases are both about functions, variable scope
and overrides are both about variables.

It makes sense to group these together, and this might allow us to
collapse some of the TOC later.
2021-01-31 12:34:47 +01:00
Fabian Homborg
02c11e1db5 docs: Put variable expansion before command substitution
That's the order the parent section lists it in.
2021-01-31 12:30:20 +01:00
Fabian Homborg
892330b904 docs: Drop "Other features" header
This has two features now, there's no need to group it.
2021-01-31 11:59:43 +01:00
Fabian Homborg
00fc56f3e1 docs: Drop weird local table of contents from "Installation" section
This is about a page long, it doesn't need links.
2021-01-31 11:57:51 +01:00
Fabian Homborg
ad560e2b80 docs: Expand a bit on the alias/abbr thing
Also move abbr explanation to interactive use (as abbrs are purely an
interactive concept)

(also add an example to tilde expansion, not making a separate commit
for that)
2021-01-31 11:56:19 +01:00
Fabian Homborg
8e8349d714 docs: Unify job control
Remove the redundant "running multiple programs" section and merge the
"job control" and "background" sections.
2021-01-31 11:49:54 +01:00
Fabian Homborg
9fead046b5 docs: Explain the man/help split in the help section 2021-01-31 11:41:46 +01:00
Fabian Homborg
594d51e7eb Add a separate --profile-startup option to profile startup
This goes to a separate file because that makes option parsing easier
and allows profiling both at the same time.

The "normal" profile now contains only the profile data of the actual
run, which is much more useful - you can now profile a function by
running

   fish -C 'source /path/to/thing' --profile /tmp/thefunction.prof -c 'thefunction'

and won't need to filter out extraneous information.
2021-01-29 20:46:34 +01:00
Fabian Homborg
cf800db10a docs: Move things from "Other features" to "Interactive use"
These are interactive features, after all
2021-01-29 20:08:37 +01:00
Fabian Homborg
ca3d226659 docs: Fix TOC text and put them in a div
This allows us to flex them together, so now you get one column on the
left with the title "Documents" and one on the right saying
"Sections" on narrow screens.

On wide screens it doesn't say "Table Of Contents" twice.

This should make it clearer
2021-01-27 22:02:35 +01:00
Fabian Homborg
3d180b7c50 docs: Make TOC appear first on narrow screens
This used to put the TOC last, which is the last place you'd want it.

It's not perfect and we do some hacky layoutery to achieve it, but it
should generally be usable.
2021-01-27 21:53:24 +01:00
Fabian Homborg
711fa31871 docs: Remove broken footnote
Oops!
2021-01-27 18:25:46 +01:00
Fabian Homborg
fc5f7975a6 docs: Make tables scrollable on overflow
This makes the *tables* themselves scrollable, not the section div
they are in, which means the section doesn't scroll along with
them (it's already reflowed).
2021-01-27 17:56:24 +01:00
Fabian Homborg
dd64035d23 docs: Some adjustments
Rewordings, :ref: links, typos
2021-01-27 17:39:09 +01:00
Fabian Homborg
4a7ce4f51c docs: More line-length fixes 2021-01-26 16:15:38 +01:00
Fabian Homborg
cbc9de3663 docs: Make the lines in the code examples shorter
We should typically avoid scrolling even at max-width.

An exception here is the output of `functions` - this prints one very
long line, but it's really not important what's in there specifically,
it's just to illustrate the kind of output you'd get.
2021-01-26 09:29:58 +01:00
Fabian Homborg
d5ce648e10 docs/theme: Indent
Just do what emacs does, I don't like any of the available css
autoformatters (and we don't use it enough for that to matter)
2021-01-26 09:19:47 +01:00
Fabian Homborg
1e0ac9fa77 docs/theme: Remove prefixed boxshadow
See https://caniuse.com/css-boxshadow

TL;DR: It's supported by everything, the unprefixed version was added
to Firefox *4*.
2021-01-26 09:18:07 +01:00
Fabian Homborg
75f197b28e docs/theme: Add bottom margin
This makes it look like it's a page on top of the background gradient
2021-01-26 09:10:42 +01:00
Fabian Homborg
d4e76f5c5a docs/theme: Remove a bit of padding 2021-01-25 23:02:38 +01:00
Fabian Homborg
dc552fa0ab docs/theme: Make sidebar border less intrusive
Only on the right, much lighter, no radius
2021-01-25 22:59:30 +01:00
Fabian Homborg
651259e794 docs/theme: Fix padding when the searchbox is last
See e.g. the commands page - there's no separate TOC, so the searchbox
almost runs into the border
2021-01-25 22:55:29 +01:00
Fabian Homborg
117e663efe docs/theme: Remove horizontal scrolling on small screens
This clips overflowing padding/margins and thereby removes
non-"content" that's just off-screen, making the site scrollable.

The exception here is for tables - we allow scrolling the *section*
divs for those (because I have no idea how to only make the <table>
scrollable), if necessary of course.
2021-01-25 22:24:28 +01:00
Fabian Homborg
c39c985512 docs/theme: Limit fmain width
This causes it to be centered when the screen is large
2021-01-25 21:52:07 +01:00
Fabian Homborg
159c2aae1f docs/theme: Fix padding on small screens
This had the text overflowing the screen.

Now it should center nicely.
2021-01-25 21:34:42 +01:00
Fabian Homborg
5b366b9cb5 docs/tutorial: Mention alias
This came up online - here we exclaim that fish has no aliases (which
is true), but then in the main docs we explain that you can use
`alias` to make something (which is also true).

Add a foot note explaining the apparent contradiction.
2021-01-25 19:11:00 +01:00
Fabian Homborg
b59cad3c5b
Merge pull request #7654 from mattdutson/intro-doc
More improvements to clarity and grammar of Introduction doc page
2021-01-25 19:08:19 +01:00
Fabian Homborg
5f93df240e Fish for bash users: Fix missing word and link it from index 2021-01-22 16:23:09 +01:00
Fabian Homborg
1285957703 docs: Add glob example to variable overrides
And clarify that it'll still run the same things
2021-01-17 10:31:23 +01:00
Fabian Homborg
e2fb645c0c docs: Don't add rst sources
This used to add a "_sources" directory with all the ".rst" files
renamed to ".rst.txt".

That took up ~0.7M of the total size for very little use.
2021-01-16 19:33:12 +01:00
Fabian Homborg
e192066e98 Add $fish_handle_reflow to disable winch handler
Overriding event handlers is annoying.
2021-01-15 18:37:06 +01:00
Matthew Dutson
d079026ecc Merge branch 'master' into intro-doc 2021-01-12 17:37:16 -06:00