Commit Graph

5261 Commits

Author SHA1 Message Date
Fabian Boehm
99b5e6e0e7 completions/cargo: Complete packages to uninstall
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
2024-12-08 09:13:20 +01:00
Fabian Boehm
7c73c5fec0 Make fish installable
When built with the default "installable" feature, the data files (share/) are
included in the fish binary itself.

Run `fish --install` or `fish --install=noconfirm` (for
non-interactive use) to install fish's data files into ~/.local/share/fish/install

To figure out if the data files are out of date, we write the current version
to a file on install, and read it on start.

CMake disables the default features so nothing changes for that, but this allows installing via `cargo install`,
and even making a static binary that you can then just upload and have extract itself.

We set $__fish_help_dir to empty for installable builds, because we do not have
a way to generate html docs (because we need fish_indent for highlighting).
The man pages are found via $__fish_data_dir/man
2024-12-06 22:12:26 +01:00
Johannes Altmanninger
3ed031c149 Update Kakoune completions
Some checks failed
make test / ubuntu (push) Has been cancelled
make test / ubuntu-32bit-static-pcre2 (push) Has been cancelled
make test / ubuntu-asan (push) Has been cancelled
make test / macos (push) Has been cancelled
Rust checks / rustfmt (push) Has been cancelled
Rust checks / clippy (push) Has been cancelled
2024-11-27 08:44:36 +01:00
Fabian Boehm
8dcde27e0b functions/history: Put back some checks for clear{,-session}
Mostly we pass on the options - otherwise they would be ignored.

For `clear`, we do need the full checks, because that will
prompt *before* running the builtin.

But this makes it easier to eventually move that logic into the builtin
2024-11-21 18:55:03 +01:00
Fabian Boehm
6fe192606a functions/history: Set variables in function-scope explicitly
```fish
set -g LESS foo

history search bar
```

changes the global $LESS and exports it.
2024-11-21 18:27:10 +01:00
Fabian Boehm
11f11e27a1 functions/history: Remove unnecessary code
These things are all handled in the builtin
2024-11-21 18:26:47 +01:00
Kid
31b15405e9
Add completion for path basename -E/--no-extension (#10863) 2024-11-20 15:06:53 -06:00
Fabian Boehm
7a667b4f6d Add basic completions for firejail
These are pretty basic, but get us roughly up to the level of the
official completions (that are also incomplete and offer disabled
options).

Fixes #10858
2024-11-18 16:16:07 +01:00
Unbelievable Mystery
262e2d5fe6
Update completions for: wine (#10789)
* feat(function): move cmd completion function to a separate file

* feat(completion): support wine cmd subcommand

* feat(completion): support wine control subcommand

* feat(completion): support wine eject subcommand

* feat(completion): support wine explorer subcommand

* feat(completion): support wine explorer subcommand for desktops

* feat(completion): support wine start subcommand

* feat(completion): support wine winemenubuilder subcommand

* feat(completion): support wine winepath subcommand

* fix(function): rename function for cmd argument completion

* feat(function): implement function to complete registry keys

* feat(completion): support wine regedit subcommand

* feat(function): add top-level key descriptions

* fix(completion): remove redundant comment

* feat(completion): support wine msiexec subcommand

* refactor(completion): group code into functions

* feat(completion): enhance subcommand descriptions
2024-11-17 14:58:21 -08:00
Unbelievable Mystery
93aa5a9376
Add completions for: guile, guild (#10792)
* feat(completion): support guile command

* feat(completion): support guild command

* feat(completion): support guild subcommand

* feat(completion): squeeze code
2024-11-17 14:08:19 -08:00
Next Alone
723e5a8417 completions(ollama): ollama need no files as i know (#10851)
Closes #10851.

Signed-off-by: Next Alone <12210746+NextAlone@users.noreply.github.com>
2024-11-17 10:05:42 -06:00
David Adam
98fcb1c6ba completions/diskutil: list all volumes, not just the writeable ones
Discussion in #10574.
2024-11-17 22:06:54 +08:00
Xiretza
421e27b1bf Add completions for iftop 2024-11-17 21:59:08 +08:00
Mahmoud Al-Qudsi
68b9f96f84 Add completions for simonw/llm 2024-11-16 13:27:29 -06:00
vp2177
2b19e1a09b
completion(apt-mark): Add missing minimize-manual command & --color options (#10825)
* Update apt-mark.fish
2024-11-14 16:01:54 -06:00
Mahmoud Al-Qudsi
bb57f2391f Fix a bad comment and clarify delta behavior
s/fish/delta/ and provide a better explanation.
2024-11-12 09:59:10 -06:00
Mahmoud Al-Qudsi
d33cbfd1a3 Prevent delta completions from complain with old version 2024-11-11 16:51:27 -06:00
Mahmoud Al-Qudsi
f0a3a5708f git: complete git diff src/ to show modified files before unmodified ones
This has the side effect of changing the order of completions for a bare `git
diff` to show modified files before revisions; previously they came at the very
end after all revisions, stashes, local branches, remote branches, and tags.
That seems sensible to me?

As I understand the completions file, it seems to me that the intention was for
`git diff src/` to only show modified files to begin with ­ it
previously/currently shows them all, so we might want to add a `-n 'not ...'`
condition for `git diff` to prevent that.
2024-11-10 12:55:32 -06:00
Peter Ammon
dff454b1c7
Rework git detection for macOS
fish by default shows a git-aware prompt. Recall that on macOS, there are
two hazards we must avoid:

1. The command `/usr/bin/git` is installed by default. This command is not
actually git; instead it's a stub which pops open a dialog proposing to
install Xcode command line tools. Not a good experience.
2. Even after installing these tools, the first run of any `git` or other
command may be quite slow, because it's now a stub which invokes `xcrun`
which needs to populate a cache on a fresh boot. Another bad experience.

We previously attempted to fix this by having `xcrun` print out its cache
path and check if there's a file there. This worked because `xcrun` only
lazily created that file. However, this no longer works: `xcrun` now
eagerly creates the file, and only lazily populates it. Thus we think git
is ready, when it is not.

(This can be reproduced by running `xcrun --kill-cache` and then running
the default fish shell prompt - it will be slow).

Change the fix in the following way: using sh, run `/usr/bin/git --version;
touch /tmp/__fish_git_ready` in the background. Then detect the presence of
/tmp/__fish_git_ready as a mark that git is ready.

Fixes #10535
2024-11-09 12:46:06 -08:00
Dezhi Wu
5405833822 feat(completion): Add kops.fish completion
[kOps] is a set of tools for installing, operating, and deleting Kubernetes
clusters.

[kOps]: https://github.com/kubernetes/kops/
2024-11-07 23:13:09 +08:00
Fabian Boehm
0979b9a98b help: Print external URL if no browser was found
This is nicer when you use fish over ssh, and that system does not
have a browser. But the system where your terminal is has one, and so
now you can just click the link.
2024-11-06 18:48:57 +01:00
Johannes Altmanninger
7debdb75af Fix regression causing fish_cursor_external to be ignored
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
Regressed in 0e97b876e (Simplify fish_vi_cursor, 2024-10-25).
2024-11-06 07:24:00 +01:00
Mahmoud Al-Qudsi
24a077f804 Silence GPG warnings about directory permissions
Some checks failed
Rust checks / clippy (push) Has been cancelled
make test / ubuntu (push) Has been cancelled
make test / ubuntu-32bit-static-pcre2 (push) Has been cancelled
make test / ubuntu-asan (push) Has been cancelled
make test / macos (push) Has been cancelled
Rust checks / rustfmt (push) Has been cancelled
2024-11-04 16:35:24 -06:00
Mahmoud Al-Qudsi
d7f4ad7ab8 Silence gh warnings re unable to read plugins dir
Unlike the errors, these *do* get printed to stderr.
2024-11-04 16:33:30 -06:00
Johannes Altmanninger
85404bf7a9 edit_command_buffer: speed up setting cursor position by line/column
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
alt-e restores the cursor position received from the editor, moving by
one character at a time.  This can be super slow on large commandlines,
even on release builds.  Let's fix that by setting the coordinates
directly.
2024-11-01 20:09:55 +01:00
Johannes Altmanninger
6525e3d11a edit_command_buffer: silence error when editor reports out-of-bounds line number
This happens when using alt-e to edit the command buffer,
adding some lines, leaving the cursor at the end
and quitting the editor without saving.

Let's avoid the noisy error that has sort of bad rendering (would
need __fish_echo).
2024-11-01 20:09:55 +01:00
Josef Litoš
9e01981bb9 completions/adb: local files first when pushing
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 / clippy (push) Waiting to run
Rust checks / rustfmt (push) Waiting to run
2024-10-31 01:05:44 +01:00
Johannes Altmanninger
ec939fb22f Work around BSD man calling pager when stdout is not a TTY
With BSD man, "PAGER=vim man man | cat" hangs because
[man](https://cgit.freebsd.org/src/tree/usr.bin/man/man.sh) wrongly
calls the pager even though stdout is not a terminal.

This hang manifests in places where we call apropos in a subshell,
such as in "complete -Ccar".

Let's work around this I guess. This should really be fixed upstream
because it's a problem in every app that wants to display man pages
but doesn't emulate a complete terminal.

Weirdly, the Apple derivative of man.sh uses WHATISPAGER instead
of MANPAGER.

Closes #10820
2024-10-30 04:58:50 +01:00
Nihaal Sangha
5ee51492be Add tailscale completion 2024-10-27 16:49:00 -07:00
Johannes Altmanninger
9ef76860e6 Default Vi cursor shapes for insert/replace mode
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 / clippy (push) Waiting to run
Rust checks / rustfmt (push) Waiting to run
Let's provide a sensible default here. Use a line for "insert" and an
underline for "replace_one" mode.  Neovim does the same, it feels pretty
slick.

As mentioned in #10806
2024-10-26 08:25:12 +02:00
Johannes Altmanninger
5760a1afcf Don't reset the fish_cursor_selection_mode in fish_default_key_bindings
As of the parent commit, __fish_vi_key_bindings_remove_handlers
should be working properly now, so this is no longer necessary That
function also cleans up other stuff like fish_cursor_end_mode, that
fish_default_key_bindings doesn't know anything about.

Also this fixes a spurious exit status of 4 in some scenarios.
2024-10-26 08:25:12 +02:00
Johannes Altmanninger
b05e071238 Properly remove Vi mode when switching to different bindings
fish_key_bindings may be set directly
or via fish_{default,vi}_key_bindings.

The latter use "set --no-event" to simplify their control
flow.  This (24836f965 (Use set --no-event in the key binding
functions, 2023-01-10)) broke Vi mode cleanup, since Vi mode
uses a variable hook.  Let's update this variable also when using
fish_{default,vi}_key_bindings.  Another reason to keep this variable
in sync is to make the fish_key_bindings handlers working as expected.
2024-10-26 08:22:19 +02:00
Johannes Altmanninger
8eaa16542a Extract function for changing key bindings 2024-10-26 08:21:12 +02:00
Johannes Altmanninger
832cda26f6 Fix external cursor not being restored on exiting Vi mode 2024-10-26 08:21:12 +02:00
Johannes Altmanninger
0e97b876ea Simplify fish_vi_cursor
This command has redundant source statements which need a lot
of escaping. Also, let's extract a function, to be modified in a
following commit.
2024-10-26 08:21:12 +02:00
Johannes Altmanninger
aca8058717 Remove obsolete optimization in default binding initialization
This special case was added in fb2ed355e (Improve fork reporting Save a
couple of forks during init, 2012-04-24) but the reason for it is gone.
2024-10-26 08:21:12 +02:00
Johannes Altmanninger
dea7841611 Fix Vi replace mode regression not being able to append to command line
Regressed in d51f66964 (Vi mode: avoid placing cursor beyond last
character, 2024-02-14).
2024-10-26 08:21:12 +02:00
Johannes Altmanninger
c2cde317f2 Remove stale FISH_UNIT_TESTS_RUNNING workaround
This exists to make sure our assertions pass independent of the
terminal but now we unconditionally print __fish_cursor_xterm.
2024-10-26 08:21:12 +02:00
Johannes Altmanninger
ae7b401029 completions/set: show innermost scope in variable description
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
A side effect of cd9e50c2c (completions/set: Complete variables of all scopes
when setting, 2024-10-03) is that

    HOME=$(mktemp -d) fish
    fish_config choose ayu\ Light
    set -S fish_color_

gives only completions that have the "Universal variable" description even
though most colors are also defined in the global scope which usually takes
precedence.

Fix this by reordering the completions. (The last-added completion is shown
first which is very surprising, we should change that).

This is not perfect; if the user has already specified `-U`, then we should
probably not show description of the global version.  But that's still
worth the trade that this commit makes.  Finally, the description could show
something like "Defined in universal and global scope" etc.
2024-10-20 07:55:04 +02:00
Rikuki IX
85801b443a
feat(completion): add lsb_release completion (#10795) 2024-10-19 13:06:06 -05:00
Jason Nader
6082c3f77a
completions/diff: allow file completion for --unified (#10796)
* completions/diff: allow file completion for --unified

* Update diff.fish

* Update diff.fish
2024-10-19 16:58:29 +02:00
Fabian Boehm
81ff6db62d default color scheme: Make commands "normal" color
Some checks failed
Rust checks / rustfmt (push) Has been cancelled
Rust checks / clippy (push) Has been cancelled
make test / ubuntu (push) Has been cancelled
make test / ubuntu-32bit-static-pcre2 (push) Has been cancelled
make test / ubuntu-asan (push) Has been cancelled
make test / macos (push) Has been cancelled
This makes the default colorscheme less colorful for two reasons:

1. It makes it a little less "angry fruit salad"
2. Some terminals (like Microsoft's Windows Terminal) have a terrible
blue default that contrasts badly against a black background

The alternative is to make *parameters* "normal" and give commands the
current parameter color (cyan). But I've seen cyan be quite blue and
quite green depending on the terminal, so I don't want to rely on it.
2024-10-15 21:21:30 +02:00
Fabian Boehm
ebf19c22fd fish_config: Find fish via fish-path 2024-10-15 13:09:02 +02:00
Mahmoud Al-Qudsi
8447c32d65 __fish_indent: Cache fish_indent location
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
2024-10-14 19:01:41 -05:00
exploide
7bb6ce5156 completions: added arping 2024-10-14 15:34:11 -07:00
EmilyGraceSeville7cf
1148b790bb
feat(completion): support winetricks command 2024-10-14 15:11:45 -07:00
exploide
2f2b4c8e99 completions: updated hashcat 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 / clippy (push) Waiting to run
Rust checks / rustfmt (push) Waiting to run
2024-10-14 12:12:07 -07:00
Johannes Altmanninger
6af96a81a8 Default bindings for token movement commands
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
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
Johannes Altmanninger
edaf011ab1 Try to use the fish_indent that corresponds to the fish binary
Some checks failed
Rust checks / clippy (push) Has been cancelled
make test / ubuntu (push) Has been cancelled
make test / ubuntu-32bit-static-pcre2 (push) Has been cancelled
make test / ubuntu-asan (push) Has been cancelled
make test / macos (push) Has been cancelled
Rust checks / rustfmt (push) Has been cancelled
Users may install two versions of fish and configure their terminal to run
the one that is second in $PATH.  This is not really what I'd do but it
seems reasonable.  We should not need $PATH for this.

Fixes #10770
2024-10-10 05:18:35 +02:00
Lucas Garron
a7abd83c57 Typo fix: documentaiton → documentation
Closes #10767
2024-10-09 12:36:58 +02:00