Commit Graph

5095 Commits

Author SHA1 Message Date
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
Nguyen Huu Kim
2e61ce5540 Replace minikube completions with autogenerated script 2024-04-21 14:39:49 +02:00
Nguyen Huu Kim
00f661d8e8 add devspace completions 2024-04-21 14:39:49 +02:00
Johannes Altmanninger
b3444ea128 Work around ctrl-c in VSCode killing wl-copy and clearing clipboard
wl-copy is a daemon process that serves its stdin to any wl-paste processes.
On Wayland, we launch it from fish_clipboard_copy.  It then lives in the
same process group as fish (see `ps -o pid,pgid,comm`).

For some reason pressing ctrl-c inside the VSCode integrated terminal with
fish as the default shell kills the wl-copy process, thus clearing the
clipboard. On other terminals it works fine.

This is also reproducible by running "echo foo | wl-copy" ctrl-v ctrl-c ctrl-v
(the second ctrl-v does not paste because wl-copy was killed).

Work around this for now by running wl-copy asynchronously, and disowning it.
This seems to fix it though I really don't know why. Alternatively we could
"setsid" but that's technically not available on BSD.

For some reason this works in Bash. We should strace it to figure out why.
2024-04-21 14:34:41 +02:00
Johannes Altmanninger
c9793711dc Remove stale mention of plus key name 2024-04-20 15:36:29 +02:00
Johannes Altmanninger
334946af61 completions/complete: add --escape 2024-04-20 13:34:08 +02:00
Johannes Altmanninger
e571774c97 Make alt-d on empty commandline call dirh again
alt-d used to do that until evil merge[*] 213e90704 (Merge remote-tracking branch
'upstream/master' into bind_mode, 2014-01-15) which changed the order of
the \ed bindings such that the smart dirh version would be shadowed by the
simpler ones.

[*] git blame alone failed to find it because it skips merge commits.
2024-04-20 12:11:30 +02:00
Johannes Altmanninger
2e42d80dc9 completions/scp: silence error on unexpected version
There seem to be versions of ssh (possibly not from OpenSSH) that don't
print the version number in -V, so make sure not to pass an empty string as
numeric arg to test.

Fixes #10445
2024-04-17 09:52:12 +02:00
Johannes Altmanninger
9af6a64fd2 Fix bad contrast in search match highlighting
This is another problem that has been bothering me for years: as mentioned
in 1dd901e52 (Maintain cursor in history prefix search, 2024-04-12), up-arrow
search highlights search matches but the contrast is really bad, especially in
command position, because the search matches --background=brblack is combined
with whatever foreground syntax highlighting the command has.  The history
pager had a similar problem (for the selected history item) but circumented
it by disabling syntax highlighting altogether for the selected item.

fish_color_search_match's foreground component is ignored.
Let's use it instead of syntax highlighting.

This fixes the contrast on some default colorschemes but the bryellow
foreground looks weirdly like an error/warning on some terminals.  Change it
to white. This needs a hack because we don't have a canonical way to tell
if a uvar has been set by the user. Fortunately the foreground component
hasn't been used at all so far, so we're not so much changing it as much as
initializing it.
2024-04-15 09:40:21 +02:00
Johannes Altmanninger
a37629f869 fish_clipboard_copy: indent multiline commands
See also the earlier commits.

Closes #10437
2024-04-15 09:20:44 +02:00
Johannes Altmanninger
611a0572b1 builtins type/functions: indent interactively-defined functions
This means that in case no editor is defined, "fish_indent" is now required
to fix the indentation.

Fixes #8603
2024-04-15 08:32:31 +02:00