Commit Graph

5205 Commits

Author SHA1 Message Date
Mahmoud Al-Qudsi
11be48fc38 Dramatically speed up npm/yarn completions
These go from a minimum of 5s in release mode to instantaneous. Worst case was
more than 30s when we didn't find enough matches to end early.
2024-07-07 14:05:12 -05:00
Mahmoud Al-Qudsi
a33d12fe53 Silence string match expression 2024-07-07 13:08:42 -05:00
Mahmoud Al-Qudsi
725bcef117 Update clasp completions (#10377)
Commit would not rebase cleanly.
Closes #10377.

Co-Authored-By: EmilyGraceSeville7cf <EmilyGraceSeville7cfg@gmail.com>
2024-07-07 12:21:37 -05:00
Mahmoud Al-Qudsi
f4b01bb638 Fix typo in npm completions: isntall -> install 2024-07-07 11:47:48 -05:00
Peter Ammon
8db7f6d8ba
Fix an errant tilde 2024-06-30 13:05:19 -07:00
visrosa
7260774fc3
Update less.fish
Preliminary work.  Might be important to check version if options I added aren't widely available.

Changed some short options to old-style options since they can't be grouped and don't even need spaces before their arguments, such as `less -ooutputfile` which creates `outputfile`.

The -Dxcolor argument is commented out because its arguments follow complex rules I didn't look into in depth
2024-06-30 13:00:19 -07:00
Joe Adams
2ad4454e52
give the two pages of the functions tab individual scrollbars 2024-06-30 12:50:00 -07:00
Nikita Bobko
e03e5e116d
fish_vi_key_bindings: add 'ab' and 'ib' vi text object
Part of #1842

The implementation is obviously isn't 100% vi compatible, but works good enough
for major cases

This commit depends on previous commits where jump-{to, till}-matching-bracket
motions were introduces
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
Kendell R
2a0f7e411f
don't error if only dependencies or devDependencies are present (#10594) 2024-06-29 18:01:41 -05:00
Mahmoud Al-Qudsi
ee4d578171 completions/env: Fix errant loud string match
This was vexing me for a while because the extraneous output presented as a
valid (but unwanted) completion, i.e. with RUSTC_WRAPPER exported, `env RUSTC_W`
would offer `RUSTC_W=` and `RUSTC_WRAPPER=` as completions (when only the latter
should have been offered up).
2024-06-26 19:10:51 -05:00
Ryan Patterson
2d9f8547e2 Fix completion for port
This blames to a40b019, when @floam made some changes to various completions,
but this one seems to not quite fit the pattern and had a copy/paste error
resulting in using an undeclared variable.

Also disable filename completion on port.
2024-06-25 22:18:53 +08:00
Mahmoud Al-Qudsi
4d7ef1fad8 Speed up kldload descriptions with alternative to __fish_whatis
__kld_whatis is an order of magnitude faster than calling `whatis` by means of
`__fish_whatis`. (It could be even faster if we could somehow tell `string
replace` to return after the first result, since the .Nd line comes at the start
of the file.)

It still takes some ~3.5 to print descriptions for all available klds (864 under
FreeBSD 13), so we still need to decide when it's prudent to do so and when it's
not.
2024-06-24 15:21:06 -05:00
Mahmoud Al-Qudsi
d914f4e991 Fix broken __fish_whatis
This has been broken for a *long* time.
2024-06-24 14:30:37 -05:00
Mahmoud Al-Qudsi
245ee466cb completions/magento: remove sed dependency
This runs in about half the time, too.
2024-06-23 18:08:34 -05:00
Jean-Bernard Valentaten
3c74f14569
completions/magento: Fixes module aggregation for module related commands (#10446)
* completions/magento: Fixes module aggregation for module related commmands

Previousely when attempting completion for commands `module:enable`,
`mmodule:disable` and `module:uninstall` and error would be disaplyed,
stating that "magento" was not found.
Upon inspection of the issue in the related completion script it became
clear that:
1. The shell command `magento` does not exist as the CLI script of
   Magentoresides under `bin/magento`.
2. The module aggregation would not work after referncing the
   appropriate CLI command as an undeclared variable was being
   introspected.
3. Using Magento's CLI command took too long to respond as it has to
   bootstrap the whole Magento stack in order to deliver modules.

Thus the whole aggregation was rewritten to a form that actually works
and reduces the aggregation to reading the appropriate information
directly from the configuration file, provided that the file exists and
PHP is installed.

* completions/magento: Refactors module aggregation for module related commmands to not use PHP script

Executing random scripts from fish completion poses a threat to the
system. While this would indicate that the Magento installation has been
corrupted, it still is better to not run `app/etc/config.php` to get
hold of the modules.
Thus the module aggregation was rewritten to make use of `sed` instead,
which has the additional benefit of being faster than using PHP.
2024-06-23 18:05:52 -05:00
Lzu Tao
e0266067c4 git: completion for git commit --edit 2024-06-22 20:00:31 +00:00
Schlomo Schapiro
b3a16e0993
Show only writeable volumes
to exclude system volume
2024-06-19 09:17:14 -07:00
Schlomo Schapiro
f0c8f7406c
Extend diskutil eject to suggest volumes
Extend `diskutil eject` completion to also suggest mounted volumes.

Fixes #10573
2024-06-19 09:17:14 -07:00
Manuel Krebs
27c7578760 Add completions for dust 2024-06-19 02:10:52 +02:00
Lzu Tao
d370adf5fe git: allow path completion after git reset -- 2024-06-15 11:59:24 -07:00
iselda aiello
bac222e001 Move cursor back one space when deleting in vi visual mode
Fixes #10394
2024-06-15 11:44:32 -07:00
Shun Sakai
525a39b42c Add completions for actionlint 2024-06-12 08:10:57 +02:00
Mark Huang
1d8b10399a apt list completions 2024-06-12 08:10:38 +02:00
Fabian Boehm
f59cdfaa8d fish_add_path: Be more informative in verbose mode
One issue with fish_add_path at the moment is that it is sometimes a bit too intransparent.

You'll try to add a path, but it won't appear - was that because it wasn't a directory,
or because it doesn't exist, or because it was already included?

If it isn't usable after, did fish_add_path not add it because of something or did something *else* remove it?

So we give more explanations - "skipping this because it's a file", "not setting anything because no paths are left to add", ...
2024-06-06 16:47:39 +02: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
tesuji
01e958d2fb
git: add completion for sparse-checkout subcommand (#10542) 2024-06-02 22:02:06 -05:00
Mahmoud Al-Qudsi
9f0e034fad Fix curl data string from path completions
Closes #10539.
2024-06-02 21:58:54 -05:00
Mahmoud Al-Qudsi
fc9a743622 completions/env: overhaul completions
The value completions were rendered almost entirely useless due to the forced
inclusion of file completions at all tokens, including in the head/command
position thanks to the use of `__fish_complete_subcommand` which doesn't
understand the semantics of `env` and expects something like `ssh`. But we don't
need it at all.
2024-05-31 20:49:48 -05:00
Mahmoud Al-Qudsi
e1ee193822 Speed up __fish_make_cache_dir
Don't fork/exec an external process, especially one performing IO, if we don't
have to.

This, in turn, speeds up __fish_source_cached_completions which is rather slow
under WSL (and slower than it needs to be on other platforms).
2024-05-30 17:03:03 -05:00
Mahmoud Al-Qudsi
98642d307a Don't use a graphical browser under SSH
...unless X is also being forwarded.

Someone else will have to figure out the Wayland equivalent (if that even
exists). Not my monkey, not my circus.
2024-05-30 16:15:07 -05:00
Mahmoud Al-Qudsi
46f6aa8024 Update ssh-keygen completions
Don't run `ssh` upon sourcing and don't rely on `ssh -Q` being available.
2024-05-29 14:08:21 -05:00
Mahmoud Al-Qudsi
828b88a212 Add issue reference to flatpak completion workaround
[ci skip]
2024-05-29 13:54:39 -05:00
Yuntao Zhao
96416cc49e
feat: improve completion for konsole (#10528)
* feat: improve konsole completion

* Improve konsole profile completion to be dynamic

Directly complete --profile as a long argument

* Dynamically complete konsole -p
2024-05-28 10:26:03 -05:00
Nguyen Huu Kim
8880fa8dd7
feat: add completions for k8s tools (kustomize, flux) (#10473)
* feat: add completions for kustomize

* feat: add completions for FluxCD

* Update flux.fish

* Update kustomize.fish

---------

Co-authored-by: Mahmoud Al-Qudsi <mqudsi@neosmart.net>
2024-05-26 22:12:49 -05:00
Mahmoud Al-Qudsi
dbf6dfd5d2 completions/flatpak: dynamically complete flatpak install 2024-05-26 22:03:27 -05:00
Mahmoud Al-Qudsi
4868166f86 completions/rustc: preserve trailing = in -Z values 2024-05-26 21:44:02 -05:00
Mahmoud Al-Qudsi
84d057e7b7 Finish refactoring rustc completions
* Properly handle a lot more -Z completion formats as suggested by `rustc -Z
  help`
* Don't run any `rustc` commands when sourcing `rustc.fish`; these invocations
  are instead deferred until the user attempts to complete the specific switch.
* Support CSV -A/F/D/W values
2024-05-26 21:33:48 -05:00
Mahmoud Al-Qudsi
9045b251b0 Fix missing -- filter in string replace call 2024-05-26 21:33:48 -05:00
tesuji
114856e1d9
git: add --reuse-message and --reedit-message completion (#10530) 2024-05-26 20:57:43 -05:00
Klaus Hipp
cd9f5bdbaa
Add jnv completions (#10519) 2024-05-24 17:09:18 -05:00
tesuji
57963ced4b
add completions for ssh-keygen (#10508)
* add bare completions for ssh-keygen

* chore: more completions for ssh-keygen
2024-05-24 17:07:32 -05:00
Fabian Boehm
06d842b0d8 completions/csvlens: Fix a typo 2024-05-24 22:40:18 +02:00
Klaus Hipp
843933ce95
Add csvlens completions (#10520) 2024-05-24 15:38:45 -05:00
Mahmoud Al-Qudsi
b49e9b906f Wrap an unruly comment 2024-05-24 10:21:07 -05:00
Mahmoud Al-Qudsi
537cde0c72 Avoid auto-colorization of ls output if CLICOLOR_FORCE is set
We don't set this variable ourselves, but some might set it in their config out
of habit coming from shells that don't automatically colorize ls output.

This variable overrides stdout tty detection for `ls --color=auto` (but does not
modify the behavior of `ls --color=never` or `ls --color=always` regardless of
its value) under at least the BSD version of `ls`. (Under the GNU version, it
influences colorization only if stdout *is* a tty.)

If we detect CLICOLOR_FORCE *and* we are not writing directly to the tty, we
skip colorization (by clearing-but-not-erasing `$__fish_ls_color_opt`, so that
we don't end up accidentally using its value from another scope).
2024-05-23 20:50:23 -05:00
Shun Sakai
6d8b4214d5
Add completions for reuse-tool (#10511) 2024-05-23 16:53:53 -05:00
Fabian Boehm
5bd1c5ecbf completions/git: Move unmerged to git restore --staged
I still don't get how exactly restore works.

Fixes #10518
2024-05-23 15:08:55 +02:00
Fabian Boehm
00e0d6ad9d Yet more shortening 2024-05-23 14:36:56 +02:00
Johannes Altmanninger
2f84f76cc2 completions/bind: complete ctrl/alt modifier abbreviations 2024-05-22 22:38:06 +02: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
Mahmoud Al-Qudsi
4869b98482 completions/flatpak.fish: Use terser/faster declarative style 2024-05-22 13:53:25 -05:00
Mahmoud Al-Qudsi
c2ecfe60ac completions/flatpak: Fix compatibility with older versions
Filter out ansi control characters and pretty formatting from older versions
that don't detect the absence of a tty.

Closes #10514.
2024-05-22 13:53:25 -05:00
Michal Koutný
fa0c585662
completions/git: Add git branch --edit-description (#10512)
* completions/git: Add `git branch --edit-description`
2024-05-21 18:56:52 -05:00
Jannik Vieten
bd4e5fe69a
completions ip: silence stderr in case -d does not exist (busybox) (#10509) 2024-05-20 07:28:40 -05:00
Peter Yates
56a168d37f Prevent loading of psqlrc when listing databases
Users have the ability to override the way records are displayed in psql by
changing the format[1] and linestyle[2] settings. These settings also affect the
output of psql commands used for autocompletion, like listing databases and
users - so they inadvertantly break Fish's completion.

If we suppress the loading of psqlrc[3] the default settings are used instead.

[1] https://www.postgresql.org/docs/current/app-psql.html#APP-PSQL-META-COMMAND-PSET-FORMAT
[2] https://www.postgresql.org/docs/current/app-psql.html#APP-PSQL-META-COMMAND-PSET-LINESTYLE
[3] https://www.postgresql.org/docs/current/app-psql.html#APP-PSQL-OPTION-NO-PSQLRC
2024-05-20 14:04:38 +02:00
ridiculousfish
efefeda392 Restore some iTerm2 default key bindings
c0bcd817ba removed some key bindings, including the bindings of
ESC ESC [ C for Alt-Right. the commit claimed that
"Sequences like \e\eOC are Escape followed by an SS3 arrow key which we
can already decode separately." but for whatever reason this doesn't work:
Alt-Right is broken in iTerm2 by default.

Restore the default ESC ESC [ X bindings for iTerm2 compatibility.
2024-05-19 11:01:14 -07:00
Klaus Hipp
4659fdf704
Add git-lfs completions (#10490) 2024-05-19 09:09:33 -05:00
tesuji
255c8da22d
add completions for ibus (#10500) 2024-05-19 09:05:40 -05:00
Jannik Vieten
66d28f5fda
completions: improved ip completions (#10505)
- complete routing table names/IDs
- rudimentary completions for ip rule subcommand
2024-05-19 09:00:29 -05:00
Mahmoud Al-Qudsi
ef614ba2d9 Speed up rustc completions, filter out deprecated options
Don't unconditionally execute the plumbing to get `rustc -C` completions (use it
only when trying to complete `rustc -C`), filter out deprecated options, and use
fewer calls to the `string` builtin to optimize further.

Need to do the same thing for the `-Z` completions next, those hang the shell
for a good 1.5+ seconds.
2024-05-18 12:37:18 -05:00
Mahmoud Al-Qudsi
0a7725e469 Add comment re accuracy of cargo --target completions
[ci skip]
2024-05-18 12:00:45 -05:00
Mahmoud Al-Qudsi
cbb399f2ed completions/cargo.fish: Add python fallback for jq 2024-05-17 18:45:19 -05:00
Mahmoud Al-Qudsi
79f7b9f92a completions/cargo.fish: Dynamically generate --features completion 2024-05-17 18:17:53 -05:00
Mahmoud Al-Qudsi
f342ae6a1c Add a completion helper function to generate permutation completions
I've been needing this for some time to generate completions for functions that
we can dynamically generate completions for that take one or more
comma-separated values in any order.
2024-05-17 18:15:41 -05:00
Mahmoud Al-Qudsi
6dbae76b24 Update cargo-asm completions
Try not to let `cargo asm` build a large project and hang the terminal (and make
the fans go crazy) if we try to generate a list of functions/paths and the
project is in a dirty state. Also support dynamic completion of --target.
2024-05-17 17:10:10 -05:00
Mahmoud Al-Qudsi
1d36c6ad8c completions/cargo.fish: Generate dynamic --target options
If rustup is installed, use the existing `__rustup_installed_targets` to get a
list of installed targets to compile for. If it's not, print a list of all
targets known to rustc.

It sucks that the completions file is currently architected in a way where we
have to manually specify the arguments for each subcommand. 🤷
2024-05-17 16:57:40 -05:00
Mahmoud Al-Qudsi
9ab1ec2a9e Tweak newly added rustc completion descriptions
Addendum to https://github.com/fish-shell/fish-shell/pull/10491
2024-05-17 12:33:59 -05:00
tesuji
d3758d3751
completion: add more arguments for rustc --print (#10491)
Based off of rustc 1.80.0-nightly
2024-05-17 12:32:41 -05:00
Ian Chamberlain
1462da3ae2
Complete cargo check bin targets like build (#10499)
Since `check` operates on basically the same things as `build`, it makes
sense to complete binary targets the same way (i.e. tests, bins, examples)
2024-05-17 12:31:30 -05:00
Mahmoud Al-Qudsi
0271d91d3a Add completions for cargo-asm 2024-05-17 12:31:02 -05:00
Fabian Boehm
5dc07c9e7e completions: More shortening
Also removes a few deprecated options - there's really no need to
offer these.
2024-05-16 18:29:42 +02:00
Fabian Boehm
8bac13360b completions/gcc: More cleanup
These options, I tell you
2024-05-15 20:07:28 +02:00
Fabian Boehm
173bcf29ab completions/gcc: Cleanup options
- Remove duplicated options - we had `-type` 9 times!
- Remove deprecated options and synonyms
- Make descriptions shorter, even removing some - when they're inscrutable they might as well not be there.

Really, 99.8% of these options are of interest to nobody except possibly (a subset of) gcc developers, so it pays to have *less* on your screen that you don't use anyway.
2024-05-15 17:05:02 +02:00
Fabian Boehm
4cadaa4041 completions/gcc: Fix some options
Especially the "-l" one was *always* offered.
2024-05-15 17:05:02 +02:00
Johannes Altmanninger
35b689335a Strip control characters from pasted text
We ignore typed control characters 33a7172ee (Revert to not inserting control
characters from keyboard input, 2024-03-02).

We used to do the same for bracketed paste but that changed in 8bf8b10f6
(Extended & human-friendly keys, 2024-03-30) which made bracketed paste
behave like fish_clipboard_paste; it inserts the exact input (minus leading
whitespace etc). At that time it wasn't clear to me which behavior was the
right one (because of the inconsistency between terminal and bracketed paste).

As reported in
https://matrix.to/#/!YLTeaulxSDauOOxBoR:matrix.org/$PEEOAoyJY-644amIio0CWmq1TkpEDdSy2QnfJdK-dco
trailing tabs in pasted text can be confusing.

There seems to be not real need to insert raw control characters into the
command line, so let's strip them when pasting.

Now the only way to insert a raw control character into the command line is
to recall it from command history.  Not sure what the behavior should be for
that case, we can revisit that later. If we get rid of raw control characters
entirely, then we can also delete the new "control pictures" rendering :)
2024-05-14 23:14:49 +02:00
Fabian Boehm
24836f9652 Use set --no-event in the key binding functions
This is how we can use it in a backwards-compatible way. Eventually we
would remove the compatibility guff.
2024-05-14 17:31:47 +02:00
tesuji
f71623ec1b
Partially update zig completions for zig 0.13 (#10479)
Try for completeness with `zig -h` and `zig build -h`
2024-05-09 15:31:07 -05:00
Klaus Hipp
ae486bafc8
Add completions for VS Code preview builds (#10485) 2024-05-09 15:28:14 -05:00
Klaus Hipp
1c0887eba2
Add duf completions (#10486) 2024-05-09 15:27:13 -05:00
Klaus Hipp
5524b46181
Add zed completions (#10487) 2024-05-09 15:25:41 -05:00
Mahmoud Al-Qudsi
2ca92cd52d completions/rustup: Filter out installed components from rustup component add 2024-05-08 18:47:15 -05:00
Mahmoud Al-Qudsi
671d128a3e completions/rustup: Fix incorrect component names
The components with the form abc-x86_64-unknown-linux-gnux32 were ending
up generating invalid components of the form abcx32, which is incorrect.
2024-05-08 18:43:28 -05:00
Fabian Boehm
9320fb52bb git prompt: Check for "U"nmerged files
Fixes #10481
2024-05-06 19:17:26 +02:00
Fabian Boehm
33c5cd5808 git prompt: Remove a useless use of math 2024-05-06 19:15:42 +02:00
Mahmoud Al-Qudsi
bcc1fc0167 rustup: add rustup target xxx completions 2024-05-04 18:42:11 -05:00
Johannes Altmanninger
d4ecea56df Fix regression spuriously expanding abbr with cursor outside token
Given "abbr foo something", the input sequence

    foo<space><ctrl-z><space>

would re-expand the abbreviation on the second space which is surprising
because the cursor is not at or inside the command token.  This looks to be
a regression from 00432df42 (Trigger abbreviations after inserting process
separators, 2024-04-13)

Happily, 69583f303 (Allow restricting abbreviations to specific commands
(#10452), 2024-04-24) made some changes that mean the bad commit seems no
longer necessary. Not sure why it works but I'll take it.
2024-05-03 08:39:05 +02:00
ClaXXX
0116dc5984
Fix the acidhub prompt for a commitless repository (#10462)
Deletes the error message generated by git when comparing indexes for a
commitless repository and print '-' as the branch name
2024-05-02 19:37:12 +02:00
Johannes Altmanninger
0c413d0093 Use canonical key name in bind command 2024-05-01 12:53:00 +02:00
Fabian Boehm
4be4592870 fish_add_path: Add separate message about files 2024-04-30 16:47:45 +02:00
Johannes Altmanninger
e7347b9581 Bind ctrl-Z to redo (since ctrl-z is undo)
In addition to the native Emacs undo binding, we also support ctrl-z.
On Linux, ctrl-shift-z alias ctrl-Z is the redo binding according to
https://en.wikipedia.org/wiki/Table_of_keyboard_shortcuts Let's bind allow
that.

Unfortunately ctrl-shift and ctrl-alt modified shortcuts on Linux may be
intercepted by the windowing system or the terminal. Only alt-shift seems to be
available reliably (but the shift bit should mean "extend selection" in Emacs).
2024-04-30 14:00:06 +02:00
Johannes Altmanninger
1185e5279e Don't print multiple summaries for multiline jobs
For example

    $ echo 'line
    line2' | sleep 1 &

    fish: Job 1, 'echo 'line' has ended
    fish: Job     line2' | sleep 1 &, '' has ended
2024-04-30 14:00:06 +02:00
Johannes Altmanninger
c0bcd817ba Remove obsolete bindings
iTerm2 supports CSI u so the custom bindings are no longer needed. Sequences
like \e\eOC are Escape followed by an SS3 arrow key which we can already
decode separately.
2024-04-28 10:38:26 +02:00
Mahmoud Al-Qudsi
40591ba629 Unify convert and magick completions 2024-04-27 11:45:54 -05:00
Jadi
6840ef46f7 Completion for magick (#10307)
In ImageMagick 7 or later, legacy commands have been replaced with
magick. Here a new functions, defines these completions and it is
called for `magick` and `magick convert`.

fixes #7172. Closes #10307.

Co-authored-by: Mahmoud Al-Qudsi <mqudsi@neosmart.net>
2024-04-27 11:45:12 -05:00
Fabian Boehm
2da5ce7a48 completions/conda: Enable file completions for --file options
Fixes #10463
2024-04-27 17:11:52 +02:00
Johannes Altmanninger
67197b4b07 Fix cleanup of autogenerated completions
We were inconsistent about this for no apparent reason.

Also cleaning up in ~/.config/fish/completions is
irrelevant by now since we moved to ~/.local/share/fish 8 years ago.

Now that the parent commit moved it again, cleaning up that one seems
reasonable.
2024-04-27 10:54:31 +02:00
Anurag Singh
62a8b48fd1 Move generated completions to cache directory 2024-04-27 10:39:30 +02:00
Johannes Altmanninger
ec33550cff Fix detection of empty commandline in alt-d binding 2024-04-26 11:16:30 +02:00
Nguyen Huu Kim
891b0a74fd Update helm completions ignore stderr 2024-04-21 14:39:49 +02:00