Commit graph

14910 commits

Author SHA1 Message Date
Fabian Homborg
5ecdcebf8d Fix help thinking some docs are commands
This looked at __fish_print_commands, which goes via our man pages to
find the commands (it shouldn't, buuut), and exludes a hard-coded list
of pages.

So we do two thigns:

1. We add the other doc pages to the list
2. We check commands *later* - if we listed something explicitly it
should be used
2021-11-25 21:25:46 +01:00
Fabian Homborg
c964edcd68 Use cat instead of ls to skip colorls
We don't really care *which*, we just want to generate some error so
we can see that the redirection worked.

Fixes #8492
2021-11-25 18:46:31 +01:00
Fabian Homborg
c71a2e573f Fix __fish_seen_argument
Fixes #8478
2021-11-23 18:12:51 +01:00
Ilan Cosman
566a673e4f Run fish_indent on all non-test .fish files 2021-11-23 09:49:45 +01:00
Johannes Altmanninger
37f385b193 completions/npm: offer package completions for "npm add" and "npm i"
Closes #8472
2021-11-23 01:13:27 +01:00
EmilySeville7cfg
7f86794881 __fish_seen_argument update:
- -p option use
- quoting simplify
- description add
2021-11-22 19:00:44 +01:00
Fabian Homborg
294ed27590 Changelog 2021-11-22 17:23:32 +01:00
Fabian Homborg
f2fd30df03
Make fish_key_reader's output simpler (#8467)
* fish_key_reader: Simplify default output

It now only prints the bind statement. Timing information and such is
relegated to a separate "verbose" mode.

* Adjust fish_key_reader docs

* Adjust tests
2021-11-22 17:22:22 +01:00
Johannes Altmanninger
084458bc47 Minor changelog updates 2021-11-21 12:03:12 +01:00
Fabian Homborg
ef33ec2f62 Keep narrow directory name around some more
What this did was

1. Find directory
2. Turn name into wcstring and return it
3. Turn name back into string for some operations

Instead, let's unglue the wcstringing from this, return the narrow
string and then widen it when we need.
2021-11-20 20:10:18 +01:00
Fabian Homborg
91ce41a2b4 Make script file error a bit more obvious
This didn't even mention that it was a script file, it was just

filename: File not found

Which would be rather confusing if e.g. someone forgot that
`--profile` requires an argument.
2021-11-20 17:44:06 +01:00
Fabian Homborg
707f042fc4 printf: Explain what couldn't be converted 2021-11-20 17:44:05 +01:00
Fabian Homborg
8391f94081 Improve error for redirections to invalid paths
This finds the first broken component, to help people figure out where
they misspelt something.

E.g.

```
echo foo >/usr/lob/systemd/system/machines.target.wants/var-lib-machines.mount
```

will now show:

```
warning: Path '/usr/lob' does not exist
```

which would help with seeing that it should be "/usr/lib".
2021-11-20 17:44:05 +01:00
Fabian Homborg
c82ce5132b Rename "rotten" to "broken" symlinks in completions as well
Now consistent again with cd - eae9ee7f35.
2021-11-20 17:44:05 +01:00
ridiculousfish
c78b7b07e7 cmake: move builtins to their own list
This separates the list of builtin sources from the list of other
sources, since it seems like a natural cleavage point. The library
structure is unchanged, it's all just one big fishlib.a.
2021-11-19 19:12:29 -08:00
Johannes Altmanninger
4657ac0a7c builtin complete: document that old-style option args can be given after =
Fixes #8457
2021-11-19 05:59:17 +01:00
Fabian Homborg
c6caa06dbe Don't use removed complete options
This was "--authoritative" (and unauthoritative). It was meant to make
fish mark everything that couldn't be generated via the completions as
an error, it was removed years ago and has been a no-op since then.
2021-11-18 19:28:57 +01:00
exploide
3a56c97087 slightly improved ansible-galaxy completions 2021-11-18 10:13:25 -08:00
Johannes Altmanninger
4c598b504f Follow include-what-you-use for our custom iswdigit()
Commit fe63c8ad3 (Shadow/override iswdigit instead of changing it at
individual call sites, 2021-10-04) added our own implementation of
iswdigit() to common.h. The "include-what-you-use" rule means that
files that use iswdigit() should now include common.h. Do that.
2021-11-18 15:06:12 +01:00
Johannes Altmanninger
9d38553384 fish_tests: format elapsed seconds with two decimal places, that's enough 2021-11-18 15:06:12 +01:00
Johannes Altmanninger
0d3d84a39c Fix typos in documentation 2021-11-18 15:06:12 +01:00
Johannes Altmanninger
0acbbfe2ca Document that a for-loop passes through any exit status
Unlike in other shells, for-loops do not set $status if
1. the loop count is zero, or if
2. the loop body consists of only commands like "set" that don't
   set $status.

POSIX for-loops always set an exit status (they set 0 if no loop
iterations). Following that would be awkward because it would add a
lot of complexity in combination with the 2 special cases above.

Document that "for" behaves the same as "set": it will pass through
existing $status, and also the last child's $status.

See the discussion in #8409
2021-11-18 15:06:12 +01:00
Emily Seville
3c4969fc38 Change "while" command title to match "for" one
Closes #8409
2021-11-18 14:54:46 +01:00
Kid
1e84164e4e Skip leading command in __fish_man_page 2021-11-17 12:50:57 -08:00
David Adam
e066715127 README: improve note on colorls 2021-11-16 21:42:07 +08:00
Kid
03f9c3d2e6 Give tests a more generic name 2021-11-16 12:06:55 +01:00
ridiculousfish
a47f498516 Correct syntax highlighting for variables spanning multiple lines
A variable may be broken across multiple lines with a backslash, for
example:

     > echo $FISH_\
       VERSION

Teach syntax highlighting about this line breaking. Fixes #8444
2021-11-15 23:04:45 -08:00
Ian Chamberlain
3773baf1f3 Use cargo run --example to get list of examples
This behavior matches the way completions are found for `cargo run`,
`cargo test`, etc., and is more robust and correct compared to looking
at filenames.
2021-11-16 07:15:08 +01:00
ridiculousfish
15a3caf244 Refactor env_universal_callbacks
Reduce some allocations and simplify how events are emitted.
2021-11-14 17:39:52 -08:00
ridiculousfish
88a89d0a52 docs: remove an errant space 2021-11-14 13:40:02 -08:00
ridiculousfish
485a945004 Clean up check_global_scope_exists
check_global_scope_exists is meant to warn if the user creates a
universal variable shadowing a global. In practice it always returned
success (though it may print an error). Remove its return value and
clean up the call sites. Also rename it to
`warn_if_uvar_shadows_global`. No functional change in this commit.
2021-11-14 13:07:02 -08:00
Johannes Altmanninger
64dddfc6ce Only expand abbreviations if cursor is directly at command token
On a commandline like "ls arg" (cursor at end) we do not expand
abbrevations on enter.  OTOH, on "ls " we do expand. This can be
frustrating because it means that the two obvious ways to suppress
abbrevation expansion (C-Space or post-expansion C-Z) cannot be used to
suppress expansion of a command without arguments.  (One workaround is
"ls #".)

Only expand-on-execute if the cursor is at the command name (no space
in between).

This is a strict improvement for realistic scenarios, because if there
is a space, the user has already expressed the intent to not expand
the abbreviation. (I hope no one is using recursive abbreviations.)

Closes #8423
2021-11-14 11:52:10 +01:00
Johannes Altmanninger
a32fa8fac9 Read $fish_autosuggestion_enabled on interactive startup
This allows to disable autosuggestions in config or with

	fish -C 'set -g fish_autosuggestion_enabled 0'

instead of only in existing interactive sessions.

I'm not sure if passing the env var table is actually necessary here,
since we already have a reader.
2021-11-14 11:52:10 +01:00
Fabian Homborg
0f1bc5335a docs: :envvar: the rest of the variables
Just a quick mechanical translation
2021-11-12 19:43:00 +01:00
Fabian Homborg
6b7fe49858 docs: Restrict underlining links to the body
Adding the underline in the list of sections makes them bleed
together, making it hard to discern where one ends and the other
begins.

In the body of the text we don't have that issue - multiple links are
rarely next to each other.

Fixes #8439
2021-11-12 18:47:56 +01:00
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
Fabian Homborg
94555ad26b CHANGELOG: Reorder
- More Notable
- Put ``_`` change into deprecation
- Things that can happen in scripts are scripting improvements, not
- interactive (funced is an interactive thing)
- Fix the variable name to turn off autosuggestions - it's $fish_autosuggestion_enabled.
2021-11-12 17:19:38 +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
Fabian Homborg
c16e30931b Fix abbr return status
This was supposed to act like `type -q` or `command -q`, in that it
returns 0 if at least 1 exists.

But because it used the wrong variable it didn't.

Fixes #8431.
2021-11-11 16:46:23 +01:00
Fabian Homborg
aa470e12b2 Defer escape bindings as well
This allows rebinding escape in the user list without breaking e.g.
arrow keys (which send escape and then `[A` and similar, so escape is
a prefix of them).

Fixes #8428.
2021-11-10 20:40:21 +01:00
Aaron Gyes
197f93e784 ulimit.cpp: doesn't need to #include io.h 2021-11-09 17:51:58 -08:00
Aaron Gyes
eb990c07c8 Let's make src/ easier to grok, move builins to src/builtins
+ No functional change here, just renames and #include changes.
+ CMake can't have slashes in the target names. I'm suspciious of
  that weird machinery for test, but I made it work.
+ A couple of builtins did not include their own headers, that
  is no longer the case.
2021-11-09 17:39:10 -08:00
Fabian Homborg
4cad079aeb Le Changuelogue 2021-11-08 22:56:42 +01:00
Fabian Homborg
66566c1650 ast: Stop dropping down to wchar_t needlessly
Very slight performance increase (1% when parsing *all .fish scripts
in fish-shell*), but this removes a useless variable and some
.c_str()inging.

Theoretically it should also remove some wcslen() calls, but those
seem to be optimized out?
2021-11-08 21:24:00 +01:00