Commit Graph

1703 Commits

Author SHA1 Message Date
Fabian Homborg
57eccb7e1e docs: Readd note about the command to realpath 2021-11-12 18:28:35 +01:00
Fabian Homborg
9a9cd5172d docs: Don't make envvar names so large and in a different font
They're still bold, so still quite noticeable.

But not *IN YOUR FACE*.
2021-11-12 18:21:38 +01:00
Fabian Homborg
02553d8fa6 Docs: Don't use seealso
This is too eye catching and almost unreadable in the dark theme.
2021-11-12 18:13:36 +01:00
Fabian Homborg
edc09c8419 Docs: Switch back to vanilla :ref: for commands that should be linked
Unfortunately, currently :program: doesn't link to the program's page.

So we use the old-school :ref: again where we should link, i.e. for
everything that's not the program the current page is about.

Fixes #8438
2021-11-12 18:02:56 +01:00
Fabian Homborg
2e9e94f17e Fix broken envvar link
Apparently you can't use spaces here.
2021-11-12 17:57:11 +01:00
Aaron Gyes
7a8fce6941 Thwart more dastardly schemes
thanks @faho
2021-11-12 04:52:38 -08:00
Aaron Gyes
e6eb049aeb Remove imperialist sabotage to previous commit
Juche!
2021-11-12 04:39:11 -08:00
Aaron Gyes
ac1df310c8 Long march towards more structured text 2021-11-12 04:22:35 -08:00
Aaron Gyes
97245fcd3f fix typo 2021-11-06 14:14:11 -07:00
Aaron Gyes
94890c28d3 Underline links. Use CSS to add $ to envvar links 2021-11-06 14:09:27 -07:00
Aaron Gyes
579d1e190c pygments.css: update colors
Try some nicer greens, and grey for comments in the code blocks.
2021-11-06 14:09:27 -07:00
ridiculousfish
797e3f1ce9 language.rst: clean up redirection docs and mention noclobber + append
Fixes #8380
2021-11-06 13:11:18 -07:00
ridiculousfish
13133f66be docs: remove an errant } from the css file
This was causing strange spacing in the language docs.
2021-11-06 12:30:51 -07:00
Aaron Gyes
b550b38859 index.rst: copy-edit
Try to improve the quality of this writing.

Evict a paragraph about running Bash from our documentation front
page.
2021-11-05 16:50:19 -07:00
Aaron Gyes
da896cfcd4 pydoctheme.css: bump up line spacing
make this less of an eye-chart.
2021-11-05 16:34:34 -07:00
Aaron Gyes
c5e02206d3 Fix up the _PATH ref.
So, it looks like even without -n `sphinx` will report on refs
are bad.

Closes #8407
2021-11-05 16:21:01 -07:00
Aaron Gyes
3078d0a252 fish documentation manpages: omit NAME for non-commands
Documents like fish-tutorial don't need the NAME portion below.

(they also shoudln't be in section 1! These should be section 7,
they aren't for programs.)

the manpage writer will skip NAME if given an empty sstring as
the description.

--

FISH-TUTORIAL(1)     fish-shell     FISH-TUTORIAL(1)

NAME
       fish-tutorial - fish-shell tutorial
2021-11-05 07:50:30 -07:00
Aaron Gyes
d54c8a42a9 Documentation WIP:
Start doing the envvar:: directives and cut some copy. These should
be linking up now.
2021-11-05 05:14:02 -07:00
Fabian Homborg
a4ae950312 Readd copyright section
Otherwise the html render will just show

"Copyright ."

Also this is typically added and it's non-intrusive
2021-11-04 22:00:56 +01:00
Aaron Gyes
0803a8fc3e Remove Copyright sectionf from doc pages, and a couple missing bits
... from fish.rst
2021-11-04 13:27:52 -07:00
Aaron Gyes
1c5a88ad21 pydoctheme.css: render #synopsis usage as monospace. 2021-11-04 13:23:22 -07:00
Aaron Gyes
42239d4dd8 fish.rst: do better
This fixes the indentation problem for the SYNOPSIS section by not
inserting the :: literal block. Format it the same way Sphinx does
their own manpages for commands.

Use more semantic markup, like :command:, so that commands are
highlighted in the man pages.

Split by sentence to give `man` a chance to ascertain lines.

Long-term, it should be possible to teach Sphinx to turn :command:s
into references and get us automatic links to articles for matching
cmds/*.
2021-11-04 13:16:13 -07:00
Fabian Homborg
ea40c1e9de docs: Add missing backticks
This turned `\n` into `n`.
2021-11-04 15:21:28 +01:00
Fabian Homborg
de79458be2 docs: Expand string-for-bash-users section
Show some cool stuff.
2021-11-03 17:29:51 +01:00
Fabian Homborg
a4adda5da8 docs: Expand math for bash users a bit
Also fix some awkward typos.
2021-11-03 17:23:36 +01:00
Fabian Homborg
cbf28dfa57 Document turning off suggestions/history
Also add more mentions of `fish_config` in general.
2021-11-02 21:40:56 +01:00
Fabian Homborg
4118bda21c docs: Go over the FAQ again
Mention more fish_config CLI, `$()`, do some rewording, ...
2021-10-29 17:14:53 +02:00
Fabian Homborg
a4983af94d docs: Fix section level
Using "=====" makes it an entry in the toc
2021-10-29 17:01:48 +02:00
Fabian Homborg
8428247f31 docs: Split up the variable docs some more
(also remove some broken or incorrect footnotes)
2021-10-28 16:48:08 +02:00
Fabian Homborg
387904928b docs: Add more on wordsplitting 2021-10-28 16:42:19 +02:00
Fabian Homborg
ae3d5af1ab docs: Correct an example 2021-10-28 16:35:21 +02:00
Fabian Homborg
bffb49b38a Explicitly mention function variables don't go out of scope
Fixes #8385.
2021-10-27 16:55:11 +02:00
Aaron Gyes
91a048596b sphinx: enable proper quotes with the smartquotes module
turn off the option for em-dashes.
2021-10-26 10:46:06 -07:00
Fabian Homborg
d03ec2cc6b docs/interactive: Some rewording. 2021-10-24 21:18:31 +02:00
Fabian Homborg
479c11bc80 FAQ: Remove rarely asked questions 2021-10-24 21:18:31 +02:00
Fabian Homborg
4b46717a91 docs: Move configuration section to language
Instead leave a simple "use config.fish" bit in-place.

Also some minor rewording.
2021-10-23 17:13:36 +02:00
Fabian Homborg
aef6cc1538 docs: Hand-write a list of short descriptions in commands
This is more readable than the full list, especially for the important
things.
2021-10-23 16:46:15 +02:00
Fabian Homborg
db5e7734a6 Some small changes to the docs
Reorder the variables, make more cd-related stuff subsections, a
slight rewording.
2021-10-20 21:28:14 +02:00
Fabian Homborg
711796ad13 Highlight options differently
This introduces a new variable, $fish_color_option, that can be used
to highlight options differently.

Options are tokens starting with `-`, but only up to (and including!)
the first `--`.

Fixes #8292.
2021-10-19 17:20:21 +02:00
Erik Serrander
049104e8df Adds sub-command clear-session to history command.
Issue #5791
This clears all history for the current session. Documentation and
autocompletion for the new subcommand is added.
2021-10-17 19:27:46 -07:00
Aaron Gyes
ec855c75c0 run fish.png through imageoptim
14KB -> 7KB
2021-10-16 14:33:12 -07:00
Adam Skoufis
d619d79117
Fix typo in set_colors command documentation (#8321)
* Fix typo in `set_colors` command documentation
* Replace `It` with `VALUE` to reduce ambiguity
2021-09-29 08:17:21 -07:00
Aaron Gyes
ed8c78c0ea Update docs, completions for funcsave
Remove long opt for -q, funcsave does not have so many options that
it's any help.
2021-09-29 03:08:10 -07:00
Fabian Homborg
f4c8dc72a7 docs: Some minor stuff in fish_for_bash_users 2021-09-24 20:32:29 +02:00
Fabian Homborg
615e8b2e8b docs: Expand section on heredocs
This should give a better rationale for why fish doesn't have them.
2021-09-24 20:29:57 +02:00
Fabian Homborg
45714eb29d Add function scope to read as well
Fixes #8295.
2021-09-23 17:12:37 +02:00
Adam Skoufis
1ff6160058 Fix typo in abbr docs 2021-09-09 15:13:17 +02:00
Johannes Altmanninger
7cdf624086 docs: mention the "all" feature group 2021-09-05 03:34:25 +02:00
Ariel Fermani
2e24aaa605 docs: Fix missing semicolon in Bash group command example 2021-09-04 16:30:28 +02:00
Fabian Homborg
8b4585d387 docs: Some mistakes in interactive
"This page" is no longer index, we don't match matching parentheses or
quotes and the `\n` didn't show up in the render as the backslash disappeared.
2021-09-01 19:48:33 +02:00
Evan Chen
878bfa94cb Typo funcions -> functions 2021-08-28 22:47:00 +02:00
Fabian Homborg
c055e3ae66 docs: Reword feature flags chapter 2021-08-17 17:32:41 +02:00
David Adam
8dd4c67db1 funcsave: edit the whole file containing a function
Many functions ship in files with helper functions, and it is useful to
edit those too.

Closes #391.
2021-08-16 21:45:22 +08:00
David Adam
a40e60b45b funced: minor grammar fixes to documentation 2021-08-16 21:44:43 +08:00
Fabian Homborg
7f34b8ab53 docs: Add copy buttons to all the codeblocks
This uses a bit of javascript to add copy buttons, so you can directly
copy all the code in a given block to the clipboard!

For codeblocks without prompts, it just copies all the code, for
blocks with prompts, it copies all the lines after prompts, under the
assumption that that's the code to be executed.

It would give you *all* the lines, so the output wouldn't be
interleaved like it is in the html, but good enough.

The buttons appear on hover, so they aren't usable on phones, but
since you won't really have a clipboard on phones and I have no idea
how to make them not always in front of the text otherwise: Eh.

I'm not in love with the javascript here, but it'll do.
2021-08-15 20:09:49 +02:00
Fabian Homborg
c4593828f4
commandline: Add --is-valid option (#8142)
* commandline: Add --is-valid option to query whether it's syntactically complete

This means querying when the commandline is in a state that it could
be executed. Because our `execute` bind function also inserts a
newline if it isn't.

One case that's not handled right now: `execute` also expands
abbreviations, those can technically make the commandline invalid
again.

Unfortunately we have no real way to *check* without doing the
replacement.

Also since abbreviations are only available in command position when
you _execute_ them the commandline will most likely be valid.

This is enough to make transient prompts work:

```fish
function reset-transient --on-event fish_postexec
    set -g TRANSIENT 0
end

function maybe_execute
    if commandline --is-valid
        set -g TRANSIENT 1
        commandline -f repaint
    else
        set -g TRANSIENT 0
    end
    commandline -f execute
end

bind \r maybe_execute
```

and then in `fish_prompt` react to $TRANSIENT being set to 1.
2021-08-14 11:29:22 +02:00
Fabian Homborg
eee38836cf set -q: Return 255 if no variable name was passed
Previously this strictly returned the number of unset variables. So if
no variable was given, it would return *true*, which is highly
suspect.
2021-08-14 10:55:21 +02:00
Fabian Homborg
35c53a94b5 docs: Remove stuff from globbing
That `find` example is a bit dated and awkward, and doesn't really fit
the section.

We also don't want to point people to `?` because we want to remove it.
2021-08-11 18:42:21 +02:00
Fabian Homborg
013f98a5b3 docs: Double-re-extra mention bash vs fish globbing
And in the section we now point people towards!
2021-08-11 18:41:37 +02:00
Johannes Altmanninger
cb3f3480b2 Fix punctuation in footnote 2021-08-10 21:01:39 +02:00
Fabian Homborg
b10d64e22e prompt_pwd: Update docs 2021-08-09 17:42:00 +02:00
Fabian Homborg
7a8feb4656 prompt_pwd: Allow keeping components full length
And allow passing the parameters as options.
2021-08-09 17:42:00 +02:00
Fabian Homborg
b2764ad4b1 docs 2021-08-04 21:09:47 +02:00
Fabian Homborg
733114fefb
Add set --function (#8145)
* Add `set --function`

This makes the function's scope available, even inside of blocks. Outside of blocks it's the toplevel local scope.

This removes the need to declare variables locally before use, and will probably end up being the main way variables get set.

E.g.:

```fish
set -l thing
if condition
    set thing one
else
    set thing two
end
```

could be written as

```fish
if condition
    set -f thing one
else
    set -f thing two
end
```

Note: Many scripts shipped with fish use workarounds like `and`/`or`
instead of `if`, so it isn't easy to find good examples.

Also, if there isn't an else-branch in that above, just with

```fish
if condition
    set -f thing one
end
```

that means something different from setting it before! Now, if
`condition` isn't true, it would use a global (or universal) variable of
te same name!

Some more interesting parts:

Because it *is* a local scope, setting a variable `-f` and
`-l` in the toplevel of a function ends up the same:

```fish
function foo2
    set -l foo bar
    set -f foo baz # modifies the *same* variable!
end
```

but setting it locally inside a block creates a new local variable
that shadows the function-scoped variable:

```fish
function foo3
    set -f foo bar
    begin
        set -l foo banana
        # $foo is banana
    end
    # $foo is bar again
end
```

This is how local variables already work. "Local" is actually "block-scoped".

Also `set --show` will only show the closest local scope, so it won't
show a shadowed function-level variable. Again, this is how local
variables already work, and could be done as a separate change.

As a fun tidbit, functions with --no-scope-shadowing can now use this to set variables in the calling function. That's probably okay given that it's already an escape hatch (but to be clear: if it turns out to problematic I reserve the right to remove it).

Fixes #565
2021-08-01 20:08:12 +02:00
Fabian Homborg
2c420ef728 docs: Document that commands with space will be kept until the next 2021-08-01 14:01:49 +02:00
Fabian Homborg
0d054f16c4 docs: Remove background from pygments
For some reason I've seen one version of firefox use this over the one
we set in pydoctheme.css. Since we set it there in both light and dark
mode, this one should not be used.
2021-07-30 18:36:12 +02:00
Branch Vincent
d8465e0a86 document --no-config 2021-07-27 23:00:23 +02:00
Fabian Homborg
04b9a8b3b5 docs: Fix a label 2021-07-27 18:49:34 +02:00
Fabian Homborg
6e7d497a52 docs: Add a note explaining test 2021-07-27 18:35:20 +02:00
Fabian Homborg
d67470c482 docs: Link to the rest of the docs in fish_for_bash_users 2021-07-27 16:54:24 +02:00
Fabian Homborg
25af0230ad docs: Clarify stderr-nocaret being on by default 2021-07-27 16:54:03 +02:00
Johannes Altmanninger
cc32b4f2a7 Make '&' only background if followed by a separating character
This is opt-in through a new feature flag "ampersand-nobg-in-token".

When this flag and "qmark-noglob" are enabled, this command no longer
needs quoting:

	curl https://example.com/thing?foo=bar&duran=duran

Compared to the previous approach e1570a4 ("Let '&' only separate as
the first char of a word"), this has some advantages:

1. "&&" and "&>" are no longer affected. They are still special, even
   if used between tokens without spaces, like "echo bar&>foo".
   Maybe this is not really *better*, but it avoids risking to annoy
   users by breaking the old variant.

2. "&" is still special if at the end of a token, like in "sleep 1&".

Word movement is not affected by the semantics change, so Alt-F and
friends still stop at every "&".
2021-07-23 22:58:51 +02:00
Fabian Homborg
3cc59a9a12 docs: Document how complete groups options
Fixes #8146.
2021-07-23 19:29:16 +02:00
Fabian Homborg
7a5587de75 docs: Reword cd a bit 2021-07-23 18:00:57 +02:00
Fabian Homborg
152097ca34 doc: Some more rewordings
I'm struggling to avoid this massive list of files and directories.

Maybe a second section for integrators?
2021-07-23 18:00:57 +02:00
Fabian Homborg
3359e5d2e9
Let "return" exit a script (#8148)
Currently, if a "return" is given outside of a function, we'd just
throw an error.

That always struck me as a bit weird, given that scripts can also
return a value.

So simply let "return" outside also exit the script, kinda like "exit"
does.

However, unlike "exit" it doesn't quit an interactive shell - it seems
weird to have "return" do that as well. It sets $status, so it can be
used to quickly set that, in case you want to test something.
2021-07-21 22:33:39 +02:00
Fabian Homborg
4be6021131 docs: Some de-alienizing of the configuration section
Still not happy with this, it's overwhelming!

Might have to split this into two - one with simple paths and rough
descriptions, and one with the full scoop for experts?
2021-07-20 21:03:55 +02:00
Fabian Homborg
f3f6e4a982 string: Add "--groups-only" to match
This adds a simple way of picking bits from a string that might be a
bit nicer than having to resort to a full `replace`.

Fixes #6056
2021-07-16 20:27:54 +02:00
Fabian Homborg
801d7e3e11 docs: Document that the man pages are for our builtins
For builtins that have the same name as common commands, it might not
be entirely obvious that there is another page.

So, for those builtins, we add a note, but only in the man pages.

(exception is true and false because the note would be longer than the
page, and it's fridging true and false)

Fixes #8077.
2021-07-16 18:21:41 +02:00
Fabian Homborg
ee8c5579f3 docs: Add some links
(and remove a stray sentence)
2021-07-16 18:08:55 +02:00
Fabian Homborg
a6699576ce docs: Some more $() changes 2021-07-16 18:08:36 +02:00
Fabian Homborg
8223e6f23e fish_config: Add CLI-based theme selector
`fish_config theme`:

- `list` to list all available themes (files in the two theme
directories - either the web_config/themes one or
~/.config/fish/themes!)
- `show` to show select (or all) themes right in the terminal - this
starts another fish that reads the theme file and prints the sample
text, manually colored
- `choose` to load a theme *now*, setting the variables globally
- `save` to load a theme and save the variables universally
- `dump` to write the current theme in .theme format (to stdout)
- `demo` to display the current theme
2021-07-14 18:56:19 +02:00
Fabian Homborg
01b0b04cbf docs: Remove lAtEx thing again
Now it's screaming in the man builder.

Honestly, some parts of sphinx aren't very well thought out.
2021-07-14 17:03:41 +02:00
Fabian Homborg
2b7f6e4b0c docs: Put a note on which binding function to call in each section
Fixes #8084.
2021-07-14 16:49:22 +02:00
Fabian Homborg
df6109b953 docs: Reword bit about aliases and autoloading
This was kinda misleading. Point people to funcsave and `alias --save`
instead.

Fixes #8137.
2021-07-14 16:46:26 +02:00
Fabian Homborg
6640f45913 docs: Use a separate top-level document for lAtEx
This screams about duplicate labels even *if this part isn't built!*

So we use another document that we ignore in other builders.

Blergh
2021-07-14 16:42:04 +02:00
Fabian Homborg
36d9e7b6d6 docs: In latex build, just concatenate the important docs
Instead of having a toctree after the "index", just append the
important documents directly. Having one pdf file with different
chapters and sections and such feels better.
2021-07-13 23:06:01 +02:00
Fabian Homborg
feb3a15739 docs: Make title level consistent
This allows us to ..include these without getting confused.
2021-07-13 23:05:23 +02:00
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
Matthew Dutson
480f7fdb37 Revise "Piping" section 2021-01-12 17:24:23 -06:00
Fabian Homborg
7fc72e46b3 docs: Add more about $PATH being imported to the tutorial
Fixes #7539.
2021-01-09 22:45:03 +01:00
Fabian Homborg
b489137fa9 docs: Link to fish_key_reader 2021-01-09 13:13:48 +01:00
David Adam
21f46181d9 string match: reword the named capture group documentation 2021-01-08 21:16:07 +08:00
David Adam
a0764ef3d2 docs: note limits on parameter expansion from #7226
introduced in 594a6a3
2021-01-07 15:44:01 +08:00
Fabian Homborg
cb9029944e docs: Remove margin entirely on small screens
This removes the margin with the background gradient and such
completely once the screen falls under 700px. In those cases we really
don't want to waste space, and having just a weird blue bit above the
docs looks weirder than not having anything.
2021-01-04 21:53:30 +01:00
Fabian Homborg
6eeb8861e7 Add exit bind function
Currently binding `exit` to a key checks too late that it's exitted,
so it leaves the shell hanging around until the user does an execute
or similar.

As I understand it, the `exit` builtin is supposed to only exit the
current "thread" (once that actually becomes a thing), and the
bindings would probably run in a dedicated one, so the simplest
solution here is to just add an `exit` bind function.

Fixes #7604.
2021-01-04 09:45:34 +01:00
Ilan Cosman
18940ea086
Remove dunderscores from __fish_status_to_signal (#7597)
* Remove dunderscores from __fish_status_to_signal

* Document fish_status_to_signal

* CHANGELOG: Add fish_status_to_signal

* Add string join to fish_status_to_signal documentation example
2021-01-03 15:15:57 +01:00
ridiculousfish
118f710e99 Allow fish_private_mode to change at runtime
Prior to this change, `fish_private_mode` worked by just suppressing
history outright. With this change, `fish_private_mode` can be toggled on
and off. Commands entered while `fish_private_mode` is set are stored but
in memory only; they are not written to disk.

Fixes #7590
Fixes #7589
2021-01-02 22:01:47 -08:00
Fabian Homborg
b43a8688fe docs: Correct argparse on short- options
These aren't exposed as variables at all, so it's just entirely
vestigial now and only kept for backwards compatibility.
2021-01-01 14:22:22 +01:00
Fabian Homborg
57d23c390b docs: Reword argparse a bit
In particular use "variable" instead of "var".
2021-01-01 14:03:00 +01:00
Fabian Homborg
7ea8e20623
argparse: Make short flag names optional (#7585)
It was always a bit ridiculous that argparse required `X-longflag` if
that "X" short flag was never actually used anywhere.

Since the short letter is for getopt's benefit, we can hack around
this with our old friend: Unicode Private Use Areas.

We have a counter, starting at 0xE000 and going to 0xF8FF, that counts
up for all options that don't have a short flag and provides one. This
gives us up to 6400 long-only options.

6.4K should be enough for everybody.
2021-01-01 11:37:25 +01:00
ridiculousfish
43505f7077 Allow ** glob segments to match zero directories
Prior to this change, a glob like `**/file.txt` would only match
`file.txt` in subdirectories; the `**` must match at least one directory.
This is historical behavior.

With this change we move a little closer to bash's implementation by
allowing a literal `**` segment to match in the current directory. That
is, `**/foo` will match both `foo` and `bar/foo`, while `b**/foo` will
only match `bar/foo`.

Fixes #7222.
2020-12-28 23:51:18 -08:00
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