Commit graph

1951 commits

Author SHA1 Message Date
Giorgio Gallo
677e53f06a fix documentation for path normalize 2024-10-27 08:32:05 +00:00
Johannes Altmanninger
d9633f2b38 Remove stale docs about fish_vi_force_cursor
Remove in 983746a69 (fish_vi_cursor: Remove terminal checks, 2024-08-30).
2024-10-21 21:53:32 +02:00
Johannes Altmanninger
f4ff312265 Fix typo in docs 2024-10-19 22:04:54 +02:00
Johannes Altmanninger
6af96a81a8 Default bindings for token movement commands
There is no natural default binding for token movements. Add the
alt-{left,right,backspace,delete}, breaking some existing behavior.

For example, backward-delete-word is no longer bound to alt-backspace but
only to ctrl-backspace.  Unfortunately some terminals (particularly tmux)
don't support distinguishing ctrl-backspace from ctrl-h yet, so the loss
of alt-backspace may be tragic.

---

I guess we could also add:

    bind alt-B backward-token
    bind alt-F forward-token
    bind ctrl-W backward-kill-token
    bind alt-D kill-token

Those might be intercepted by the terminal on Linux, but I don't know where
that happens.

Tested on foot, kitty, alacritty, xterm, tmux, konsole and gnome-terminal.

Closes #10766
2024-10-13 14:53:45 +02:00
diniamo
052e764f29 accept-autosuggestion to return false if there was no autosuggestion to accept
Example usage:

    bind ctrl-space accept-autosuggestion and execute

Closes #10608
2024-10-05 23:43:16 +02:00
Jacob Chapman
a9cee9e755 Commands to move by entire tokens
ja: I'll try to add default bindings in a follow-up PR.

Closes #10738
Closes #2014
2024-10-05 22:43:39 +02:00
Johannes Altmanninger
d829a99977 Fix kbd tag HTML rendering
Commit c921c124e (docs: use canonical key names in :kbd: tags, 2024-04-13)
removed the box highlighting from elements like :kbd:`ctrl-c`.
This is because Sphinx for some reason converts this into

    <kbd>
        <kbd>ctrl</kbd>
        -
        <kbd>c</kbd>
    </kbd>

which results in duplicate boxes.
(See https://github.com/sphinx-doc/sphinx/issues/7530)

Our current style looks a bit ugly (it's
definitely worse than github's rendering at
https://github.com/fish-shell/fish-shell/blob/master/CHANGELOG.rst).
Let's restore the old style but make sure to only apply it only to the
outermost kbd element.

While at it, use the same monospace font as for inline code.
2024-09-28 18:00:02 +02:00
Johannes Altmanninger
2e9de57fd7 Document ctrl-backspace and bind ctrl-delete as well
This has a slightly different behavior than what the CUA user expects:
it fails to eat up trailing spaces.  We should probably fix this.
2024-09-23 14:52:50 +02:00
Fabian Boehm
fc7be1c2a3 Minor doc fixes 2024-09-18 22:11:14 +02:00
Fabian Boehm
9fafae7a8a docs/complete: Explain -r a bit better 2024-09-15 09:44:09 +02:00
Fabian Boehm
8092af9c45 docs/prompt: Add funcsave/funced 2024-09-15 09:39:13 +02:00
Fabian Boehm
f9635b1a04 docs/argparse: Explain dashes in flag names 2024-09-15 09:39:09 +02:00
mattmc3
0a1bf01574 docs: Update synopsis for 'set' 2024-09-14 10:29:44 +02:00
Harmen
fc4dd8f4de docs: fix "theme choose None" command
The command needs an upper-case "None", not a lower case.
2024-09-13 12:21:34 +02:00
Fabian Boehm
325b51aca0 docs/set: Fix markup
Fixes #10697
2024-09-05 19:30:38 +02:00
Fabian Boehm
835f907cd4 docs: Remove broken indents in license
Lots of "WARNING: Block quote ends without a blank line; unexpected
unindent." from sphinx.
2024-08-15 17:48:48 +02:00
Fabian Boehm
da8fe7e845 docs: Point to functions/type from funced/funcsave
Fixes #10609
2024-08-13 17:44:23 +02:00
Fabian Boehm
1f7fdd5d88 Add back docs for fish_key_reader --verbose 2024-08-11 14:57:04 +02:00
David Adam
8d8a036e20 add some reminders about the many places copyright information is kept 2024-08-04 21:11:21 +08:00
Fabian Boehm
56a4ae17c9 docs: Make output not selectable
We already do this for the prompt
2024-08-03 16:26:34 +02:00
David Adam
8b028c37e5 Bring licensing information up to date and synchronise across files 2024-08-03 00:14:48 +08:00
Johannes Altmanninger
82639d274e string-replace.rst: fix trailing whitespace 2024-07-23 11:47:58 +02:00
Mahmoud Al-Qudsi
b93e52079b Document commandine --showing-suggestion 2024-07-07 22:34:36 -05:00
Henrik Hørlück Berg
75da00df94
Fix short/long delimiter in string {match,replace}
- We use `()` not `[]`, as can be seen in e.g. `string split`
2024-07-06 16:18:14 +02:00
Mahmoud Al-Qudsi
f975e1c9e5 Document string match/replace --max-matches 2024-06-30 17:51:50 -05:00
Nikita Bobko
67e190876a
Implement jump-till-matching-bracket input function
Part of #1842

It's like jump-to-matching-bracket, but jumps right before the bracket

I will use it to mimic vi 'ab' and 'ib' text objects in the next commit

Given complicated semantics of jump-till-matching-bracket, an alternative name
could be 'jump-inside-matching-brackets'. But that would make names non-symmetrical.
I'm not sure what is worse.
2024-06-30 11:58:10 -07:00
Nikita Bobko
f8ebe346a9
Implement jump-to-matching-bracket motion and bind % (percent) in vi mode
Part of #1842
2024-06-30 11:58:10 -07:00
Looouiiis
480d48351c feat(math): add round options (#9117)
Add round options, but I think can also add floor, ceiling, etc. And
the default mode is trunc.

Closes #9117

Co-authored-by: Mahmoud Al-Qudsi <mqudsi@neosmart.net>
2024-06-23 17:45:52 -05:00
Fabian Boehm
d917b89009 docs: Fix two links 2024-06-22 14:58:07 +02:00
Florian Meißner
14fd7bd9af
Explain function --argument-names in more detail. (#10524) 2024-06-19 22:51:47 -05:00
Peter Ammon
4d300b7f32
Correct fish_default_key_bindings docs
These referred to vi key bindings, not emacs.

Credit to chapeupreto for spotting this in #10569.
2024-06-15 12:18:37 -07:00
Trishank Karthik Kuppusamy
261274ea26
docs/tutorial: Add a note about universal variables (#10548)
Link to some best practices for universal variables.
2024-06-13 18:28:22 +02:00
Fabian Boehm
6706b15fbc fish_add_path: Automatically enable verbose mode for interactive use
fish_add_path can be used either interactively, in the commandline,
or in config.fish. That's its greatest strength, it's a very
DWIM-style command.

One of the compromises that entails, however, is that it can't really
be very loud about what it does. If it skips a path, it can't write a
warning because it might be used in config.fish.

But it *can* if it's used interactively. So we try to detect that case
and enable verbose mode automatically.

That means if you do

```fish
fish_add_path /opt/mytool/bin/mytool
```

it may tell you "Skipping path because it is a file instead of a
directory:".

The check isn't perfect, it goes through status current-command and
isatty, but it should be good for most cases (and be false in config.fish).
2024-06-06 16:47:39 +02:00
Fabian Boehm
0a8fd05bb0 docs/fish_add_path: Reword description
Use "directories" explicitly instead of "components" to make it more
clear that the arguments need to be directories, not files.

Also a bit on intent and variable scope.
2024-05-30 22:52:03 +02:00
Fabian Boehm
f06143c11a docs: Fix some formatting 2024-05-27 23:21:06 +02:00
Mahmoud Al-Qudsi
6091d1149f Document path basename -E 2024-05-26 22:06:11 -05:00
ridiculousfish
94f13a50f5 Add musl libc to our license.rst
The new printf is derived from musl libc. Add it to license.rst to reflect our
usage.
2024-05-26 16:07:27 -04:00
Johannes Altmanninger
de7f39d627 builtin bind: make function keys lowercase (f1 instead of F1)
All other key names are lowercase so this inconsistency is weird.
2024-05-22 22:38:06 +02:00
Fabian Boehm
fc5eb0a98a fish_for_bash_users: Put explanation on subshells first
and *then* explain things that aren't subshells.
2024-05-15 22:44:07 +02:00
Fabian Boehm
b6bebec513 docs: Simplify Combining Lists section
This was a bit dense.
2024-05-15 20:18:17 +02:00
Fabian Boehm
f1e19884fb Add set --no-event
This allows running `set` without triggering any event handlers.

That is useful, for example, if you want to set a variable in an event
handler for that variable - we could do it, for example, in the
fish_user_path or fish_key_bindings handlers.

This is something the `block` builtin was supposed to be for, but it
never really worked because it only allows suppressing the event for
the duration, they would fire later. See #9030.

Because it is possible to abuse this, we only have a long-option so
that people see what is up.
2024-05-14 17:31:47 +02:00
Fabian Boehm
e32efc0581 docs: Some rewording on completions 2024-05-10 17:40:18 +02:00
Fabian Boehm
55235a27d3 docs/abbr: Add --command to add subcommand synopsis 2024-04-28 11:33:27 +02:00
Anurag Singh
62a8b48fd1 Move generated completions to cache directory 2024-04-27 10:39:30 +02:00
Johannes Altmanninger
758b8e7126 commandline.rst: fix typo 2024-04-26 11:16:30 +02:00
Fabian Boehm
69583f3030
Allow restricting abbreviations to specific commands (#10452)
This allows making something like

```fish
abbr --add gc --position anywhere --command git back 'reset --hard
HEAD^'
```

to expand "gc" to "reset --hard HEAD^", but only if the command is
git (including "command git gc" or "and git gc").

Fixes #9411
2024-04-24 18:09:04 +02:00
Giorgio Gallo
8a1eae4640 Clarify block command documentation 2024-04-23 19:36:11 +02:00
Fabian Boehm
20243132fb Add <? input redirection
This tries to open the given file to use as stdin, and if it fails,
for any reason, it uses /dev/null instead.

This is useful in cases where we would otherwise do either of these:

```fish
test -r /path/to/file
and string match foo < /path/to/file

cat /path/to/file 2>/dev/null | string match foo
```

This both makes it nicer and shorter, *and* helps with TOCTTOU - what if the file is removed/changed after the check?

The reason for reading /dev/null instead of a closed fd is that a closed fd will often cause an error.

In case opening /dev/null fails, it still skips the command.
That's really a last resort for when the operating system
has turned out to be a platypus and not a unix.

Fixes #4865

(cherry picked from commit df8b9b7095)
2024-04-21 14:35:13 +02:00
Fabian Boehm
2c17d34971
Deprecate builtin test's one- and zero-argument modes (#10365)
This introduces a feature flag, "test-require-arg", that removes builtin test's zero and one argument special modes.

That means:

- `test -n` returns false
- `test -z` returns true
- `test -x` with any other option errors out with "missing argument"
- `test foo` errors out as expecting an option

`test -n` returning true is a frequent source of confusion, and so we are breaking with posix in this regard.

As always the flag defaults to off and can be turned on. In future it will default to on and then eventually be made read-only.

There is a new FLOG category "deprecated-test", run `fish -d deprecated-test` and it will show any test call that would change in future.
2024-04-21 14:25:54 +02:00
Fabian Boehm
18a0b44f0f docs: More on new keys 2024-04-20 17:05:46 +02:00