Commit Graph

29 Commits

Author SHA1 Message Date
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
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
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
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
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
843c9383aa docs: Remove non-functional link 2021-06-02 17:33:55 +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
af84c35282 docs: A bit more on autoloading 2021-05-16 21:27:00 +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
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
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
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
Josh Leichtung
f99127a158 Fix spelling of wheel in Wildcards docs 2021-04-18 07:47:52 +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
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
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
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