5360 Commits

Author SHA1 Message Date
Łukasz Wieczorek
82750bbaec Reformat with black. 2025-02-12 22:59:27 +08:00
idealseal
7accf4ffa1 feat(comp): update to systemd 257 2025-02-11 22:52:42 +08:00
David Adam
2849cd11ae completions/elm: remove = in long options
elm's argument parser copes just fine without them

Review comment from
https://github.com/fish-shell/fish-shell/pull/10759#discussion_r1786918645
2025-02-11 22:27:53 +08:00
Kemel Zaidan
df6bd36e82 adds completion for the default Elm cli tool 2025-02-11 22:21:18 +08:00
Roland Fredenhagen
d862e7bf26 Complete entries for bootctl
Uses `jq` to parse and doesn't add these extra completions if not available.
2025-02-10 22:15:57 -08:00
Johannes Altmanninger
f4503af037 Make alt-{b,f} move in directory history if commandline is empty
alt-{left,right} move in the directory history (like in browsers).
Arrow keys can be inconvenient to reach on some keyboards, so
let's alias this to alt-{b,f}, which already have similar behavior.
(historically the behavior was the same; we're considering changing
that back on some platforms).

This happens to fix alt-{left,right} in Terminal.app (where we had
a workaround for some cases), Ghostty, though that alone should not
be the reason for this change.

Closes #11105
2025-02-06 19:12:00 +01:00
phanium
1d827d1d2d Fix twice tokenize editor_cmd
```fish
export VISUAL='nvim --cmd let\ g:flatten_wait=1'
funced -s fish_prompt
```

`editor_cmd[3]` would be `let` rather than `let g:flatten_wait=1`
2025-02-02 16:20:12 -08:00
Peter Ammon
7c32cb1b44
Put back noun form of "licence" in mksquashfs comment 2025-02-02 11:48:37 -08:00
ccoVeille
0df6fa7915 Fix typos in completions scripts 2025-02-02 17:15:11 +08:00
Ilya Grigoriev
5dd6759d01
completions/tmux: replace embedded tabs with \t 2025-02-01 17:37:38 -08:00
Ilya Grigoriev
2b6f6b8cbc
completions/tmux: basic window argument completions 2025-02-01 17:37:38 -08:00
Ilya Grigoriev
5d0e2244bb
completions/tmux: add ability to complete buffer names and commands
This adds the ability to complete (and therefore preview) buffer names,
and adds incomplete (aiming to maximize utility/effort, similarly to
b1064ac) bindings to the `tmux` buffer commands.

The main benefit is, IMO, is the tab completion for `tmux paste-buffer
-b` and `tmux show-buffer -b`.
2025-02-01 17:37:38 -08:00
Fabian Boehm
5eee4fc2c7 completions/git: Don't set the read limit
This isn't propagated correctly:

If $fish_read_limit is set globally, it won't apply to the completion
command substitution, *unless* you set fish_read_limit inside of that
function.

I'm not entirely sure how that happens, but let's work around it for
now by removing that limit.

I'm going to increase the default limit in a future commit, because
it's not something supposed to be reachable in ordinary code.

See #11106
2025-01-31 16:37:26 +01:00
Fabian Boehm
ba193665e2 completions: Add missing options for our builtins 2025-01-29 20:38:41 +01:00
Fabian Boehm
66f1aba0f2 completions/commandline: Add missing options
Some checks failed
Rust checks / clippy (push) Has been cancelled
make test / ubuntu-asan (push) Has been cancelled
make test / ubuntu (push) Has been cancelled
make test / ubuntu-32bit-static-pcre2 (push) Has been cancelled
Rust checks / rustfmt (push) Has been cancelled
make test / macos (push) Has been cancelled
Lock threads / lock (push) Has been cancelled
2025-01-29 20:17:46 +01:00
David Adam
2184aaf9b4 completions/acpi: correct the -c option as cooling
Closes #11068.
2025-01-28 21:47:05 +08:00
Ilya Grigoriev
f241187c4a completions/tmux: some windows and panes boolean flag completions
This documents some non-argument options for the window and panes
commands. The choice of what to document is somewhat arbitrary,
this commit is biased towards options that I find confusing or
misleading without documentation (is `-a` "all" or "after"?)
and the command that seem more useful to me.

I also didn't cover the options that would be covered by
#10855 (though this PR can be used independently). I'm not
sure how much difference this made, it might not matter at
all.
2025-01-28 21:38:34 +08:00
Ilya Grigoriev
77406ddd11 completions/tmux: complete commands inside tmux lscm
Make `tmux lscm <tab>` work.
2025-01-28 21:37:16 +08:00
Ilya Grigoriev
183e20cc3a completions/tmux: complete all flags when tmux lscm is available
These dynamic completions are exhaustive, but not as well-documented or
as ergonomic as the manual completions. So, any manual completions
should override them.
2025-01-28 21:37:16 +08:00
Ilya Grigoriev
27e5ed7456 completions/tmux: complete all subcommands when tmux lscm works
For example, `tmux shell<tab>` now completes to `if-shell` and
`run-shell`, though no additional information is provided.
2025-01-28 21:37:16 +08:00
Fabian Boehm
9116c61736 completions/nmcli: Complete at runtime
This used to get all the interfaces and ssids when the completions
were loaded. That's obviously wrong, given that ssids especially can, you know, change
2025-01-27 20:46:38 +01:00
Fabian Boehm
4370fb755d completions/git: Handle untracked files separately
This uses `git ls-files`, which has a simpler format (just the
filenames on separate lines), in order to print the untracked files.

This allows us to skip them in the `git status` call, which reduces
the output a lot and removes two `string match`.

In a repository with over half a million files (my home directory, if
I made it one), this improves time by a third (12s to 8s).

In a smaller repo (fish-shell) it's barely measurable.
2025-01-27 18:24:08 +01:00
Fabian Boehm
5c81e18b2e completions/git: Handle gigantic repos better
Determine if untracked files are off via `__fish_git`, so we get the
repo used on the commandline etc,

and if it isn't, at least don't error out. Yes, this *can* print a
hundred megabytes of filenames.
2025-01-27 17:52:32 +01:00
Fabian Boehm
bba15c6d14 completions/csvlens: Fix missing option 2025-01-27 17:51:35 +01:00
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 efce176ceb1d56cbbcce7e7821b29bac503c2bf7.
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 e32572e4e68f93bc4f418ccf601c396e36bf4131.
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 ebdc3a0393db08d3647070a35cf8e37274b42d42.

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 97db461e7f19c51e84fbf0dcb10fb25e0f582870.

Revert "Allow foo=bar global variable assignments"

This reverts commit 45a2017580ceb1ef2d79100b6cbf65d1db3c7fa5.

Revert "Interpret () in command position as subshell"

This reverts commit 0199583435c3b584b90769d50252d16105349671.

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

This reverts commit 4a71ee12883a720408419a53482818177a834ec7.

Revert "Allow $() in command position"

This reverts commit 4b99fe2288da07ea1d0bc79ac0c829b65fee230a.

Revert "Turn off full LTO"

This reverts commit b1213f1385ad07578ca4db5f4fa7cb6371cb3be9.

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

This reverts commit f43abc42f91adf43bb2dfc65b29dd4f838ea21cf.

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

This reverts commit 485201ba2e326a0c711c003290d6f6eb2e247012.
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