Commit graph

4698 commits

Author SHA1 Message Date
Mahmoud Al-Qudsi
d0240e0fa0 fish_config: Pluralize $dir -> $dirs
It's a variable that holds all potential directories. The old name
makes it confusing to look at some of its usage sites and figure out
what is actually going on because they make no sense if $dir is only one
entry.
2022-10-22 13:23:44 -05:00
Mahmoud Al-Qudsi
201a0d7319 Persist all color-like variables in fish_config theme save
Don't just save known color values but any values that could have been loaded
from a .theme file.

Also, refactor the theme variable name whitelist/filter in a shared "global"
variable so we never forget to update it at any of the individual use sites.
2022-10-22 13:20:12 -05:00
Mahmoud Al-Qudsi
22332b892d Fix fish_config theme save
The documentation states that running `fish_config theme save` after
`fish_config theme choose [theme_name]` will result in "saving" the
currently chosen theme, but this does not match the actual behavior of
`fish_config theme save` which expects a trailing argument specifying
the name of the theme to select/persist.

Given that the documented way has been included in a release and that it
makes more sense than calling `fish_config theme save xxx` when you are
*loading from* xxx and not *saving to* xxx, this patch revises
`fish_config.fish` to support the documented behavior.

When `fish_config theme save xxx` is used, xxx is loaded w/ its specified colors
saved to the according variables in the universal scope. But if `fish_config
theme save` is used without a theme's name specified, then the currently
specified (known) fish color variables are persisted from whatever scope they're
currently in (usually in the global scope from previewing a theme) to universal
variables of the same name.

This does *not* catch color variables unknown to fish! If a theme and a
prompt agree on some variable to hold some color but it's not a color variable
known to fish, it won't be persisted!

Closes #9088.
2022-10-22 13:19:59 -05:00
Clément Martinez
eeaf342426
Add nvme completions 2022-10-22 17:16:14 +01:00
Aaron Gyes
53cb3a98fc fish_apropos: manpath instead of man --path
On macOS Ventura, `man` does not take --path
2022-10-21 15:20:57 -07:00
Fabian Boehm
8c362c89b5
git prompt: Interpret values of "1", "yes" or "true" as true for bools instead of relying on defined-or-not (#9274)
This allows explicitly turning these settings off by setting the variable to e.g. 0.

See #7120
2022-10-21 20:22:20 +02:00
Rocka
f3372635fa completions: fix qdbus property completion 2022-10-21 18:30:54 +02:00
pagedown
ad55a55734 completions/unzip: Silence stderr 2022-10-21 18:29:14 +02:00
exploide
fa932533f2 completions john: redirect stderr to avoid errors 2022-10-19 20:17:58 +02:00
Fabian Boehm
29778ee845 fish_clipboard_copy/paste: Handle redirected stdout/stdin
This makes these tools usable in a pipe.

You can run

```fish
some-long-command | fish_clipboard_copy
```

to copy some command's output to your clipboard, and

```fish
fish_clipboard_paste | some-other-command
```

To feed your clipboard to some command.
2022-10-19 20:10:26 +02:00
Fabian Boehm
054f9baf88 Add a fish_delta helper function
This helps figuring out which functions, completions and config you've overridden.
2022-10-19 20:06:35 +02:00
Fabian Boehm
3ba1170ca5 Store the vendor directories in global variables
This lets us query them later, which helps with fish_delta
2022-10-19 20:06:35 +02:00
Fabian Boehm
f3444bd0cb Check for less before calling it 2022-10-18 18:05:16 +02:00
Fabian Boehm
c84e2eeac1 completions/git: Fix option
This was typoed in bef706b8f1
2022-10-14 23:14:49 +02:00
Mahmoud Al-Qudsi
acb77ad1a3 completions/git.fish: Sort in order of likelihood
In the presence of modified files, assume `git checkout ...` is being
invoked/completed with the intention of restoring modifications. Even if not the
case, this list is likely going to be shortest if someone is about to change
branches.

Afterwards, list branches (with local branches sorted by recency), then remote
unique remotes, heads, tags, and recent commits. The order of these last four
is up for debate, and honestly if any of them generate a lot of results it makes
finding what you're actually looking for in the autocompletions a lot harder.

It may be better to merge these last contenders and sort them by individual
recency instead, but that does make the pager entries rather messy (and we would
need to add a new function to do that in order to interleave them in the desired
sort order but preserve the overall sort after the completions subshell
terminates).
2022-10-14 15:29:46 -05:00
Mahmoud Al-Qudsi
bef706b8f1 completions/git.fish: always group -k with -a
It's really hard to see where -k is applied to git completions, so always group
it with -a to make it more consistent and easier to spot.

There should be no functional changes in this commit.
2022-10-14 15:20:41 -05:00
Bart Libert
759ca16b37
completions: Add dua (#9277) 2022-10-14 18:52:14 +02:00
Kjetil Thuen
c3052a6218
Add clojure completions (#9272)
* Add clojure completions

* More ideomatic fish code

* Clojure completions in separate file

* Aboid use of psb using bb -e

* Return early when bb can not be found

* Remove superflous escape

* Another superflous escape
2022-10-14 18:50:47 +02:00
Alexander Sieg
8f394f5771
Add completions for direnv (#9268)
* Add completions for direnv

* Update share/completions/direnv.fish
2022-10-14 18:48:38 +02:00
Mahmoud Al-Qudsi
22f6668914 completions/cargo.fish: Drop removed subcommand
`describe-future-incompatibilities` is no longer a supported subcommand. It was
also never something very popular so we don't have to worry about older
versions.

[ci skip]
2022-10-13 12:38:41 -05:00
Mahmoud Al-Qudsi
835230a82f fish_config: Fully erase existing globals before replacing
We only erase existing globals for some of the theme-related variables
but not for all the `known_colors`, causing `fish_config` to still emit
warnings for these if saving a theme choice after trying it.
2022-10-12 21:21:25 -05:00
Fabian Boehm
1e7a4b076d vi-mode: Bind "/" to history-pager
This is unused currently, so we can just use it here. Ctrl-s as the
inverse stays because that's shared.

Fixes #2271
2022-10-11 17:47:13 +02:00
Charles Maher
1dd8a113f2
Add feature to fish_commandline_prepend and fix minor issue (#9261)
* Prepending will now respect leading spaces instead of doubling it up.
* Removing a prefix no longer sends the cursor to the end of the line.
2022-10-06 14:27:28 -05:00
Gustavo Costa
62794446b7 Add asciinema completions 2022-10-05 18:53:54 +02:00
Sergei Shilovsky
e274ef6c0d
commandline --selection-start and --selection-end implementation
Fixes #9197
2022-10-05 18:51:00 +02:00
Mahmoud Al-Qudsi
82b78cfdbe Add missing -k to git completions
This is made much harder than it has to be by the fact that -k (where specified)
may be in any of a million different places, including as the first parameter,
as -ka, as a random standalone parameter, or tagged on to some other parameter
elsewhere; making it difficult to tell where it's actually missing!

Next job: automate cleaning up the order of arguments in this completions file.
2022-10-04 13:06:15 -05:00
Collin Styles
a5764663e7 Exclude current directory ('.') from rsync completions
Completing to '.' isn't useful and just gets in the way.
2022-10-04 12:53:17 -05:00
Fabian Boehm
e4f07fe010 Stop using alias for fish_indent/fish_key_reader 2022-10-04 17:01:19 +02:00
Mahmoud Al-Qudsi
cdfa76221e Completions: Adjust apt-cache output limit
The limit has been reduced to 2500 to match the limit on what we actually
consume downstream in the actual `complete -c apt ...` rule, as discussed [0].

[0]: https://github.com/fish-shell/fish-shell/commit/b88b2577267c6837886c93c
2022-10-03 18:31:40 -05:00
NextAlone
ef844a63b9
completion/adb: rework completions (#9233)
* add adb options

only complete device serial when space after '-s' option

* keep current `adb -s` completion

* add adb reboot fastboot

* only show tcp/ip devices for disconnect

Signed-off-by: Next Alone <12210746+NextAlone@users.noreply.github.com>

* fix: files not complete when options given

Signed-off-by: Next Alone <12210746+NextAlone@users.noreply.github.com>

* fix: use old-style options for adb generic options

Signed-off-by: Next Alone <12210746+NextAlone@users.noreply.github.com>

Signed-off-by: Next Alone <12210746+NextAlone@users.noreply.github.com>
2022-10-01 11:21:52 -05:00
NextAlone
794926d28e
completion/completions: use string match to detect usbip remote
* completion/usbip: use string-match to detect remote (#9250)

* simplify output

Signed-off-by: Next Alone <12210746+NextAlone@users.noreply.github.com>

Signed-off-by: Next Alone <12210746+NextAlone@users.noreply.github.com>
2022-10-01 11:19:29 -05:00
Mahmoud Al-Qudsi
40a0ea9bea Completions: sort local git branches by recency
I have about fifty git branches for fish and I almost always `git checkout`
between the most recent two or three - this makes the completions list more
usable. If you're using `git cherry-pick` or `git merge`, etc. you also most
likely to want to reference a recently changed branch.

The decision was made to only sort local branches and not remote ones in the PR
at #9248.

The performance of changing from one `git for-each-ref` invocation to two
separate ones (so we could sort them separately) was checked and found to be OK.

Food for future thought: consider ergonomics, caveats, and performance of
excluding the current branch's name from the list of completions (or perhaps
only from the first completion). Or maybe there's another way to have
`for-each-ref` give priority to a different branch while still sorting by
recency?
2022-09-30 19:05:27 -05:00
Mahmoud Al-Qudsi
6df57a6712 git completions: Change some default ASC/DESC for sort
Dates and file sizes are kept DESC while names, emails, and hashes are now
defaulted to ASC.
2022-09-30 15:09:14 -05:00
Mahmoud Al-Qudsi
d9bb91f1e1 git completions: fix spelling of committer everywhere
Some of the fixes are only for descriptions, others affect functionality.
2022-09-30 15:08:32 -05:00
Mahmoud Al-Qudsi
ce451f67c5 Suggest arguments for recently added git rebase --onto
It takes a wide variety of values, but I think branches are probably the most
common payloads. We can also include recent commits?
2022-09-29 16:57:23 -05:00
NextAlone
ffdef493c5
completion: add git rebase --onto (#9244)
Signed-off-by: Next Alone <12210746+NextAlone@users.noreply.github.com>
2022-09-29 15:34:47 -05:00
NextAlone
d065ea31a9
completion/usbip: don't use old-style completions (#9243) 2022-09-28 20:37:46 -05:00
Mahmoud Al-Qudsi
072dbfd6ed Remove __fish_seen_argument_from
Despite its somewhat misleading name, `__fish_seen_argument` can already handle
multiple arguments in one go and doesn't need a wrapper function!
2022-09-27 18:49:22 -05:00
Mahmoud Al-Qudsi
77941ea823 Completions: add git xxx --sort completions
The list of subcommands that emit a list of refs when executed bare may or may
not be complete; I just put the ones I know of.
2022-09-27 14:19:37 -05:00
Mahmoud Al-Qudsi
725c720d3d Completions: add git for-each-ref subcommand and its arguments 2022-09-27 14:19:37 -05:00
Mahmoud Al-Qudsi
1501693949 Add __fish_seen_argument_from wrapper
There are a million existing ways of skinning this cat, but it's a good parallel
to `__fish_seen_argument` to have, in a similar vein to
`__fish_seen_subcommand_from`.
2022-09-27 14:19:37 -05:00
Mahmoud Al-Qudsi
0cccbfcaaa Extend __fish_seen_argument to support raw arguments
This allows it to just directly match any literals (passed after `--`) without
treating them as pre-processed short/long/old arguments.
2022-09-27 14:19:37 -05:00
Fabian Boehm
5d5709b859 completions/ls: Remove dubious old-style option
Confirmed on NetBSD: The `ls -o` option groups. I tested `ls -gon` and
it didn't give an error.

It's quite suspect that this one option couldn't be grouped, so I'm
assuming this was a typo.
2022-09-26 21:31:21 +02:00
Fabian Boehm
47a4eeff99 completions/kcmshell5: Silence stderr
This can print errors about .desktop files not being 100% correct.

Like those shipped by KDE, with krunner.
2022-09-26 20:43:31 +02:00
Fabian Boehm
23bf98e6bb Remove unused __fish_cursor_1337 function
Last use removed in 011af34d62
2022-09-26 17:20:33 +02:00
Fabian Boehm
011af34d62 fish_vi_cursor: Use xterm sequence for iterm
This has been supported since 2012, allows blinking cursors and works
in tmux.

Fixes #9172
Fixes #3741
2022-09-26 17:06:14 +02:00
Fabian Boehm
42602ba4fc
completions/ffmpeg: Add missing parenthesis
Going by the other `string match`, this appears to just be missing a ")".

Fixes #8514
2022-09-26 15:11:58 +02:00
Ryuhei Yoshida
51177ef0ae Fix completions/tox 2022-09-26 09:45:54 +02:00
NextAlone
4b9c7fa534
Add usbip completions
Closes #9237
2022-09-25 15:30:34 -05:00
Fabian Boehm
b88b257726 Stringify apt completions again
Commit 09685c3682 tried making the apt
completions faster by doing two things:

1. Introduce a limiting "head"
2. Re-replace our "string" usage with tr

Unfortunately, in doing so it introduced a few issues:

1. The "tr" had a dangling "+" so it cut apart package
   descriptions that contained a "+".
   This caused e.g. "a C++ library" to generate another completion
   candidate, "library".
2. In reusing "tr" it probably reintroduced #8575,
   as tr is not 8-bit-clean.
3. It filtered too early, on the raw apt-cache output,
   which caused it to fill up with long descriptions.
   So e.g. for "texlive" it would only generate 10 completions,
   where it should have matched 54 packages.

Because most of the speedup is in the "head" stopping early, we
instead go back to the old string way, but introduce a limiting "head"
after the "sed" (which will have removed everything but the package
name line and the first line of the description)

In my tests this is about ~10% slower than doing head early and using
tr, but it's more correct.

Admittedly I haven't been able to reproduce the 35s scenario that
09685 talks about, but the most likely cause of that is *apt-cache*
being slow - I don't see how string can be that much slower on another
system - and so it will most likely also be fixed by doing head here.

Future possibilities here include:

1. Using "apt-cache search --names-only", which gives a much nicer
format (but only for non-installed packages - the search strings are
apparently ANDed?)
2. Switching to `string split`, possibly using NUL and using `string
split0`?
3. Introducing a `string --null-in` switch so we can get by with one
`string`
4. (multi-threaded execution so the `string`s run in parallel)
2022-09-23 15:37:40 +02:00
Mahmoud Al-Qudsi
09685c3682 Make apt completions useable once again
`apt-cache` is just so incredibly slow that filtering against the final results
just doesn't cut it. Attempting to match against 'ac.*' (already taking
advantage of changing short search terms into prefix-only matches) would take
35 seconds, all of bottlenecked before the filtering step. This change uses more
of a heuristic to filter `apt-cache` results directly (before additional
filtering) to speed things up.

A variety of different limits from 100 to 5000 were timed and their result sets
compared to see what ended up artificially limiting valid completions vs what
took too long to be considered functional/usable and this is where we ended up.
2022-09-22 13:43:38 -05:00
Fabian Boehm
af3a5b86d8 Call __fish_config_interactive also for interactive read
Not doing this results in our emergency keybindings being set up for
`read`.

Fixes #9227
2022-09-21 17:02:25 +02:00
NextAlone
549958a7ea
add adb logcat completions (#9219)
* add adb logcat completions

and suppress adb devices file completions

* fix lost space
2022-09-19 17:52:09 +02:00
NextAlone
404cee579b add fastboot oem subcommand completions 2022-09-19 17:51:40 +02:00
Mahmoud Al-Qudsi
c2155b770d [completions] Handle errors thrown by gh
`gh` doesn't write its errors to stderr and doesn't exit with a non-zero status
code in case of failure. The completions are short enough that buffering them
isn't a huge deal.
2022-09-16 16:44:18 -05:00
Fabian Boehm
309fae9a12 completions/pkginfo: Silence stderr 2022-09-14 17:50:58 +02:00
Fabian Boehm
8621852ec5 completions/git: Unify sorting for using_command
This removes one more call
2022-09-12 21:01:03 +02:00
Fabian Boehm
795e618864 completions/git: Check for stash separately
This cuts down `__fish_git_using_command` calls from 75 to 68, saving
some time in the common case.

(it would be possible to remove the check from
`__fish_git_stash_using_command` now, but that's brittle and it's one
call, so it's not a big issue)
2022-09-12 20:59:33 +02:00
Fabian Boehm
5844353e85 completions/git: Fix apply --apply
This used the wrong function
2022-09-12 20:59:33 +02:00
Maxime Bouillot
d50e9ffff3
Add the possibility to ignore arguments in alliases (#9199)
* Replace ";" with "\n" in alias-generated functions

This can let us add a "#" in our aliases to make
them ignore additional arguments.

* Update changelog about aliases that ignore arguments

* Update test for alias.fish

This is now compliant with the aliases that can
ignore arguments.
2022-09-11 09:55:11 +02:00
Fabian Boehm
a750b28eb4 funced: Use a read prompt *string*
This used a prompt command, but since the prompt was interpolated and
included a `?` it would be run as a glob without qmark-noglob.

Since it's simpler to pass a prompt string, just do that.
2022-09-10 17:42:16 +02:00
Fabian Boehm
7f1e9bf57f Also convert fish_job_summary 2022-09-09 18:49:57 +02:00
Fabian Boehm
d5db260375 Use string shorten for git
This checked the locale, but did so in a way that's fundamentally
broken:

1. $LANG isn't the only variable ($LC_ALL and $LC_CTYPE)
2. Even if $LANG is set that doesn't mean it's actually working

We could add a `status is-multibyte` here to figure out if we have a
multibyte locale?

But instead, since this is dealing with adding an ellipsis, let's just
add it to `string ellipsize`.

One slight difference is that shortening the branch now counts the ellipsis width.

I.e. assuming the branch is "long-branch-name"

```fish
set -g __fish_git_prompt_shorten_branch_len 8
```

might now print "long-br…" instead of "long-bra…". This is nicer because we can now give the actual maximum width.

The alternative is to add a "--exclusive" option to "string ellipsize" that doesn't count the ellipsis width. So `string ellipsize --char "..." --max 8" long-branch-name` might result in "long-bra...", which is 11 wide.
2022-09-09 18:49:57 +02:00
Fabian Boehm
41c22d5e60 Add string shorten
This is essentially the inverse of `string pad`.
Where that adds characters to get up to the specified width,
this adds an ellipsis to a string if it goes over a specific maximum width.
The char can be given, but defaults to our ellipsis string.
("…" if the locale can handle it and "..." otherwise)

If the ellipsis string is empty, it just truncates.

For arguments given via argv, it goes line-by-line,
because otherwise length makes no sense.

If "--no-newline" is given, it adds an ellipsis instead and removes all subsequent lines.

Like pad and `length --visible`, it goes by visible width,
skipping recognized escape sequences, as those have no influence on width.

The default target width is the shortest of the given widths that is non-zero.

If the ellipsis is already wider than the target width,
we truncate instead. This is safer overall, so we don't e.g. move into a new line.
This is especially important given our default ellipsis might be width 3.
2022-09-09 18:49:57 +02:00
exploide
3e3996c9a5 completions pipenv: made pipenv completions compatible with recent versions
pipenv switched from older click-completion package to new built-in completions
from click framework in v2021.11.9.
This command achieves compatibility with both, older and more recent versions.
2022-09-09 18:47:24 +02:00
exploide
15a89718ae completions: improved resolvectl completions and complete arguments 2022-09-09 18:46:25 +02:00
NextAlone
7de0b6410d update fastboot reboot subcommand 2022-09-09 18:45:58 +02:00
EJ
1d1a3d6e82
Add fortune completions (#9177)
* Add fortune completions

Add -r for required parameters

* add updates to changelog
2022-09-07 09:46:45 +02:00
杉山 恒始
01c8654459
fix completions for tcpdump (-w and -r option) (#9175)
* fix completions for tcpdump (-r option)

* fix completions for tcpdump (-w option)
2022-09-07 09:45:24 +02:00
Fabian Boehm
612e66af0f prompt_pwd: Escape $HOME
This is used with a regex, so if it contained any metacharacters
they'd be used.
2022-09-04 09:18:57 +02:00
Fabian Boehm
f9a5d4ec7f Remove useless use of awk 2022-09-02 13:28:11 +02:00
Fabian Boehm
d0fe3fcb5a Add missing "--"
The current token is often an option, and it shouldn't spew.

Also silence stderr for `cargo search` in case lookup fails.
2022-09-02 13:00:47 +02:00
Mahmoud Al-Qudsi
9466ff2a22 Provide dynamic completions for cargo {add,install}
`cargo search` can be used to quickly get crates matching a search string, so we
can pass the current token for first-arg completions to `cargo add` and `cargo
install` to `cargo search` to look up matches.

`cargo search` doesn't restrict itself to (nor prioritize for) prefix matches,
while fish will only display prefix matches (for dynamically generated
completions) so it's perfectly possible for `cargo search foo` to return 20
results none of which will successfully result in a completion, but for a
further-narrowed completion of `cargo install foob^I" to then result in
completions because `cargo search` ended up returning a prefix match for `foob`
while it didn't for `foo`.

The only other oob cargo subcommand that takes a crate name (that isn't the name
of a crate specified in `Cargo.toml`) is `cargo search` but there's no point in
providing completions to that... I think (it's possible to search for crate
"foo" in order to get its latest version number rather than its name, but I'm
not sure that's worth supporting).
2022-09-01 13:56:59 -05:00
Mahmoud Al-Qudsi
db92109db5 Support top-level completion of user-installed cargo subcommands
This expands completions of `cargo^I` to list any commands named `cargo-xxx` as
cargo subcommands invokable as `cargo xxx` in addition to the default oob
subcommands cargo ships with.

(This is very similar to how git allows users to shim their own subcommands.)

NOTE: This would stay even after cargo someday moves to clap and generates or
even ships/installs an official machine-generated `cargo.fish` completions
script.
2022-09-01 12:22:31 -05:00
Aaron Gyes
147105744e I ommitted a newline here
in 98692e0309
2022-08-31 22:15:56 -07:00
Weihang Lo
b796716901 Remove non-existing cargo subcommand
The old way of generating cargo completions no longer work, so we need
to manually maintain the completions until clap completions support[1].

[1]: https://github.com/clap-rs/clap/issues/3166
2022-08-31 17:35:52 -05:00
Fabian Boehm
07b2f1054b disco prompt: Pad hash
It's possible cksum returns less than 3 full bytes, so let's just turn the
ones we don't get into 0

Fixes #9164
2022-08-27 16:38:36 +02:00
Fabian Boehm
ec8a7d09c6 completions/ant: Replace bogus realpath usage
This used `realpath -eq`, which for GNU realpath:

1. Suppresses "most error messages" (-q)
2. Requires that all parts exist (rather than allowing the last not
to)

Since we don't actually need a real path here, just filter.

Fixes #9099
2022-08-25 19:01:41 +02:00
bagohart
106e030096
added completions for sad (#9145)
* added completions for sad and added note in changelog

* ran fish_indent on completion file

* split -h and --help into two distinct completion options
2022-08-25 13:20:15 +02:00
Fabian Boehm
6581362e1e Remove debug-stack-frames from fish completions
This was broken in the move to FLOG.

Fixes #9155
2022-08-24 20:03:46 +02:00
Kid
ada9251412 More consistent --help description 2022-08-19 20:50:27 +02:00
Kid
7afd44eac8 Group string sub flags 2022-08-19 17:40:49 +00:00
Kid
d8e0cbb759 Missing -q/--query flag for builtin 2022-08-19 17:30:51 +00:00
Kid
a6a9a7cc6d Missing -v flag for command --search 2022-08-19 17:30:32 +00:00
Kid
1727ed7b5f Missing completions for builtins 2022-08-19 17:29:57 +00:00
Aaron Gyes
98692e0309 Erase __fish_config_interactive after we run it. It's yuge. 2022-08-15 11:30:47 -07:00
Aaron Gyes
8416a52255 Make skeleton dir/config file create a one-time initialization thing
This moves the stuff that creates skeleton/boilerplate files to
the same place we initialize uvars for the first time or on upgrade.

Being a bit less aggresssive here theoretically makes launch a little
lighter but really I personally just found it weird I couldn't
just delete my empty config.fish file without it getting recreated
and sourced every launch.
2022-08-14 07:11:50 -07:00
Aaron Gyes
ce55114e38 git completion: use fancy ellipsis
A recenty commit was loathe to assume the unicode ellipsis character
was safe so just used '..' instead. However I noticed we actually
already do use that character elsehwere in the completions.

So, just make both spots try to somewhat carefully use it.
We do this same `string match` check on LANG in fish_job_summary.fish
2022-08-13 18:02:20 -07:00
Andy Hall
02fcc50b9a Fix typo in completions/port.fish
Replace "Specfiy" with "Specify".
2022-08-13 15:34:16 +02:00
exploide
ff716aba7f completions ip: added rudimentary completions for ip route 2022-08-13 15:31:48 +02:00
exploide
d4f142ac15 completions ip: added completions for ip link delete and some global options 2022-08-13 15:31:48 +02:00
exploide
b5e746cbd4 completions ip: remove base interface suffix for VLAN-enabled interfaces
When adding a VLAN-enabled interface, it is named like enp0s31f6.100@enp0s31f6
with the physical interface being appended behind an @.
But subsequent ip commands operate on the interface name without this suffix,
so it needs to be removed when completing interface names in __fish_ip_device
2022-08-13 15:31:48 +02:00
exploide
1f5b0895fe completions dhcpcd: improved completions 2022-08-12 20:46:58 +02:00
pagedown
9c16677706 help: Handle the missing builtin aliases : and [ 2022-08-12 20:45:20 +02:00
Fabian Boehm
96a064d679 share/config.fish: Fix outdated comment 2022-08-11 17:07:59 +02:00
Fabian Boehm
e3f6b8ba17 completions/git: Reword descriptions
These should be friendlier, but aren't as pedantically accurate.

I think the term "index" is terrible and much prefer "staging area".

Also "rev-parse" simply must be believed to be seen, it can't be
described in a single paragraph. (did you know you can use `git
rev-parse --parseopt` as a replacement for `getopt` in arbitrary
shell scripts?)
2022-08-10 17:52:27 +02:00
Fabian Boehm
47ae6bc746 Webconfig: Fix IPv6 availability detection
"socket.has_ipv6" is basically useless - it tells you python has
been *compiled* with ipv6 support.

Instead just try ipv6 and if that fails with EAFNOSUPPORT (checking
the actual errno), try v4.

Yes, I explicitly do not care to test this on python2.

Fixes #3857
2022-08-09 20:33:32 +02:00
Fabian Boehm
fcbd9730de completions/git: Shorten alias descriptions
I have an alias called "lg" for

log --color --graph --pretty=format:\'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset\' --abbrev-commit --first-parent

Having that in my completions ensures that git commands essentially
always use one column at most. That's not great, so we now shorten it
to 35 chars (plus an annoying 2 for ".." because I can't be bothered
to check for unicode support - an argument for a "string ellipsize", I guess?)
2022-08-09 20:19:33 +02:00
Kevin Konrad
6128b58be6 add completion for kind
Closes #9110
2022-08-09 18:58:22 +02:00
Daanturo
08a48af356 Add Firefox completions 2022-08-09 18:54:49 +02:00
Christopher Phillips
275eb9d218 move new $PATH detection only inside WSL 2022-08-08 20:58:48 +02:00
Christopher Phillips
aba62c2211 add safe $PATH lookup; update powershell regex 2022-08-08 20:58:48 +02:00
Christopher Phillips
6e6085a623 Update -z statement to remove close paren error 2022-08-08 20:58:48 +02:00
Christopher Phillips
d20554e343 Revert -z statement in help.fish
A recent commit added an invalid expression to the help.fish script. The
"-z" flag caused the error: "test: Missing close paren at index 11"
2022-08-08 20:58:48 +02:00
Christopher Phillips
8e3e50f9ee Add powershell support to suppress UNC path error
Prefer using powershell.exe over cmd.exe on wsl to supress terminal error:
"CMD.EXE was started with the above path as the current directory"
2022-08-08 20:58:48 +02:00
database64128
f6e3f4db34 cp completions: reflink's arguments are optional
When no arguments are unspecified, `--reflink` is equivalent to `--reflink=always`.
2022-08-08 10:18:40 +02:00
Johannes Altmanninger
7fb4b7c8bd prompt_pwd: stop clobbering global/universal fish_prompt_pwd_full_dirs
Closes #9123
2022-08-07 20:24:51 +02:00
Aaron Gyes
d1f08d4944 Revert "vagrant completions: use __fish_parent_directories"
This reverts commit 7c1b68516d.
2022-08-03 00:34:32 -07:00
Aaron Gyes
7c1b68516d vagrant completions: use __fish_parent_directories 2022-08-02 22:31:23 -07:00
Aaron Gyes
e45b3abab2 test -z 2022-08-02 00:54:38 -07:00
Aaron Gyes
ff2999ef2b Three more of the same test -z thing. 2022-08-02 00:42:37 -07:00
Aaron Gyes
b9590d04e7 fish_toggle_commandline: minor test cleanup 2022-08-02 00:30:06 -07:00
Aaron Gyes
df51fea897 git completion: use new test -ef
Just an opportunistic little cleanup. Technically faster.
2022-08-02 00:15:50 -07:00
Johannes Altmanninger
88d1317eaa completions/git: forward a ./-prefix from the command line
"git add ./" shows only hidden files (if at all). It should show all files
that can be added.
The problem is that candidates come from "git status" which prints clean
relative paths. Let's allow some unclean paths.

This is far from a complete fix but it should work for the common scenario.

Observe that wildcard_complete_internal() actually filters out all non-hidden
files, if the query is `./`.

Closes #9091
2022-07-31 00:14:51 +02:00
Johannes Altmanninger
dcff0a2f2b Add Control+R incremental history search in pager
This reimplements ridiculousfish/control_r which is a more future-proof
approach than #6686.
Pressing Control+R shows history in our pager and allows to search filter
commands with the pager search field.

On the surface, this works just like in other shells; though there are
some differences.

- Our pager shows multiple results at a time.
- Other shells allow to use up arrow/down arrow to select adjacent entries
  in history. Shouldn't be hard to implement but the hidden state might
  confuse users and it doesn't play well with up-or-search, so this is
  left out.

Users might expect the history pager to use subsequence matching (fuzzy
matching) like the completion pager, however due to the history pager design it
uses substring matching.  We could change this in future, however that means
we would also want to change the ordering from "reverse-chronological" to
"longest common subsequence" (e.g. what fuzzy finders do), because otherwise
a query "fis" might give this ordering:

            fsck /dev/disk/by-partlabel/Linux\x20filesystem
            fish

which is probably not what the user wants.

The pager shows only a small number of history items at a time.  This is
because, as explained above, the history pager does not support subsequence
matching, so navigating it does not scale well.

Closes #602
2022-07-30 23:27:24 +02:00
Shun Sakai
13febcf54f
Add zig completion (#9083)
* Add `zig` completion

* Update CHANGELOG

* Update `zig` completion

* Fix `zig` completion

Change to enable filename completion on `zig cc` and `zig c++`.
2022-07-26 16:01:46 +02:00
Fabian Boehm
7425d85729 Silence zpool errors
This can print "internal error: failed to initialize ZFS library" on
NetBSD.

Let's just silence it.
2022-07-24 17:45:46 +02:00
Johannes Altmanninger
65a9983954 completions/tox: --no-provision takes an optional arg 2022-07-24 10:23:13 +02:00
Fabian Boehm
e6f4c9e162 completions/service: Fix output on OpenRC systems
This used `type -f`, which prints, and only silenced stderr.

Detected by running the check-completions test on Alpine.

It appears nobody does that.
2022-07-24 09:51:15 +02:00
Andy Freeland
0f13337ae6
Add autocomplete for tox (#9078)
* Add autocomplete for `tox`

Based on `tox --help` output for tox 3.25.1.

* PR feedback
2022-07-23 23:18:53 +02:00
Andy Freeland
dd815eef38
Add completions for dive (#9082)
https://github.com/wagoodman/dive
2022-07-23 22:32:35 +02:00
Fabian Boehm
a7af4a0307 Replace some uses of tr 2022-07-22 12:21:03 +02:00
Fabian Boehm
a6820cbe62 trap: Remove superfluous helper functions and stringify 2022-07-22 12:21:03 +02:00
Fabian Boehm
afe7e2d27f completions/rc-status: Fix missing "-d" 2022-07-20 21:28:57 +02:00
Fabian Boehm
1f0902a5f5 default prompt: Use same status color as default theme
This was weird, because it changed around just because you picked a
separate theme (that didn't have a status color).

Simply use the same color here.
2022-07-19 17:05:48 +02:00
Fabian Boehm
2dc1150e35 themes: Add missing colors from the default theme
These are used in prompts only, and it feels weird not to have them.

In practice, fish_color_host_remote would not be used at all (just
because you switched from the default theme!), while fish_color_status
would fall back on a different value.

That'll be adjusted in the next commit.
2022-07-19 17:03:00 +02:00
Fabian Boehm
ebd6b2cbd7 Sync default themes again
This takes the values from the .theme file.

In future we might think about re-using that, but for now it's too new
and seems brittle to depend on it.
2022-07-19 16:56:16 +02:00
Fabian Boehm
5dfb64b547
Add path mtime (#9057)
This can be used to print the modification time, like `stat` with some
options.

The reason is that `stat` has caused us a number of portability
headaches:

1. It's not available everywhere by default
2. The versions are quite different

For instance, with GNU stat it's `stat -c '%Y'`, with macOS it's `stat
-f %m`.

So now checking a cache file can be done just with builtins.
2022-07-18 20:39:01 +02:00
Wilke Schwiedop
d9ee5d3863 fix trailing comments in __fish_print_hostnames
/etc/hosts specifies, that everything after a #-character is to be
treated as a comment. The current __fish_print_hostnames however only
considers #-characters at the beginning of a line.
Thus the comment from following valid hosts-entry would end up in the
completion output:

1.2.3.4  myhost # examplecomment

getent hosts properly handles comments.
2022-07-17 17:39:58 -05:00
Aaron Gyes
e2fda67439 Adjust fish_color_search_match
Make the default more likely to be perceptible.
2022-07-17 15:20:41 -07:00
Aaron Gyes
a6ed9ace6a Add -ot, -nt, -ef to test completions
also complete filenames in binary cases

e.g. test path -ef path
2022-07-16 12:40:36 -07:00
Bagohart
ce6b122f7f added tab completions for choose 2022-07-16 21:40:02 +08:00
Bagohart
824ee5d70b added tab completions for navi 2022-07-16 21:36:12 +08:00
Aaron Gyes
a1dd93df41 Update touch completions for all the platforms
- Generally better descriptions,
- uname checks to not complerte unavailable options on
  NetBSD, FreeBSD, DragonFly, Solaris, Darwin
- Describe/complete GNU's --time=access,mtime... arg
- Remove -f it is a no-op and not documented.
2022-07-09 13:42:00 -07:00
Israel Chauca Fuentes
9e43e74723 Add completion for the "expect" command 2022-07-09 13:44:45 +02:00
Alexander M
8d57bc6a9a Fix long descriptions in gdb.fish
Work on #6981
2022-07-09 12:28:22 +02:00
Johannes Altmanninger
1527edd542 Stop printing extra newline when Alt-W or Alt-L is used with a multiline prompt
When we want to print something while the prompt is still active, we move the
cursor by printing a newline for each line in the prompt beyond the first
one. As established by 80fe0a7fc (fish_job_summary: Format message better
for multiline prompts, 2022-06-28), our use of "string repeat" actually
prints an extra newline. Let's remove it here as well.
2022-07-06 16:31:17 +02:00
Guy Bolton King
1f130fbfe1 Remove invalid trailing period in CSI u shift-space binding 2022-07-04 19:43:03 +02:00
Fabian Boehm
8082f8c056 completions/git: Use __fish_git
That's the one that silences stderr!
2022-07-03 09:42:37 +02:00
Kid
e6505d1c30 file completion nuances on macOS 2022-07-02 11:33:03 +02:00
Fabian Boehm
80fe0a7fcb fish_job_summary: Format message better for multiline prompts
This was supposed to be number of lines in the prompt minus 1, but
string repeat added one.

Also it triggered even in case of the stopped job message, which is
already repainted differently.

So we add it when we need to repaint ourselves.

As a bonus add a newline before in that case so the message isn't
awkwardly printed into the commandline.

Fixes #9044.
2022-06-28 18:03:09 +02:00
Fabian Boehm
842af06c5d completions/git: Cache subcommand v2
This is sort of slow because it's called hundreds of times.

We used to have a cache, introduced in ad9b4290e, but it was removed
in fee5a9125a because it had
false-positives.

So what we do, because the issue is that this is called hundreds of
times per-commandline, we cache it keyed on the commandline.

This speeds up `complete -C'git sta'` by a factor of 2.3x.
2022-06-27 17:15:30 +02:00
Johannes Altmanninger
fee5a9125a Revert "completions/git: cache subcommand computation"
Commit ad9b4290e optimized git completions by adding a completion that would
run on every completion request, which allows to precompute data used by
other completion entries. Unfortunately, the completion entry is not run
when the commandline contains a flag like `git -C`. If we didn't
already load git.fish, we'd error. Additionally, we got false positive
completions for `git diff -c`.

So this hack was a very bad idea. We should optimize in another way.
2022-06-26 23:02:26 +02:00
Rocka
c588bd5c5c completions: add qdbus completion 2022-06-25 21:59:57 +02:00
NextAlone
5642499dc2
feat: completion for reflector (#9027)
* feat: completion for reflector

* fix
2022-06-25 21:59:18 +02:00
mhmdanas
9f19ab1fba Prioritize APKs for adb install 2022-06-25 12:03:22 -07:00
exploide
459bbe208d scp completions: added new options 2022-06-25 12:02:19 -07:00
Fabian Boehm
a004a10a80 fish_git_prompt: Remove variables we don't care from event handler
This was called e.g. when showdirtystate was changed, but then checked
if it was called for the informative statusses only. Simply remove
them.
2022-06-21 20:22:27 +02:00
Fabian Boehm
b4a3b9982c Activate fish_vi_cursor for tmux
Discussions with the tmux maintainer show that:

1. We no longer need the passthrough sequence at all (and it's
deactivated by default)
2. Tmux can check if the outer terminal supports cursor shaping

Fixes #8981
2022-06-20 17:42:29 +02:00
Evan Lloyd New-Schmidt
a605bcb830 Show manpage for command under cursor
This commit lets you check the manpage for a leading command by moving
the cursor over it, matching the behavior of tab complete.

It also lets you select the man page for the base of a two-part command
like `string match`.

The additional regex case is added because
`commandline -t` returns an empty string when the cursor is after a
space, e.g. at the end of 'sudo ', which the later checks don't handle.

This diagram shows the manpage picked for different cursor positions:

    > sudo -Es time git commit -m foo
      +-------++---++--++------------+
      |       ||   ||  ||            |
      |       ||   ||  |+------------+
      |       ||   ||  |  git-commit
      |       ||   |+--+
      |       ||   | git
      |       |+---+
      |       | time
      +-------+
         sudo
2022-06-17 07:21:25 +02:00