Commit Graph

22861 Commits

Author SHA1 Message Date
Johannes Altmanninger
ee4eea51ec fish_git_prompt: extract function 2026-05-14 14:25:21 +08:00
Hans Larsen
a3984ace4a Add git pull/fetch --recurse-submodules to completion
Closes #12746
2026-05-13 19:58:52 +08:00
Daniel Rainer
4bdd35b8d1 feat: stop language fallback at English
Treating `en` the same as any other language is problematic as shown by
#12690. When the language precedence list contains entries after
English and we don't treat English specially, a lack of translations in
`en.po` (or a lack of `en.po`, once we delete it) results in
translations into those subsequent languages being displayed, instead of
the msgid, which is in English, and thus preferable.

By truncating the fallback list when we encounter `en`, this problem is
resolved. As it is implemented now, the `en.po` catalog is never used.
This is intended, as the plan is to delete it (#12745). In any case, its
translations are identical to the msgids modulo some fancy quotes.

While at it, also treat `LANGUAGE` values of `C` and `POSIX` as
referring to the English version of the messages.

Fixes #12690

Closes #12747
2026-05-13 19:58:52 +08:00
June Kim
a93fcd97a7 fish_git_prompt: include T (typechange) in status filter
The status entry filter regex was missing T, which is a valid
porcelain status code for file type changes (e.g. regular file
to symlink). Without it, typechange entries would be silently
dropped from dirty/staged detection.

Closes #12754
2026-05-13 19:58:52 +08:00
June Kim
f86c9af455 fish_git_prompt: skip rename/copy source paths in status parsing
When git status --porcelain -z reports renames or copies, it outputs
the source filename as a separate NUL-delimited field after the status
line. This extra entry was counted as an additional change, inflating
staged/dirty counts when the source filename started with [ACDMRTU].

Filter split results to entries matching a valid two-char status code
prefix, which excludes the bare source filenames.

Fixes #11296

Part of #12754
2026-05-13 19:58:52 +08:00
June Kim
f69f074f66 Add failing test for git prompt rename miscount (issue #11296)
git status --porcelain -z outputs the rename source filename as a
separate NUL-delimited entry after the status line. When the source
filename starts with [ACDMRTU], the informative prompt miscounts it
as an additional staged change.

Part of #12754
2026-05-13 19:58:52 +08:00
Nahor
f0054336ea man-pages: force encoding when reading doc sources
Force the encoding to not be dependent on the environment locale.

In particular on Windows, the encoding could default to an ANSI page
code, which would fail to load any file containing bytes 0x80+, i.e any
multi-byte UTF-8 character.

Closes #12748
2026-05-13 19:58:52 +08:00
Daniel Rainer
959cbb4259 feat: dynamic cargo xtask completions for fish
Use `clap_complete` to generate completions for our xtasks. This comes
with two complications:
- Due to the unusual CLI of the whole xtask CLI definition being itself
  a subcommand under `cargo` (via the `cargo xtask` alias), we need to
  tell `clap_complete` that we're generating completions for `cargo`,
  which is fairly straightforward to do via two new types which are only
  used for generating completions.
- Our completions for `cargo xtask` only make sense within fish's
  workspace, so we need to ensure that they are not active elsewhere.
  `clap_complete` does not support adding such conditions, so we hack
  them together by post-processing its output with sed.

Closes #12739
2026-05-13 19:58:52 +08:00
Collin Styles
fa6cbbdb40 Add completions for git history
This command was added in git 2.54:

94f057755b/Documentation/RelNotes/2.54.0.adoc

Both subcommands (`reword` and `split`) take a commit-ish object to
target. `split` also optionally accepts filenames so I tried to handle
that by copying the pattern from existing completions.

Closes #12737
2026-05-13 19:58:52 +08:00
Daniel Rainer
2b378b9c1f feat: add info how to update outdated PO files
Putting this in the error message makes it easier to find out how to
resolve the problem.

Closes #12735
2026-05-13 19:58:52 +08:00
Milo
2863960836 docs: update Homebrew link to HTTPS
Co-authored-by: KeloYuan <keloyuan@users.noreply.github.com>

Closes #12733
2026-05-13 19:58:52 +08:00
Johannes Altmanninger
c003ec3795 vi mode: fix "x" command in builtin read
When we push a new reader for builtin read, we use the default
CursorSelectionMode::Exclusive, which is wrong in Vi mode.
Add a haphazard fix for that.
This is very ugly, we should improve this.

Closes #12724
2026-05-13 19:58:52 +08:00
PowerUser64
51ab1f5d35 add example of how to set default variable values
Closes #12720
2026-05-13 19:58:52 +08:00
Nahor
01b9fd9e31 complete: remove unescaping of -c/-p values
This removes the need to double-escape the values on the command line
(once for the command line parser, another for the option handling)

This also brings it in line with the implicit case (`complete cmd ...`)

Fixes #12712

Closes #12718
2026-05-13 18:01:48 +08:00
Jian Weihang
b2c23eb397 completions/tmux: complete directories for new-session -c
Closes #12713
2026-05-13 17:25:39 +08:00
Johannes Altmanninger
ef8e62727c Pass Parser by exclusive reference
As described in
https://github.com/fish-shell/fish-shell/pull/9990#discussion_r1382494440,
prior to 77aeb6a2a8 (Port execution, 2023-10-08), "Parser" was
passed by mutable reference ("parser_t&"), even though operation
context was passed as "const operation_context_t &".  This worked
because C++ doesn't propagate const to pointers by default (see
https://en.cppreference.com/cpp/experimental/propagate_const).

	class operation_context_t {
		std::shared_ptr<parser_t> parser;
		...
	};

So "*ctx->parser" was a "parser_t&", not "const parser_t&".

Rust has stricter const propagation rules which means that const
operation context can't simply hand out a non-const reference to parser.

To be able to port code without changing its structure,
77aeb6a2a8 passed "Parser" by shared reference, using interior
mutability (RefCell) to modify parser fields. This is a bit ugly
(c.f. https://doc.rust-lang.org/std/cell/index.html "interior mutability
is something of a last resort") and means that some borrowing conflicts
are not found at compile time but runtime.

Pass both parser and operation context by exclusive reference, and
remove the interior mutability wrappers from parser's fields.
Since "libdata" is no longer inside a "RefCell", add a "ScopedRefCell"
around "transient_commandline".

The downside is that "ScopeGuard" use can become more intrusive
when we pass "Parser" or "OperationContext" as context (especially
when we use "zelf" since we can't shadow "self"), see
* 2930466d53 (Introduce ScopedCell and ScopedRefCell, 2025-03-15)
* 29ae571afa (Make scoped_push nicer, 2024-12-28)
Avoid this in some cases, specifically when using "ScopedCell" or
"ScopedRefCell". Since "&mut Parser" prevents the "ScopeCell"'s
"ScopeGuard" from holding a shared reference, use an "Rc" to capture
a dynamically-checked reference to the Cell. We could also use raw
pointers instead.

Change "Completer::apply_var_assignments" to return  a block ID, to
avoid the need to return a "zelf" "ScopeGuard".  In future, we could
probably untangle completer and get away with returning a "ScopeGuard"
called "ctx".

Closes #12694
2026-05-11 10:41:14 +08:00
Johannes Altmanninger
638777a4de Remove unused ScopeGuarding trait
As of commit 0441bdc634 (Remove ScopeGuard::commit in favor of drop,
2026-04-30), this trait is empty so there's not much use having it
for now.
2026-05-11 10:41:14 +08:00
Johannes Altmanninger
6705d27f93 Remove unused ScopeGuard::cancel() 2026-05-11 10:41:14 +08:00
Johannes Altmanninger
ef626cfdf9 uvar migration: clarify it's about 4.3 or higher 2026-05-11 10:41:14 +08:00
Johannes Altmanninger
30976d8970 uvar migration: recogize more historical defaults as such
During our one-time migration away from universal variables,
we create ~/.config/fish/conf.d/fish_frozen_theme.fish
if we think that the current theme is different from the default.

The default uvar-backed theme had changed over time, but existing
installations would not be upgraded.  Because of this, we have
a heuristic that assumes that values coinciding with historical
default values also stem from a default.  Some historical values are
missing. Add them.

There are more left, see 03b23dd1b6 (Update default colors,
2022-01-27).

Fixes #12725
2026-05-11 10:41:14 +08:00
Johannes Altmanninger
d601ceb55b fish_command_not_found: move non-interactive logic
In non-interactive shells we only ever use our simple command-not-found
handler; the fancy ones are only intended for interactive shells, see
537ab32dd9 (Add support for the Ubuntu 'command-no-found' handler,
which suggests a package to install in order to get a command.,
2008-01-15).

I'm not sure if this behavior difference is really a good idea,
but I guess we can avoid rocking the boat for now.

Make the implementation less surprising by moving it into the obvious
file. No behavior change intended.
2026-05-11 10:41:14 +08:00
Johannes Altmanninger
6e036740de fish_command_not_found: remove legacy event handler
We no longer emit the "fish_command_not_found" event ourselves,
so the event handlers are only useful to users who
1. run "emit fish_command_not_found"
2. copy the definition of "fish_command_not_found" to their config and run
   that with fish < 3.2.

Probably no one does 1; there are no matches in
https://github.com/search?utf8=%E2%9C%93&q=%22emit+fish_command_not_found%22+language%3Afish&type=code

Reason 2 is less relevant after 5 years.

For additional evidence, none of our specializations
("/usr/libexec/pk-command-not-found" etc.)  react to the event,
and no one has ever complained.

Stop registering any fish_command_not_found as event handler,
for consistency and simplicity.

While at it, remove the documentation on how to make it work for
version < 3.2.
2026-05-11 10:24:12 +08:00
Johannes Altmanninger
e25ebf1067 handle_command_not_found: extract constant 2026-05-11 10:24:12 +08:00
Johannes Altmanninger
1f870b360a fish_command_not_found: deduplicate /etc/os-release regex 2026-05-11 10:24:12 +08:00
Johannes Altmanninger
c1a6f6ddc8 fish_command_not_found: remove duplicate function definition 2026-05-11 10:24:12 +08:00
Johannes Altmanninger
184f4f6571 share: remove redundant continuation lines escaping 2026-05-11 10:24:12 +08:00
Johannes Altmanninger
3dc36f74bc Don't print greetings in interactive read in fake-interactive shell
If a user passes "-i" when running a script, they ought to expect
weird behavior i.e. fish might run the user's interactive-only
configuration which might print things to TTY etc.  But at least
for our part of the configuration, we can avoid depending on the
user-settable interactive bit.

__fish_config_interactive is already only called when we paint the
first prompt, either for a prompt (which implies we're an interactive
shell) or for builtin read (which does not imply anything about the
interactivity of the shell).

Only print greetings when not in interactive read. Notably, "status
is-interactive-read" is not overridable by the user.

This helps us get rid of more "status is-interactive" switches.
2026-05-11 10:21:56 +08:00
Johannes Altmanninger
9374410bb6 fish_git_prompt: remove checks for interactive bit
The "if status is-interactive" was added by ae593decfc (Replace
__fish_git_branch_prompt.fish with __fish_git_prompt.fish, 2012-06-20)
presumably to avoid repaints in noninteractive cases.  The repaints
have been removed in 76457bdc4e (fish_git_prompt: Remove repaint
from variable handlers, 2021-03-04) so this is no longer necessary.
2026-05-11 10:21:56 +08:00
Johannes Altmanninger
1e0ff8712d share: use "status is-*" instead of old-school "status --is-*" 2026-05-11 10:21:56 +08:00
Nahor
e697f960c8 windows build: disable lint checks
There is already a GitHub workflow doing lint checks so it is redundant
and wastes time (4+ min).
 
Moreover, other platforms do not do it, so when it fails, it gives
the appearance that there is a Windows specific build issue beyond
linting.

Closes #12740
2026-05-10 23:52:47 +02:00
Daniel Rainer
cab3bdabc4 l10n: update PO files 2026-05-10 15:18:40 +02:00
Fabian Boehm
5c6acdee09 string shorten: Don't produce output with --quiet
This would've printed stuff in case it didn't have to shorten (which
means it "failed" because the logic is "did something").

Fixes #12732
2026-05-10 11:16:41 +02:00
huaji2369
a9cc505d62 completions/waydroid:
add completions for adb/bugreport
add package name completions for app launch/remove
replace all -fr with -x
2026-05-09 21:55:20 -07:00
Nahor
6c6b53cdd8 check.sh: on Cygwin, only re-run the tests that mention ln
On Cygwin, check.sh was running all the tests twice, one with symlinks
enabled, and one without. But most tests do no use symlinks so
re-running those does not test anything new and it's just a major waste
of resources and time (and cygwin is quite slow already).
So only re-run the tests that use symlinks, i.e. that use `ln`.

Filter on mentions of `ln` and not `cygwin_nosymlink` because the latter
is only needed when a test would fail in one of the two scenarios, and
not all tests with symlinks do.
2026-05-09 20:38:50 -07:00
Remo Senekowitsch
f5ff9aac2b completions/dive: add image tags from podman 2026-05-09 20:20:11 -07:00
Remo Senekowitsch
0ddad4fcb1 completions/dive: use upstream completions for builtins 2026-05-09 20:20:11 -07:00
Justin Su
7d1604a116 docs/read: Clarify that --null cannot be used with --line
Fixes issue #12726
2026-05-09 20:04:33 -07:00
Peter Ammon
aa5ecd0efa Make the tmux-history-search2 test more reliable 2026-05-09 18:37:07 -07:00
David Adam
0fafff2c89 CMake: stop installing embedded files
Completions, functions, tools, and various ancillary files have been
shipped within the fish binary for some time. We don't need two copies
in packages, plus some of them are never read from the filesystem.
2026-05-10 02:06:04 +08:00
Johannes Altmanninger
1b18d08611 Fix zellij completions
Note that on some distros, this is shadowed by
/usr/share/fish/vendor_completions.d/zellij.fish.
2026-05-08 01:33:49 +08:00
Johannes Altmanninger
5a2e9f4f3c build_tools/release.sh: update milestones even when pushing fails 2026-05-08 01:33:49 +08:00
Johannes Altmanninger
c592b5d957 start new cycle
Created by ./build_tools/release.sh 4.7.1
2026-05-08 01:33:49 +08:00
Johannes Altmanninger
77285d46b8 Merge tag 4.7.1 2026-05-08 01:33:49 +08:00
Johannes Altmanninger
efb0223da1 Release 4.7.1
Created by ./build_tools/release.sh 4.7.1
4.7.1
2026-05-08 00:02:14 +08:00
Johannes Altmanninger
b6f30f11e4 webconfig: hack webconfig to fake interactive colors
Commit e2b18fc5b6 (config.fish: don't load default theme in
noninteractive shells, 2026-04-28) broke webconfig: since "fish_config
theme choose default" was removed from non-interactive shells,
webconfig won't know the current theme in interactive shells.

Fix this by adding secret knob that allows webconfig to have
noninteractive fish set the same colors as interactive fish again.

This assumes that plugins won't need the knob, i.e. won't need to
know the "current" theme.

Alternatively, webconfig could run "fish -i" but that could cause
issues if an "if status is-interactive" block in user-config does
something naughty such as writing to stdout even if it's not a terminal.

Alternatively, we could do

	fish -c '
		if test -z "$(__fish_theme_variables)"
			fish_config theme choose default
		end
		# can dump current theme now
	'

but that does not feel as reliable (what if the user explicitly does
"set -e" on all color variables or).

Fixes #12717
2026-05-08 00:01:25 +08:00
Remo Senekowitsch
4296e9bd75 completions/zellij: add upstream completions
Closes #12723
2026-05-07 17:52:21 +02:00
Remo Senekowitsch
894ca81464 completions/mise: add upstream completions
Part of #12723
2026-05-07 17:52:16 +02:00
Remo Senekowitsch
7c53bded3a completions/chezmoi: add upstream completions
Part of #12723
2026-05-07 17:52:00 +02:00
Remo Senekowitsch
163f25d516 completions/niri: add upstream completions
Part of #12723
2026-05-07 17:51:44 +02:00
Remo Senekowitsch
d8e73d2263 completions/just: use upstream completions
Closes #12722
2026-05-07 17:51:21 +02:00