Commit graph

1650 commits

Author SHA1 Message Date
Fabian Boehm
dbeb667ff4 Document history pager 2022-09-08 22:50:00 +02:00
Johannes Altmanninger
a6ff72bd64 faq.rst: fix typo 2022-08-31 07:49:49 +02:00
Fabian Boehm
a42a651d0a Use color for $fish_color_valid_path if it exists
This otherwise threw away the color. Since that's just information
that is thrown away, let's just use it.

Fixes #9159.
2022-08-25 17:42:42 +02:00
Fabian Boehm
c753f22003 docs: Format path synopsis
This was written while we changed how our synopses are formatted, so
we missed adding a "synopsis" marker to it.

The tokenizer here is a bit cheesy, so we can't mark continuation
lines with a "\", and we also can't mark the general options with a
":=". Tbh that's not a big deal.

Fixes #9154
2022-08-25 13:06:57 +02:00
Fabian Boehm
7e75118956 Document math's lack of bitnot
Fixes #9148
2022-08-23 19:55:55 +02:00
Johannes Altmanninger
20a3599b10 faq.rst: correct explanation of Ctrl-R/Ctrl-S bindings in history pager 2022-08-13 21:11:54 +02:00
Fabian Boehm
18df41e5e6 Document ctrl-r harder, add something on set -x 2022-08-12 21:28:11 +02:00
pagedown
9c16677706 help: Handle the missing builtin aliases : and [ 2022-08-12 20:45:20 +02:00
Fabian Boehm
df7b97d99d Link to correct path subcommand
Resolve is indeed the same as resolve
2022-08-08 21:13:10 +02:00
Fabian Boehm
39fbc27d8d Clarify math documentation
The words "rounded down" here get us into some trouble.
2022-08-06 10:58:46 +02:00
SeekingBlues
f9786673e3 Fix typo for or input function 2022-08-05 18:32:32 +02:00
Fabian Boehm
177cfbc605 docs/path: Add some more on resolve/normalize dichotomy 2022-08-02 19:58:43 +02:00
Johannes Altmanninger
453aac14af Advance pager history search with Control-R/Control-S
Note that every change to the search field still starts a new search, from
the end of history. We could change this in future but it's unclear to me
what the expected behavior is. I don't find the traditional readline behavior
very intuitive.
2022-07-30 23:27:24 +02:00
Johannes Altmanninger
dcff0a2f2b Add Control+R incremental history search in pager
This reimplements ridiculousfish/control_r which is a more future-proof
approach than #6686.
Pressing Control+R shows history in our pager and allows to search filter
commands with the pager search field.

On the surface, this works just like in other shells; though there are
some differences.

- Our pager shows multiple results at a time.
- Other shells allow to use up arrow/down arrow to select adjacent entries
  in history. Shouldn't be hard to implement but the hidden state might
  confuse users and it doesn't play well with up-or-search, so this is
  left out.

Users might expect the history pager to use subsequence matching (fuzzy
matching) like the completion pager, however due to the history pager design it
uses substring matching.  We could change this in future, however that means
we would also want to change the ordering from "reverse-chronological" to
"longest common subsequence" (e.g. what fuzzy finders do), because otherwise
a query "fis" might give this ordering:

            fsck /dev/disk/by-partlabel/Linux\x20filesystem
            fish

which is probably not what the user wants.

The pager shows only a small number of history items at a time.  This is
because, as explained above, the history pager does not support subsequence
matching, so navigating it does not scale well.

Closes #602
2022-07-30 23:27:24 +02:00
Michael Forster
91c68ec1af Add fish_cursor_selection_mode documentation 2022-07-30 09:49:23 -07:00
David Adam
4bad88f0df update Vi key binding documentation to reflect reality
PR #6777 changed all the keys to uppercase, but many Vi commands are case
sensitive.

PR #7908 changed the "u" binding but the documentation still had the old
meaning.
2022-07-21 22:57:37 +08:00
Fabian Boehm
547a4b2baf docs: Link some more to $PATH 2022-07-18 20:53:37 +02:00
Fabian Boehm
603a8e31e3 docs: Link fish_greeting function from FAQ
And explain the variable more in fish_greeting.

Closes #9056
2022-07-18 20:52:16 +02:00
Fabian Boehm
5dfb64b547
Add path mtime (#9057)
This can be used to print the modification time, like `stat` with some
options.

The reason is that `stat` has caused us a number of portability
headaches:

1. It's not available everywhere by default
2. The versions are quite different

For instance, with GNU stat it's `stat -c '%Y'`, with macOS it's `stat
-f %m`.

So now checking a cache file can be done just with builtins.
2022-07-18 20:39:01 +02:00
Aaron Gyes
92eb6024ed Document the three new [ operators
Explain test(1)'s -ef, -nt, -ot features.
2022-07-16 12:40:36 -07:00
Fabian Boehm
98ba66ed8e set_color: Print the given colors with --print-colors 2022-07-01 21:28:35 +02:00
Fabian Boehm
0a73b182c0 bind: Document --silent
See #9045
2022-07-01 20:46:52 +02:00
Fabian Boehm
993448d552 argparse: Allow usage without optspecs
It's still useful without, for instance to implement a command that
takes no options, or to check min-args or max-args.

(technically no optspecs, no min/max args and --ignore-unknown does
nothing, but that's a very specific error that we don't need to forbid)

Fixes #9006
2022-06-27 17:02:20 +02:00
ridiculousfish
53a2484fd1 Warn the user when visiting old documentation
This enhances our documentation to look for the file
/release_version.json in the root of our site. If found, and if it
contains a RELEASE_VERSION other than this version, then unhide a banner
warning about the stale documentation and linking to the current.
2022-06-20 17:56:14 -07:00
Fabian Boehm
1819c7f2b8 docs: Add more specific guidance on locale variables 2022-06-17 22:08:00 +02:00
Fabian Boehm
4f0c0486a6 Fix copy-pasteo in fish_config docs 2022-06-17 09:23:38 +02:00
Fabian Boehm
88b445ce9e Put short footnotes on one line again
Unlike before, this doesn't force the number to be on the same line as
strongly, that's fine.

So short footnotes look like

-------------
[1] Some text
-------------

Longer footnotes may look like

--------------
[2]

Some more text
--------------
2022-06-16 19:14:45 +02:00
Fabian Boehm
70a1febd6d Readd some missed changes
The "Warning:" on the warning (in index.html#default shell) wasn't in
the line with the text, the features list had more padding and some
headers were smaller, some table stuff
2022-06-16 19:14:45 +02:00
Fabian Boehm
e5a1da8b22 Remove unneeded guff 2022-06-16 19:14:45 +02:00
Fabian Boehm
6d8b88fb1d doc theme: Simplify
Move related stuff together and remove some unneeded guff

Specifically the weird "clear:" stuff causes rendering issues for me
in Firefox.
2022-06-16 19:14:45 +02:00
Fabian Homborg
618b0d0add Make doc css not depend on sphinx' css
This has required workarounds a few times, plus if it changes it might
break our theme. See e.g.

4712da3eb1
e27456df24
a6d484836e
85522036f5

So we import the rules we *use* and throw away the rest. Note that
this might still have rules that are no longer necessary - e.g. some
that are required to work around sphinx bugs would still be left.

It could benefit from some cleanup and simplification, and from
switching to a flex layout instead of the 230px hardcoded
sidebar - sphinx tried that, but it doesn't really work with our
narrow layout, so we disabled it again.
2022-06-16 19:14:45 +02:00
Fabian Boehm
8f08fe80fd Restyle codebase
Not a lot of changes, tbh
2022-06-16 18:43:28 +02:00
Fabian Boehm
18433278ec Document that status fish-path is platform-specific 2022-06-16 16:39:09 +02:00
David Adam
0431f21bb2 docs: list reserved keywords 2022-06-16 19:45:55 +10:00
Fabian Homborg
3552a11afa fish_git_prompt: Print cleanstate character whenever it's defined
And then only define it in informative mode.
2022-06-08 21:23:43 +02:00
Fabian Homborg
ca9910edb7 fish_git_prompt: Add colors for dirty/staged branches
This is a neat feature of the terlar git prompt
2022-06-08 21:23:43 +02:00
Fabian Homborg
f9a170e5f2 git_prompt: Only show untracked files in informative mode if asked
This makes it so

1. The informative status can work without showing untracked
files (previously it was disabled if bash.showUntrackedFiles was
false)
2. If untrackedfiles isn't explicitly enabled, we use -uno, so git
doesn't have to scan all the files.

In a large repository (like the FreeBSD ports repo), this can improve
performance by a factor of 5 or up.
2022-06-07 13:30:03 +02:00
Fabian Homborg
78ffb50d1f docs: Fix typo 2022-06-07 13:28:11 +02:00
SeekingBlues
cf620c829b Improve newline behavior of kill-whole-line
Previously, `kill-whole-line` kills the line and its following
newline. This is insufficient when we are on the last line, because
it would not actually clear the line. The cursor would stay on the
line, which is not the correct behavior for bindings like `dd`.

Also, `cc` in vi-mode used `kill-whole-line`, which is not correct
because it should not remove any newlines. We have to introduce
another special input function (`kill-inner-line`) to fix this.
2022-06-04 13:45:25 -07:00
Fabian Homborg
82445e3e6d docs: Add colored border to inline code
Makes it stand out just a teensy bit more. It's the same border we use
for code *blocks*
2022-06-01 20:58:27 +02:00
Fabian Homborg
f5848135e3 docs: Yeah nah undo flex
This is broken in narrow screens - the sidebar shrinks to unusable
proportions but still stays.

So instead we go the *other* way, force the left margin and undo the flexifying.

(again we should really stop relying on sphinx' css)
2022-06-01 20:54:02 +02:00
Fabian Homborg
b487f8b662 docs: Darker border color for dark mode code blocks 2022-06-01 20:44:53 +02:00
Fabian Homborg
4712da3eb1 docs theme: Make work with sphinx 4.5 and 5.0
Sphinx 5.0 makes the document div a flex container, which clashes
badly with the margin that earlier versions need.

So we remove the margin and flex the div ourselves, which should work
with either.

It's time we make this freestanding - these changes are annoying.
2022-06-01 17:48:51 +02:00
Fabian Homborg
10fb5f2d37 fish_for_bash_users: Some more on variables 2022-06-01 17:35:55 +02:00
Fabian Homborg
6d93f89e03 docs theme: Make inline code stand out more 2022-06-01 17:35:42 +02:00
Fabian Homborg
64b34c8cda Allow complete to have multiple conditions
This makes it so `complete -c foo -n test1 -n test2` registers *both*
conditions, and when it comes time to check the candidate, tries both,
in that order. If any fails it stops, if all succeed the completion is offered.

The reason for this is that it helps with caching - we have a
condition cache, but conditions like

```fish
test (count (commandline -opc)) -ge 2; and contains -- (commandline -opc)[2] length

test (count (commandline -opc)) -ge 2; and contains -- (commandline -opc)[2] sub
```

defeats it pretty easily, because the cache only looks at the entire
script as a string - it can't tell that the first `test` is the same
in both.

So this means we separate it into

```fish
complete -f -c string -n "test (count (commandline -opc)) -ge 2; and contains -- (commandline -opc)[2] length" -s V -l visible -d "Use the visible width, excluding escape sequences"
+complete -f -c string -n "test (count (commandline -opc)) -ge 2" -n "contains -- (commandline -opc)[2] length" -s V -l visible -d "Use the visible width, excluding escape sequences"
```

which allows the `test` to be cached.

In tests, this improves performance for the string completions by 30%
by reducing all the redundant `test` calls.

The `git` completions can also greatly benefit from this.
2022-05-30 20:47:14 +02:00
Fabian Boehm
4612343d6e
Merge pull request #8958 from faho/builtin-path
This adds a path builtin to deal with paths.

It offers the following subcommands:

    filter to go through a list of paths and only print the ones that pass some filter - exist, are a directory, have read permission, ...
    is as a shortcut for filter -q to only return true if one of the paths passed the filter
    basename, dirname and extension to print certain parts of the path
    change-extension to change the extension to a different one (as a string operation)
    normalize and resolve to canonicalize the paths in various flavors
    sort to sort paths, also only using the basename or dirname as a key

The definition of "extension" here was carefully considered and should line up with how extensions are actually used - ~/.bashrc doesn't have an extension, but ~/.conf.d does (".d").

These subcommands all compose well - they can read from arguments or stdin (like string), they can use null-delimited input or output (input is autodetected - if a NULL happens in the first PATH_MAX bytes it switches automatically).

It is both a failglob exception (so like set if a glob passed to it fails it just doesn't get any arguments for it instead of triggering an error), and passes output to command substitution buffers explicitly split (like string split0) so newlines are easy to handle.
2022-05-29 20:15:03 +02:00
Fabian Homborg
67b0860fe7 Rename sort --invert to sort --reverse/-r
To match sort(1).
2022-05-29 17:53:03 +02:00
Fabian Homborg
c87d063211 Update docs 2022-05-29 17:48:40 +02:00
Fabian Homborg
00949fccda Rename --what to --key
More sorty, less generic.
2022-05-29 17:48:40 +02:00