Commit Graph

5336 Commits

Author SHA1 Message Date
ccoVeille
b6a1bedab9 Fix typos in comments 2025-01-26 20:30:48 -08:00
Fabian Boehm
2b2f824b94 completions/git: Handle huge repositories for "add" better
`git add` may have to go through literal megabytes of file information
because of tons of untracked files.

So, if the repository is set to not show untracked files (because it's
too slow for the prompt), let's fall back on regular file completions.

(the alternative is to go back to `while read`, but that takes much
longer in repositories of a sensible size)

Fixes #11095
2025-01-26 21:41:36 +01:00
Johannes Altmanninger
95d61ea0fb Split /etc/{,man}path by colons too
I don't know how /etc/manpath ends up containing lines like
"path1:path2".  But path_helper splits them so we should do too.

4ea11424b8/path_helper/path_helper.c (L149)

Fixes #10684
2025-01-26 14:19:40 +01:00
Mahmoud Al-Qudsi
d69a9296a6 completions/llm: Complete model alias target 2025-01-25 12:50:03 -06:00
Fabian Boehm
4e13ce33c5 functions/__fish_cancel_commandline: Follow rename of bind function
See #10935
2025-01-22 17:43:59 +01:00
David Adam
945a535570 fish_default_key_bindings: remove duplicate ctrl-k binding
It's in the shared bindings since f9b7992.
2025-01-20 19:48:57 +08:00
Johannes Altmanninger
8208a12a76 Back out "Support help argument in "{ -h""
This backs out commit efce176ceb.
2025-01-19 18:57:21 +01:00
Johannes Altmanninger
92bd366c1b Back out "Allow if/then/fi, while/do/done and for/do/done"
This backs out commit e32572e4e6.
2025-01-19 18:57:13 +01:00
Fabian Boehm
98a96f5b58 Revert "Swap alt-{left,right,backspace,delete} with ctrl-* on macOS"
This reverts commit ebdc3a0393.

Not discussed, includes a new thing that queries the terminal for the client OS
when what is really needed is just a `uname` - which would also work on Terminal.app.
2025-01-19 18:52:10 +01:00
Fabian Boehm
494bdfa013 Revert accidentally pushed fork
Revert "README for this fork"

This reverts commit 97db461e7f.

Revert "Allow foo=bar global variable assignments"

This reverts commit 45a2017580.

Revert "Interpret () in command position as subshell"

This reverts commit 0199583435.

Revert "Allow special variables $?,$$,$@,$#"

This reverts commit 4a71ee1288.

Revert "Allow $() in command position"

This reverts commit 4b99fe2288.

Revert "Turn off full LTO"

This reverts commit b1213f1385.

Revert "Back out "bind: Remove "c-" and "a-" shortcut notation""

This reverts commit f43abc42f9.

Revert "Un-hide documentation of non-fish shell builtins"

This reverts commit 485201ba2e.
2025-01-19 18:34:59 +01:00
Johannes Altmanninger
485201ba2e Un-hide documentation of non-fish shell builtins
This makes "man exec" show the documentation from Linux man-pages.
2025-01-19 18:29:07 +01:00
Johannes Altmanninger
e32572e4e6 Allow if/then/fi, while/do/done and for/do/done 2025-01-19 18:29:07 +01:00
Johannes Altmanninger
ebdc3a0393 Swap alt-{left,right,backspace,delete} with ctrl-* on macOS
See https://github.com/fish-shell/fish-shell/issues/ 10926
2025-01-19 18:29:07 +01:00
Johannes Altmanninger
efce176ceb Support help argument in "{ -h"
Unlike other builtins, "{" is a separate token, not a keyword-string
token.

Allow the left brace token as command string; produce it when parsing
"{ -h"/"{ --help" (and nowhere else).  By using a decorated statement,
we reuse logic for redirections etc.

Other syntax elements like "and" are in the builtin list, which
- adds highlighting logic
- adds it to "builtin --names"
- makes it runnable as builtin
  (e.g. "builtin '{'" would hypothetically print the man page)

These don't seem very important (highlighting for '{' needs to match
'}' anyway).

Additionally, making it a real builtin would mean that we'd need to
deactivate a few places that unescape "{" to BRACE_BEGIN.

Let's not add it to the built in list. Instead, simply synthesize
builtin_generic in the right spot.

I'm assuming we want "{ -h" to print help, but '"{" -h' to run an
external command, since the latter is historical behavior.  This works
naturally with the above fake builtin approach which never tries to
unescape the left brace.
2025-01-19 18:29:07 +01:00
Johannes Altmanninger
6b5ad163d3 Fix double expansion of tokenized command line
Commit 798527d79a (completions: fix double evaluation of tokenized
commandline, 2024-01-06) fixed some completions such as the "watchexec"
ones by adding "string escape" here:

	set argv (commandline -opc | string escape) (commandline -ct)

This fixed double evaluation when we later call `complete -C"$argv"`.

Unfortunately -- searching for "complete -C" and
"__fish_complete_subcommand" -- it seems like that commit missed some
completions such as sudo.  Fix them the same way.

Alternatively, we could defer expansion of those arguments (via
--tokens-raw), since the recursive call to completion will expand
them anyway, and we don't really need to know their value.

But there are (contrived) examples where we do want to expand first,
to correctly figure out where the subcommand starts:

	sudo {-u,someuser} make ins

By definition, the tokens returned by `commandline -opc` do not
contain the token at cursor (which we're currently completing).
So the expansion should not hurt us. There is an edge case where
cartesian product expansion would produce too many results, and we
pass on the unexpanded input. In that case the extra escaping is very
unlikely to have negative effects.

Fixes # 11041
Closes # 11067

Co-authored-by: kerty <g.kabakov@inbox.ru>
2025-01-19 18:29:07 +01:00
Johannes Altmanninger
7ad47c34e8 Fix regression causing scrollback-push to not clear text below cursor
If a child program crashes with some text rendered below the cursor,
we fail to clear that text. For example run vim, "pkill -9 vim" and
observe that scrollback-push fails to clean up the leftover text.
Fix that.
2025-01-19 18:29:07 +01:00
Ilya Grigoriev
a328fd995b Clarify __fish_complete_subcommand comment 2025-01-19 10:49:07 +01:00
Ilya Grigoriev
bcc69da569 tmux completions: complete shell commands 2025-01-19 10:49:07 +01:00
Dmitry Gerasimov
dfa77e6c19 completions/git: show custom aliases for --pretty option
Custom formats for --pretty/--format option can only be written in [pretty]
section, thus only this section is searched.

[ja: add ? to the regex]

Closes #11065
2025-01-19 10:48:01 +01:00
Dmitry Gerasimov
9752b83e65 completions/git: update supported git format options
--format=reference is supported since git 2.25
--format=mboxrd is supported since git 2.27
2025-01-19 10:48:01 +01:00
Ilya Grigoriev
4208798585 completions: add unbuffer completions
unbuffer is sometimes bundled with `expect` (which fish already ships
completions for), and sometimes is bundled separately. It's often
recommended for forcing colors to have color output.

https://manpages.debian.org/bookworm/expect/unbuffer.1.en.html

Ads for unbuffer:

https://wiki.archlinux.org/title/Color_output_in_console#Reading_from_stdin
https://jvns.ca/blog/2024/10/01/terminal-colours/
2025-01-19 10:46:55 +01:00
Johannes Altmanninger
6d18f57e96 Make ! a builtin too, fixing "! -h"
UnLike other aliases (":.["), ! is special in the grammar but in the
few cases like "! -h" where we parse it as decorated statement they
are equals. Add it to the built in list, so the help argument works.

It can still be overridden, so this should not break anything.
2025-01-15 10:54:18 +01:00
Johannes Altmanninger
c4b4e90031 Fix file completions for builtin fish_indent 2025-01-15 10:52:43 +01:00
Johannes Altmanninger
c12f853db2 Reformat share/{completions,functions} 2025-01-15 10:50:04 +01:00
Fabian Boehm
28233b0711 Make new ctrl-c behavior "clear-commandline"
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
And leave the old behavior under the name "cancel-commandline".

This renames "cancel-commandline-traditional" back to
"cancel-commandline", so the old name triggers the old behavior.

Fixes #10935
2025-01-14 20:01:56 +01:00
Fabian Boehm
723943fd1f fish_jj_prompt: Return false if nothing was generated
That means we go on to try git etc
2025-01-13 14:54:00 +01:00
Johannes Altmanninger
b46417c77b Fix broken completions for "mount -ouid="
Regressed in 2e55e34544 (Reformat, 2020-11-22).
2025-01-13 09:47:34 +01:00
Johannes Altmanninger
0f4e195819 fish_jj_prompt: remove change ID
This is not really helpful because it's somewhat transient; also we
can usually use the @ alias.
2025-01-13 09:47:34 +01:00
Johannes Altmanninger
7c539b9539 Rename the readline function for deleting active history item
history-pager-delete now also works for regular history search,
so rename it.
2025-01-11 18:58:49 +01:00
Mahmoud Al-Qudsi
f8b245eb31 completions/zfs: Add encryption-related completions
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
2025-01-11 10:44:40 -06:00
Johannes Altmanninger
4a6d8d0b3a Allow alt-enter and friends to insert into search field
Since this is user-visible, copy the logic rather than extracting
a function.
2025-01-11 13:50:08 +01:00
Daniel Fleischer
29c45100fa
Add lazygit completions (#11019)
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
2025-01-10 21:21:54 -06:00
Mahmoud Al-Qudsi
0fcb2f7590 completions/cargo: Add --ignore-rust-version
New to 1.85; bypasses MSRV checks specified by `resolver = 3` or in
.cargo/config.toml
2025-01-09 17:06:31 -06:00
Klaus Hipp
5c25d3c3b1 Fix completion typos 2025-01-09 16:51:39 +01:00
phanium
ef7aa793c6 Fix missing of builtin token description 2025-01-09 16:49:41 +01:00
César Sagaert
00c7baf68c
DNF5 completion support (#11035)
* dnf5 completions

* address comments
2025-01-09 16:35:46 +01:00
Branch Vincent
7970ca55af
completions: add fish-lsp (#11017) 2025-01-08 11:25:36 -06:00
Klaus Hipp
4def0ac616
Revert "Fix typo in npm completions: isntall -> install" (#11014)
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
* Revert "Fix typo in npm completions: isntall -> install"

This reverts commit f4b01bb638.

* Add comments about typos in `npm` completions
2025-01-07 12:32:16 -06:00
Steve Walker
b574a5e4f6 fix python completion #10943 2025-01-07 23:30:27 +08:00
Klaus Hipp
ea4e4a4279
Fix completion typos for apt-build, htop and wget (#11016) 2025-01-06 19:39:47 -06:00
Johannes Altmanninger
704b911168 Back out "Bind ctrl-l to clear-screen again for now"
As of the parent commits this should no longer cause breakage.

This backs out commit 07dd088d76.
2025-01-06 06:24:13 +01:00
Johannes Altmanninger
109ef88831 Add menu and printscreen keys
These aren't typically used in the terminal but they are present on
many keyboards.

Also reorganize the named key constants a bit.  Between F500 and
ENCODE_DIRECT_BASE (F600) we have space for 256 named keys.
2025-01-06 05:43:22 +01:00
Lzu Tao
f9b79926f1 Add more convenient key bindings for VI mode
Some checks failed
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
Lock threads / lock (push) Has been cancelled
To make it more familiar to vi/vim users.

In all mode, ctrl-k is bind to kill-line.

In Vi visual mode:
* press v or i turn into normal or insert mode respectively.
* press I turn to insert mode and move the cursor to beginning of line.
* because fish doesn't have upcase/locase-selection, and most people reach for
  g-U rather than g-u, g-U binds to togglecase-selection temporarily.
2025-01-05 23:00:21 +08:00
Johannes Altmanninger
07dd088d76 Bind ctrl-l to clear-screen again for now
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
Testing has revealed some problems on BSD and Windows terminals and
the Linux Console, let's revert to the old implementation until these
are fixed.  Leaving the changelog entry for now since it shouldn't
take long.

See #11003
2025-01-05 08:20:53 +01:00
cornmander
d842a6560e
Add completions for Google Cloud commands. (#11005)
The `gcloud` and `gsutil` Google Cloud commands use argcomplete, so integrating them is easy with the `__fish_argcomplete_complete` function.
2025-01-04 19:45:05 -06:00
Lzu Tao
7eb254f2ba Add completion for gem-fetch
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
2025-01-04 21:26:03 +08:00
idealseal
2e12a2b6c4 feat(comp): Update completions for resolvectl 2025-01-04 20:42:31 +08:00
idealseal
a780e4da15 feat(comp): Update completion for md5sum 2025-01-04 20:39:33 +08:00
Thayne McCombs
33dd823f45 fix[completions]: Add set-timeout to bootctl 2025-01-04 20:15:53 +08:00
Johannes Altmanninger
870a8f77a0 completions/scp: replace version detection
Version detection seems unreliable (see
https://github.com/fish-shell/fish-shell/issues/10445#issuecomment-2566232705
) so let's test for the actual feature.  On modern versions,"scp -O"
means "Use  the legacy SCP protocol for file transfers instead",
so presence of this feature indicates we are good.
2025-01-03 12:57:00 +01:00