Commit Graph

499 Commits

Author SHA1 Message Date
Johannes Altmanninger
f4ff312265 Fix typo in docs 2024-10-19 22:04:54 +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
Some checks are pending
make test / ubuntu (push) Waiting to run
make test / ubuntu-32bit-static-pcre2 (push) Waiting to run
make test / ubuntu-asan (push) Waiting to run
make test / macos (push) Waiting to run
Rust checks / rustfmt (push) Waiting to run
Rust checks / clippy (push) Waiting to run
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
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
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
Fabian Boehm
325b51aca0 docs/set: Fix markup
Fixes #10697
2024-09-05 19:30:38 +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
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
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
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
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
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
55235a27d3 docs/abbr: Add --command to add subcommand synopsis 2024-04-28 11:33:27 +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
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
Johannes Altmanninger
c921c124ef docs: use canonical key names in :kbd: tags
This seems a bit better because it's what bind uses.  To makes sure that
something like :kbd:`ctrl-x` looks good in HTML, remove the border from the
kbd style.  Else both "ctrl" and "x" get small boxes which looks weird.
2024-04-20 15:36:29 +02:00
Johannes Altmanninger
c9793711dc Remove stale mention of plus key name 2024-04-20 15:36:29 +02:00
Johannes Altmanninger
414d9a1eb1 Reference more non-fish shell builtins that have relevant differences
When writing scripts for other shells, it can be confusing and annoying
that our `man` function shadows other manual pages, for example `exec(1p)`
from [Linux man-pages]. I almost never want to see the fish variant for such
contended cases (which obviuosly don't include fish-specific commands like
`string`, only widely-known shell builtins).

For the contented cases like `exec`, the POSIX documentation is more
substantial and useful, since it describes a (sub)set of languages widely
used for scripting.

Because of this I think we should stop overriding the system's man pages.
Nowadays we offer `exec -h` as intuitive way to show the documentation for
the fish-specific command (note that `help` is not a good replacement because
it uses a web browser).

Looking through the contended commands, it seems like for most of them,
the fish version is not substantially different from the system version.
A notable exception is `read` but I don't think it's a very important one.

So I think we should can sacrifice a bit of the native fish-scripting
experience in exchange for playing nicer with other shells. I think the
latter is more important because scripting is not our focus, the way I see it.
So maybe put our manpath at the end.

In lieu of that, let's at least have `exec.rst` reference the system variant.

[Linux man-pages]: https://www.kernel.org/doc/man-pages/

Closes #10376
2024-04-20 13:34:08 +02:00
Johannes Altmanninger
dea13c86a9 Document the ! (not) and . (source) aliases more 2024-04-20 13:34:08 +02:00
Johannes Altmanninger
47a446ae18 Teach fish_indent to only indent and unindent
To be used in the following commits.
2024-04-15 08:32:31 +02:00
Anurag Singh
c044d5e3f0 add history append subcommand 2024-04-15 08:31:16 +02:00
Johannes Altmanninger
29b309dd5f shift-delete to delete current history search match
Popular operating systems support shift-delete to delete the selected item
in an autocompletion widgets.  We already support this in the history pager.
Let's do the same for up-arrow history search.

Related discussion: https://github.com/fish-shell/fish-shell/pull/9515
2024-04-13 20:23:51 +02:00
Johannes Altmanninger
9db53e8d26 Allow abbreviating ctrl-/alt- as c-/a-
This makes them more convenient to use interactively, similar to the existing
\c and \a versions.  The resulting bind output keeps using the canonical
ctrl/alt version.

Not sure about s- because that's somewhat ambiguous, it could be "super".
2024-04-12 11:27:55 +02:00
Johannes Altmanninger
8bf8b10f68 Extended & human-friendly keys
See the changelog additions for user-visible changes.

Since we enable/disable terminal protocols whenever we pass terminal ownership,
tests can no longer run in parallel on the same terminal.

For the same reason, readline shortcuts in the gdb REPL will not work anymore.
As a remedy, use gdbserver, or lobby for CSI u support in libreadline.

Add sleep to some tests, otherwise they fall (both in CI and locally).

There are two weird failures on FreeBSD remaining, disable them for now
https://github.com/fish-shell/fish-shell/pull/10359/checks?check_run_id=23330096362

Design and implementation borrows heavily from Kakoune.

In future, we should try to implement more of the kitty progressive
enhancements.

Closes #10359
2024-04-02 14:35:16 +02:00
Johannes Altmanninger
22717339b4 fish_clipboard_paste: don't bypass pager search field.
To do so add an ad-hoc "commandline --search-field" to operate on pager
search field.

This is primarily motivated because a following commit reuses the
fish_clipboard_paste logic for bracketed paste. This avoids a regression.
2024-04-02 14:35:16 +02:00
Mahmoud Al-Qudsi
8eb7a08035 Document backward-char-passive 2024-03-29 14:23:53 -05:00
Mahmoud Al-Qudsi
674c481d87 Add documentation for forward-char-passive 2024-03-28 00:18:24 -05:00
Johannes Altmanninger
c3cd68dda5 Process shell commands from bindings like regular char events
A long standing issue is that bindings cannot mix special input functions
and shell commands. For example,

    bind x end-of-line "commandline -i x"

silently does nothing. Instead we have to do lift everything to shell commands

    bind x "commandline -f end-of-line; commandline -i x"

for no good reason.

Additionally, there is a weird ordering difference between special input
functions and shell commands. Special input functions are pushed into the
the queue whereas shell commands are executed immediately.

This weird ordering means that the above "bind x" still doesn't work as
expected, because "commandline -i" is processed before "end-of-line".

Finally, this is all implemented via weird hack to allow recursive use of
a mutable reference to the reader state.

Fix all of this by processing shell commands the same as both special input
functions and regular chars. Hopefully this doesn't break anything.

Fixes #8186
Fixes #10360
Closes #9398
2024-03-23 10:06:11 +01:00
Johannes Altmanninger
299fcde808 Better link for POSIX test 2024-03-23 09:51:09 +01:00
Fabian Boehm
c759a98b37 docs: Clarify that disowned jobs won't fire on-process/job-exit
Fixes #10381
2024-03-19 16:39:37 +01:00
Fabian Boehm
6869b14fb5 docs: Add fish_should_add_to_history to commands list 2024-03-09 12:09:00 +01:00
Fabian Boehm
f7cc1743c6
Allow deciding if a command should be saved to history (#10302)
Call fish_should_add_to_history to see if a command should be saved

If it returns 0, it will be saved, if it returns anything else, it
will be ephemeral.

It gets the right-trimmed text as the argument.

If it doesn't exist, we do the historical behavior of checking for a
leading space.

That means you can now turn that off by defining a
`fish_should_add_to_history` that just doesn't check it.

documentation based on #9298
2024-03-09 12:04:16 +01:00
TAKAHASHI Shuuji
3c7b2af442 docs: Correct default value of read function in read.rst 2024-03-04 17:49:47 +01:00
Henrik Hørlück Berg
59fa7479ee
Add documentation and release notes for #10282 2024-02-11 12:43:13 +01:00