Commit Graph

5085 Commits

Author SHA1 Message Date
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
Johannes Altmanninger
222673f339 edit_command_buffer: send indented commandline to editor
Indented multiline commandlines look ugly in an external editor.  Also,
fish doesn't properly handle the case when the editor runs fish_indent.
Fix is by indenting when exporting the commandline and un-indenting when
importing the commandline again.

Unindent only if the file is properly indented (meaning at least by the
amount fish would use).  Another complication is that we need to offset
cursor positions by the indentation.

This approach exposes "fish_indent --only-indent" and "--only-unindent"
though I don't imagine they are useful for others so I'm not sure if this
is the right place and whether we should even document it.

One alternative is to add "commandline --indented" to handle indentation
transparently.
So  "commandline --indented" would print a indented lines,
and "commandline --indented 'if true' '    echo'" would remove the unecessary
indentation before replacing the commandline.
That would probably simplify the logic for the cursor position offset.
2024-04-15 08:32:31 +02:00
Johannes Altmanninger
47a446ae18 Teach fish_indent to only indent and unindent
To be used in the following commits.
2024-04-15 08:32:31 +02:00
Anurag Singh
c044d5e3f0 add history append subcommand 2024-04-15 08:31:16 +02:00
Adam J. Stewart
6f408211a1
Add ruff completions (#10440)
* Add ruff completions

* Automatically generate and cache
2024-04-14 13:29:10 +02:00
Johannes Altmanninger
00432df420 Trigger abbreviations after inserting process separators
On

    a;

we don't expand the abbreviation because the cursor is right of semicolon,
not on the command token. Fix this by making sure that we call expand-abbr
with the cursor on the semicolon which is the end of the command token.
(Now that our bind command execution order is less surprising, this is doable.)

This means that we need to fix the cursor after successfully expanding
an abbreviation. Do this by setting the position explicitly even when no
--set-position is in effect.

An earlier version of this patch used

    bind space self-insert backward-char expand-abbr or forward-char

The problem with that (as a failing test shows) was that given "abbr m
myabbr", after typing "m space ctrl-z", the cursor would be after the "m",
not after the space.  The second space removes the space, not changing the
cursor position, which is weird.  I initially tried to fix this by adding
a hack to the undo group logic, to always restore the cursor position from
when begin-undo-group was used.

    bind space self-insert begin-undo-group backward-char expand-abbr end-undo-group or forward-char

However this made test_torn_escapes.py fail for mysterious reasons.
I believe this is because that test registers and triggers a SIGUSR1 handler;
since the signal handler will rearrange char events, that probably messes
with the undo group guards.

I resorted to adding a tailor-made readline cmd. We could probably remove
it and give the new behavior to expand-abbr, not sure.

Fixes #9730
2024-04-13 20:11:11 +02:00
Johannes Altmanninger
6858f1100a Remove redundant raw CSI u bindings 2024-04-13 14:36:11 +02:00
Johannes Altmanninger
1d98846e03 Remove some redundant raw bindings
We already decode these, see parse_csi() and parse_ss3().
2024-04-13 14:36:11 +02:00
Lia Lenckowski
90cffb18a1 complete brightnessctl flags 2024-04-12 12:53:55 +02:00
Johannes Altmanninger
9158395d10 Fix __fish_list_current_token and friends for multiline commandlines
Some of these handled multiline prompts but not multiline command lines. We
first need to move the cursor to the end of the commandline, then we can
print a message.  Finally, we need to move the cursor back to where it was.
2024-04-12 12:00:24 +02:00
Johannes Altmanninger
5c3a0251b7 funced: don't try to source interactive-only function
Regressed in 2c2ab0c1f (Always `source` file after `funced` (#10318),
2024-02-22) which was only intended for functions that are backed by a file.
2024-04-12 11:27:55 +02:00