Commit Graph

4845 Commits

Author SHA1 Message Date
Fabian Boehm
38b21fc1c7 completions/gcc: Shorten descriptions
Many of these are just entirely useless and I'm thinking of removing a
bunch of options.
2023-02-14 20:47:52 +01:00
mhmdanas
a67b089c89 completions/xbps-query: complete package name after -X 2023-02-14 20:32:33 +01:00
Fabian Boehm
4a8ebc0744 __fish_complete_path: Also use an empty command
This removes a weird `ls` call (that just decorates directories), and
makes it behave like normal path completion.

(really, this should be a proper option to complete)

Fixes #9285
2023-02-14 17:09:58 +01:00
Fabian Boehm
200095998a __fish_complete_directories: Use an empty command as the dummy
Fixes #9574
2023-02-14 17:09:58 +01:00
Jay
ce268b74dd
completions/trash-cli: add completions for trash-cli (#9560)
Add completions for trash-cli commands:
trash, trash-empty, trash-list, trash-put and trash-restore.

``trash --help`` are used to identify the executable in trash cli completion.
2023-02-13 12:10:55 -06:00
matt wartell
904839dcce fix 3 instances of old command substitution $() 2023-02-12 16:49:40 +01:00
Dmitry Gerasimov
c3a72111e9
completions/meson: rewrite meson completions (#9539)
Rewrite completions for meson to expose meson commands with their
options and subcommands. New completions are based on the meson 1.0.

Subcommands were introduced in meson 0.42.0 (August 2017), so new
completions will only work for versions after 0.42.0. At this moment,
even oldstable Debian (buster) has meson 0.49.2 -- which means it is
unlikely someone will be affected.

---------

Co-authored-by: Mahmoud Al-Qudsi <mqudsi@neosmart.net>
2023-02-11 17:58:45 -06:00
Fabian Boehm
7ac2fe2bd3 share/config: Erase on_interactive before doing __fish_config_interactive
This removes a possibility of an infinite loop where something in
__fish_config_interactive triggers a fish_prompt or fish_read event,
which calls __fish_on_interactive which calls
__fish_config_interactive again, ...

Fixes #9564
2023-02-11 14:15:44 +01:00
Fabian Boehm
24fb7ff67c completion/scons: Shorten descriptions 2023-02-10 21:10:05 +01:00
Fabian Boehm
4adb34d349 completions/dpkg-reconfigure: Don't run awkward things on source time
This wanted to get the default priority, and it ran a thing *at source
time*.

This can lead to a variety of errors and I don't believe it's all that
useful, so we remove it.
2023-02-10 20:58:58 +01:00
Fabian Boehm
85504ca694 completions/zfs: Check for zpool
This is an additional tool, and this function is executed on source
time so we'd spew errors.

(also remove an ineffective line - it's probably *nicer* with the
read, but that's not what's currently effectively doing anything)
2023-02-10 20:55:37 +01:00
Fabian Boehm
7d7b72f995 Use path basename instead of basename
This is faster and guaranteed to be available
2023-02-10 20:51:22 +01:00
Fabian Boehm
7b8684e469 completions/netcat: Use path 2023-02-10 20:50:14 +01:00
Fabian Boehm
cac483c67a completions: Quote some tests 2023-02-10 20:47:49 +01:00
Fabian Boehm
6fe4b0c24d completions/kb: Fix 2023-02-10 20:46:34 +01:00
NextAlone
c587b2ffcc completions/fastboot: fix flash completion
Signed-off-by: NextAlone <12210746+NextAlone@users.noreply.github.com>
2023-02-09 20:44:12 -08:00
bagohart
ef07e21d40
Add separate completions for neovim (#9543)
Separate the neovim completions from the vim ones, as their supported
options have diverged considerably.

Some documented options are not yet implemented, these are added but
commented out.

Closes #9535.

---------

Co-authored-by: Mahmoud Al-Qudsi <mqudsi@neosmart.net>
2023-02-08 12:47:08 -06:00
Fabian Boehm
8ff78eddf0 man: Reroute ".",":","[" to the proper names
Fixes #9552
2023-02-07 19:23:26 +01:00
Fabian Boehm
f6b390dc61 completions/git: Remove a for-loop
This is an easy win for `git add ` completion time if we have multiple descriptions.

What happened was we did things once per description string, but the
things included a bunch of computation (including multiple `string`
calls and even a `realpath`!). Because these don't change, we can
simply do them once.

And it turns out we can just use a cartesian product:

for d in $desc
    printf '%s\t%s\n' $file $d
end

becomes

printf '%s\n' $file\t$desc
2023-02-06 21:49:07 +01:00
Mahmoud Al-Qudsi
96deaae7d8 completions/apt: Read from the dpkg cache directly
I have no idea why `apt-cache --no-generate show` is so slow since it basically
dumps the contents of the cache file located at `/var/lib/dpkg/status`. We are
technically bypassing any waits on the cache lock file so this may produce
incorrect results if the cache is being regenerated in the moment, but that's a
small price to pay and the results are likely confined to simply not generating
comprehensive results.

With this change, we no longer need to truncate results to the first n matches
and we no longer only print packages beginning with the commandline argument
enabling fish's partial completions logic to offer less-perfect suggestions when
no better options are available.

Even though we are generating more usable completions, we still trounce the old
performance by leaps and bounds:

```
Benchmark #1: fish -c "complete -C\"apt install ac\""
  Time (mean ± σ):      2.165 s ±  0.033 s    [User: 267.0 ms, System: 1932.2 ms]
  Range (min … max):    2.136 s …  2.256 s    10 runs

Benchmark #2: build/fish -c "complete -C\"apt install ac\""
  Time (mean ± σ):     111.1 ms ±   1.8 ms    [User: 38.9 ms, System: 72.9 ms]
  Range (min … max):   108.2 ms … 114.9 ms    26 runs

Summary
  'build/fish -c "complete -C\"apt install ac\""' ran
   19.49 ± 0.44 times faster than 'fish -c "complete -C\"apt install ac\""'
```
2023-02-05 16:30:34 -06:00
Mahmoud Al-Qudsi
6f3711902b completions/apt: Use is_first_token instead of seen_subcommand_from
I think this should be preferred for all subcommand completions because it
handles typos or subcommands we don't recognize better (`apt foo <TAB>` no
longer suggests subcommands since the subcommand position has been taken).
2023-02-05 16:15:15 -06:00
NextAlone
3604e8854b completion/adb: remove wait-for-device from subcommand detect
wait-for-device should not be used in subcommand detect, cause it is used as seperate command, following with others.
2023-02-05 12:13:45 +01:00
Branch Vincent
d69a290c2f completions: add pre-commit 2023-02-05 12:12:47 +01:00
Wout De Puysseleir
43a7c20ddb completions/mix: Add mix phx
- Added phx completions. These are very common completions for the Elixir Phoenix Framework.
  Documentation can be found here: https://hexdocs.pm/phoenix/1.7.0-rc.2/Mix.Tasks.Local.Phx.html#content
- Added argument completions
- Made all descriptions start with an uppercase for better consistency
- Update CHANGELOG.rst
2023-02-05 12:10:31 +01:00
nat-418
cf67709931
feat: add support for fossil-scm in prompt (#9500)
* feat: add support for fossil-scm in prompt

* fix: change directory testing and string matching
2023-01-29 16:54:39 +01:00
Fabian Boehm
177ce0d40e __fish_make_completion_signals: Check for "kill" 2023-01-29 14:44:59 +01:00
Fabian Boehm
dd7d432cd6 Only define kill wrapper if we have a kill to wrap 2023-01-29 14:44:45 +01:00
Johannes Altmanninger
243ade838b completions/git: also complete filepaths as second argument to git grep
Fixes a regression in f81e8c7de (completions/git: complete refs for "git
grep", 2022-12-08).

Fixes #9513
2023-01-28 21:25:42 +01:00
Johannes Altmanninger
befa240756 completions/git: use builtin path for finding subcommands
This is more elegant and efficient. No functional change.

As suggested by 2da1a4ae7 (completions/git: Fix git-foo commands, 2023-01-09).
2023-01-24 20:37:38 +01:00
Johannes Altmanninger
f033b4df7d completions/git: fix typo 2023-01-24 20:37:38 +01:00
Johannes Altmanninger
7c1c3f9f77 completions/git: do not use user input as format string
Suggested by f5711ad5e (git.fish: collapse repeat complete cmds, set -f,
rm unneeded funcs, 2022-10-27).
2023-01-24 20:37:38 +01:00
Johannes Altmanninger
72e9d02650 Revert "git.fish: collapse repeat complete cmds, set -f, rm unneeded funcs"
That commit did way too many things, making it hard to see the 5 regressions
it introduced. Let's revert it and its stragglers. In future, we could redo
some of the changes.

Reverts changes to share/completions/git.fish from

- 3548aae55 (completions/git: Don't leak submodule subcommands, 2023-01-23)
- 905f788b3 (completions/git: Remove awkward newline symbol, 2023-01-10)
- 2da1a4ae7 (completions/git: Fix git-foo commands, 2023-01-09)
- e9bf8b9a4 (Run fish_indent on share/completions/*.fish, 2022-12-08)
- d31847b1d (Fix apparent dyslexia, 2022-11-12)
- 054d0ac0e (git completions: undo mistaken `set -f` usage, 2022-10-28)
- f5711ad5e (git.fish: collapse repeat complete cmds, set -f, rm unneeded funcs, 2022-10-27)
2023-01-24 20:37:38 +01:00
Johannes Altmanninger
04cae2c559 completions/kak: show -debug arguments
Technically this is a |-separated list, we might need to teach __fish_append
to tokenize.
2023-01-24 20:37:38 +01:00
Johannes Altmanninger
29a3344226 Make bracketed paste add only one undo entry
Bracketed paste adds one undo entry unless the pasted text contains a '
or \.  This is because the "paste" bind-mode has bindings for those keys,
so they effectively start a new undo entry.

Let's fix this by adding an explicit undo group (our first use of this
feature!).
2023-01-24 20:32:13 +01:00
Fabian Boehm
21f1eebd01 completions/git: Some rewordings
These are the longest subcommand descriptions, so it gives us more space
2023-01-23 21:18:03 +01:00
Fabian Boehm
3548aae552 completions/git: Don't leak submodule subcommands
Introduced in f5711ad5ed through an unclean edit.
2023-01-23 21:17:53 +01:00
Fabian Boehm
01d681067c Bind ctrl-g to cancel as well
Classic emacs thing and the chord is so far unused.

Fixes #9484
2023-01-21 13:35:22 +01:00
Mahmoud Al-Qudsi
9b4c4ee7b6 Don't use sort for fail2ban-client completions
As pointed out by faho, the completions will be deduplicated by the completion
mechanics. We don't use this list directly except to pass it up the chain to the
shell, so there's no benefit to shelling out to eagerly deduplicate the list.

Plus, as of 3.6.0, even manual `complete -C"..."` invocations now deduplicate
results the same as if completions were triggered.
2023-01-19 17:51:22 -06:00
Mahmoud Al-Qudsi
031a6a09a4 Add completions for fail2ban-client
`fail2ban-client` uses nested subcommand syntax and intermixes fixed/enumerable
values with dynamically detected ones. If you know exactly what your overall
command structure looks like, these completions will work great. Unfortunately
their discoverability is a bit lacking, but that's not really fish's fault.

e.g.

* `f2b-c get/set` take certain known values but also accepts a dynamic jail name
* `f2b-c get/set <jail>` take certain fixed options but...
* `f2b-c get/set <jail> action` require enumerating an entirely different set
  of values to generate the list of completions, bringing us to...
* `f2b-c get <jail> action <action>` has a fixed number of options but
* `f2b-c set <jail> action <action> <property>` can be any valid command and its
  arguments

The intermixing of fixed, enumerable, and free-form inputs in a single command
line is enough to make one's head spin!
2023-01-19 12:53:40 -06:00
Kevin F. Konrad
9ee82b143a fix missing required parameter in terraform completions 2023-01-19 17:14:04 +01:00
Fabian Boehm
f9f29f0737 completions/portage: Fix errors with unreadable files
This could occur if a non-readable location was mentioned in one of
the portage config files.

Fixes #9495
2023-01-19 17:13:13 +01:00
NaLan ZeYu
093c580b5c Add completion for proxychains 2023-01-18 18:27:07 +01:00
Fabian Boehm
fd8291a96f __fish_print_help: Respect $MANPAGER
Fixes #9488
2023-01-18 17:05:39 +01:00
Fabian Boehm
772a367365 prompts/disco: Use $fish_color_status for the status
That's what it's for.
2023-01-17 21:31:47 +01:00
Fabian Boehm
69b28fc490 themes/coolbeans: Set fish_color_status to something less obtrusive
Similar to when we changed the color to the default mode-prompt.

I didn't notice that because my prompt uses $fish_color_error here, so
I reused the same color.
2023-01-17 21:30:47 +01:00
Austin Ziegler
bb6160bae4 Fix open completion for macOS
macOS 11+ (possibly 12+) has an additional place where certain
applications will be installed, `/System/Applications`. This is a sealed
system volume and includes the following applications:

- `App Store.app`
- `Automator.app`
- `Books.app`
- `Calculator.app`
- `Calendar.app`
- `Chess.app`
- `Clock.app`
- `Contacts.app`
- `Dictionary.app`
- `FaceTime.app`
- `FindMy.app`
- `Font Book.app`
- `Freeform.app`
- `Home.app`
- `Image Capture.app`
- `Launchpad.app`
- `Mail.app`
- `Maps.app`
- `Messages.app`
- `Mission Control.app`
- `Music.app`
- `News.app`
- `Notes.app`
- `Photo Booth.app`
- `Photos.app`
- `Podcasts.app`
- `Preview.app`
- `QuickTime Player.app`
- `Reminders.app`
- `Shortcuts.app`
- `Siri.app`
- `Stickies.app`
- `Stocks.app`
- `System Settings.app`
- `TextEdit.app`
- `Time Machine.app`
- `TV.app`
- `Utilities`
- `VoiceMemos.app`
- `Weather.app`

The change here adds `/System/Applications` to the search locations for
`-a` and `-b` options on the macOS completions for `open`. There are
possibly other locations that may be considered (I’m not using `mdls` or
`mdfind` in my functions for "reasons"), but this is partially based on
https://github.com/halostatue/fish-macos/blob/main/functions/__macos_app_find.fish
2023-01-16 18:07:49 +01:00
Mahmoud Al-Qudsi
256713b670 Add missing completion for status current-commandline
`status current-commandline` shipped in fish 3.6.0 but we missed adding this
completion.
2023-01-15 18:04:52 -06:00
Fabian Boehm
4ceb497bfb webconfig: Remove the abbreviations tab
Since the new expanded abbreviations in 3.6.0, abbr no longer accepts
new universal variables. That means this tab is now
non-functional (except that it could technically remove abbrs that
were set in universal variables).

Because making it work with the expanded abbreviations requires some
awkwardness like a dedicated conf.d snippet (or writing into
config.fish!), we simply remove it.
2023-01-11 08:25:45 +01:00
Fabian Boehm
905f788b3e completions/git: Remove awkward newline symbol
Konsole draws ⏎  with a width of 2, but widechar_width says it's 1.
That leads to awkward display.

It's also a surprising and distracting symbol in this use.

So just use spaces.
2023-01-10 19:27:16 +01:00
Fabian Boehm
2da1a4ae77 completions/git: Fix git-foo commands
Broken in f5711ad5ed, this neglected to
remove the `git-` part from the command

Fixes #9457.
2023-01-09 18:40:24 +01:00
Fabian Boehm
afd242b14d fish_config: Skip backing up prompt
This would print an ugly but benign error
2023-01-08 12:44:02 +01:00
Fabian Boehm
9e81d7e166 completions/conda: Fix subcommand parsing
This used the naive `__fish_seen_subcommand_from`, which isn't
powerful enough once you allow for `conda create` and `conda env
create`.

Hattip to jvanheugten for the env completions.

Fixes #9452
2023-01-07 11:23:04 +01:00
Fabian Boehm
d2f5daf8e8 bindings: If handler doesn't exist, set immediately
Fixes #9443
2023-01-02 21:44:02 +01:00
ridiculousfish
5e0f9521a5 fish_git_prompt: only do macOS workarounds for /usr/bin/git
On macOS, fish_git_prompt was failing to correctly handle the case where
another git was installed, e.g. /usr/local/bin/git from Homebrew.
Disable the workarounds in that case.
2023-01-02 12:26:56 -08:00
Johannes Altmanninger
92b1394178 completions/iw: add 160MHz WLAN channel 2023-01-02 18:13:47 +01:00
Dmitry Gerasimov
eb4dc101df completions/git: add "git bundle" support 2023-01-02 18:07:03 +01:00
exploide
08728be319 completions iw: added completions for iw dev set type and set channel 2023-01-02 17:53:56 +01:00
Jannik Vieten
2357c9f577
completions wireshark: removed wrong interface completion for -I option (#9440)
Wireshark completions for -I were wrong, since it doesn't take the network interface directly. It must still be specified with -i.
2023-01-02 17:45:25 +01:00
Aaron Gyes
550857ef65 Remove obsolete lynx bug mitigation
a lynx-internal hash of div.contents collided with em>a which caused
built-in styling to render much of entire pages as emphasized links.

Since switching from doxygen, we haven't had a <div class="contents">
so this workaround is no longer needed.
2023-01-01 19:41:41 -08:00
Johannes Altmanninger
a0840637fa fish_git_prompt: silence xcrun error when XCode is not installed
Our macOS workarounds involve running "xcrun" to check if Git is installed.
On a freshly upgraded Ventura system that does not have XCode or
CommandLineTools installed, "xcrun" will print this error:

    xcrun: error: invalid active developer path (/Library/Developer/CommandLineTools), missing xcrun at: /Library/Developer/CommandLineTools/usr/bin/xcrun

on every prompt. Let's silence this error.
2023-01-01 14:37:40 +01:00
Aaron Gyes
a40b019752 __fish_use_subcommand does not take arguments.
These four completions all have a strange pattern (that doesn't
work.)

    set -l subcommands cmd1 cmd2 cmd3 ...

    complete -n "__fish_use_subcommand $subcommands" -c foo -a cmd1
    complete -n "__fish_use_subcommand $subcommands" -c foo -a cmd2
    complete -n "__fish_use_subcommand $subcommands" -c foo -a cmd3

Remove the redundant lists of subcommands and the unused argument
passed to __fish_use_subcommand for bosh, cf, mariner, and port.
2023-01-01 04:57:53 -08:00
Aaron Gyes
fc7989cecd otool: Add completion 2022-12-31 14:49:17 -08:00
Fabian Boehm
4e7ecdfb40 completions/systemd-cryptenroll: Remove executable bit
Should be harmless
2022-12-30 13:42:54 +01:00
Akatsuki Rui
57bcbfa863 completions/abbr: fix complete condition
- fix complete condition
- add short flag

the conditions are not include short flags currently.
and conditions are not right, causing the complete to not work as expected.
2022-12-29 20:42:32 +01:00
Johannes Altmanninger
53505c89dd completions/abbr: tweak completions for --function argument
Since the function argument now sticks to --function, we need to adjust
a condition.
2022-12-29 10:20:33 +01:00
Fabian Boehm
c844b974b3 fish_git_prompt: Silence disown
The `git` can already have finished here, leading to "disown: There
are no suitable jobs". This has caused a failure on Github Actions.

So we do $last_pid and silence all output, like we do in other spots
2022-12-28 14:21:24 +01:00
ridiculousfish
6742d11a0e __fish_anypython: do not automatically run python3 on macOS
macOS ships with a stub `/usr/bin/python3` which by default opens a
dialog to install the command line tools. As we run `python3` initially
at launch, this causes the dialog to appear on first run of fish, if the
command line tools are not installed.

Fix this by detecting the case of `/usr/bin/python3` on Darwin without
the command line tools installed, and do not offer that as a viable
python.
2022-12-27 11:48:58 -08:00
ridiculousfish
a77bc70def fish_git_prompt: be careful about invoking git on macOS
git on macOS has two hazards:

1. It comes "preinstalled" as a stub which pops a dialog to install
   command line developer tools.

2. It may populate the xcrun cache when run for the first time, which
   may take several seconds.

We fix these as follows, both fixes limited to Darwin:

1. If git is `/usr/bin/git` and `xcode-select --print-path` fails,
   then do not run git automatically.

2. Second, if there is no file at `xcrun --show-cache-path`, we take it
   as an indication that the cache is not yet populated. In this case we
   run `git` in the background to populate the cache.

Credit to @floam for the idea.

Fixes #9343. Fixes #6625.
2022-12-27 11:48:58 -08:00
Emily Grace Seville
f15e5ce1da Add yash completion 2022-12-24 11:14:23 +01:00
Fabian Boehm
9da9f698df completions/mpv: Don't use "command"
(the alternative here is to explicitly check `command -q mpv`, but I'm
going for the idea that a thing called "mpv" is going to be an mpv)

Fixes #9426
2022-12-23 11:18:00 +01:00
Emily Grace Seville
6608ddc95b Use just options described in man page 2022-12-22 12:18:53 +01:00
Emily Grace Seville
e9d2bc9db1 Add oksh completion 2022-12-22 12:18:53 +01:00
Clément Martinez
47059d5caa Add completions for tmux options 2022-12-18 16:16:46 +01:00
Johannes Altmanninger
1c084beb43 completions/abbr: offer functions only if --function is given 2022-12-18 09:42:26 +01:00
Johannes Altmanninger
4b81002ab6 completions/abbr: fix when qmark-noglob feature is not turned on 2022-12-18 09:42:26 +01:00
Johannes Altmanninger
0db10056e7 completions/abbr: complete function names if --function is given 2022-12-17 18:09:54 +01:00
Johannes Altmanninger
d61f1d75a8 completions/abbr: minor rewordings 2022-12-17 18:09:54 +01:00
Johannes Altmanninger
9c0680070d Bind Shift+Return CSI u sequence to Return
I often hit Shift-Return accidentally, which makes my terminal echo a
weird escape sequence. Traditionally, terminals interpret Shift-Return
as Return, so let's follow that behavior.  Analoguous to commit 1dc526884
(Bind Shift+Space CSI u sequence to Space, 2022-04-24).
2022-12-17 11:12:40 +01:00
Fabian Boehm
27739b9a47 completions/yarn: Remove nonexistent subcommands
Went by the docs at https://yarnpkg.com/cli/install.

Anything not in the sidebar was removed.

(also rename "upgrade" to "up" because that's a great idea)

See #9375.
2022-12-16 20:47:03 +01:00
Fabian Boehm
478c8fb35e Remove "^" expand-abbr binding
This is no longer a special token, so it shouldn't expand abbreviations.
2022-12-16 17:06:03 +01:00
Gustavo Costa
b5470fc4c8
Add readelf completions (#9386)
* Add readelf completions

* Improve --debug-dump completions
2022-12-14 20:30:49 +01:00
Johannes Altmanninger
c120305b8d
Merge pull request #9313 from ridiculousfish/mega-abbr
Enhances abbreviations with extra features
- global abbreviations
- trigger on regex match as alternative to literal match
- the ability to expand abbreviations with a user-defined function  
- the ability to set cursor position after expansion
2022-12-12 23:56:11 +01:00
nps1ngh
abc2fc2cb0
Completions for ouch (#9405)
* Completions for `ouch`

* `ouch` completions: also add `l` to subcommands
2022-12-11 15:08:30 +01:00
ridiculousfish
4c3953065a Update abbreviation completions to reflect new features 2022-12-10 16:29:43 -08:00
ridiculousfish
1402bae7f4 Re-implement abbreviations as a built-in
Prior to this change, abbreviations were stored as fish variables, often
universal. However we intend to add additional features to abbreviations
which would be very awkward to shoe-horn into variables.

Re-implement abbreviations using a builtin, managing them internally.

Existing abbreviations stored in universal variables are still imported,
for compatibility. However new abbreviations will need to be added to a
function. A follow-up commit will add it.

Now that abbr is a built-in, remove the abbr function; but leave the
abbr.fish file so that stale files from past installs do not override
the abbr builtin.
2022-12-10 15:29:03 -08:00
Johannes Altmanninger
f81e8c7deb completions/git: complete refs for "git grep" 2022-12-08 14:57:48 +01:00
Johannes Altmanninger
e9bf8b9a4e Run fish_indent on share/completions/*.fish 2022-12-08 14:57:48 +01:00
Bagohart
494615891b added completion for git branch --remotes (-r) 2022-12-07 20:19:28 +01:00
EmilySeville7cfg
717800cd6c Add nu completion 2022-12-02 13:12:57 -06:00
calfcalfcalfd
e41ba6a2b6 Fixed typo in xrandr completions 2022-12-02 12:46:42 -06:00
exploide
e4cde861a4 completions hostnamectl: updated to systemd 251 2022-11-29 17:31:02 -06:00
Aaron Gyes
b6ca8dca27 ksh.fish fixup: remove errant line 2022-11-27 20:50:00 -08:00
Aaron Gyes
fd252daafd ksh completions: add descriptions
Also remove options ksh --help says are obsolete.
FWIW ksh93 does a bit more than what is here but this is pretty
good.
2022-11-27 20:46:14 -08:00
Emily Grace Seville
c49f0c8be9
es: add completion (#9388)
* Add `es` completion

* Add `-d` option

* Add option's descriptions
2022-11-27 14:36:17 +01:00
Emily Grace Seville
253b063c88 Add xonsh completion 2022-11-27 14:34:19 +01:00
Emily Grace Seville
e8a7f7eb8e
reg: completions for key entries (#9382)
* Add `__reg_run_reg_safely` for quering keys, and:
- `reg` placeholder
- try make key ccompletion for `__reg_add_complete_args`: doesn't work

* Simplify `__reg_run_reg_safely`

* Fix key completion in `__reg_add_complete_args`

* Add key completion to `delete` subcommand

* Add key completion to `export` subcommand

* Add key completion for `query` subcommand

* Add key completion for `save` subcommand

* Remove `reg` placeholder

* Remove `which` check
2022-11-27 14:26:25 +01:00
EmilySeville7cfg
14f4f3d192 Add rc completion 2022-11-26 17:44:25 -08:00
EmilySeville7cfg
55a06f8087 Add wish completion 2022-11-26 17:44:25 -08:00
EmilySeville7cfg
e99501a08b Add qshell completion 2022-11-26 17:44:25 -08:00
EmilySeville7cfg
11504f79bb Add available options for [-+]o option for ksh 2022-11-26 17:44:25 -08:00
EmilySeville7cfg
106552ac42 Add ksh completion 2022-11-26 17:44:25 -08:00
EmilySeville7cfg
e0fb7f420f Add tcsh completion 2022-11-26 17:44:25 -08:00
EmilySeville7cfg
f5c03227fa Add csh completion 2022-11-26 17:44:25 -08:00
EmilySeville7cfg
3310ee4a0e Add completion for pix, xed, xplayer, xreader, xviewer (#9379)
Closes #9379
2022-11-26 09:45:12 +01:00
Emily Grace Seville
74b8a3befc Add completion for konsole (#9371)
Closes #9371
2022-11-26 09:45:12 +01:00
Emily Grace Seville
b6b4c6806f Add completion for ark (#9362)
Closes #9362
2022-11-26 09:45:12 +01:00
EmilySeville7cfg
a065dd7764 Add completion for dolphin (#9361)
Closes #9361
2022-11-26 09:45:12 +01:00
EmilySeville7cfg
4a85091ed7 Add completion for okular (#9358)
Closes #9358
2022-11-26 09:45:12 +01:00
EmilySeville7cfg
51141b9a2f Add completion for kb (#9357)
Closes #9357
2022-11-26 09:45:12 +01:00
EmilySeville7cfg
a4c9b3a70d Add completion for eg (#9356)
Closes #9356
2022-11-26 09:45:12 +01:00
exploide
3c3e7369ae completions: added ykman, the yubikey management tool
it is able to generate its own completions using click
2022-11-23 12:40:51 -06:00
Bart Libert
00b34e28a2 completions: Add toot 2022-11-22 17:15:40 -06:00
Johannes Altmanninger
b98cee10bb completions/scp: inhibit ls redefinitions
scp completions use "ls" to list files on the remote host.  If a user aliases
them (in noninteractive shells) this will break. In general, this is the
users fault but also kind of ours because we shouldn't really use "ls" here.
Let's work around this problem by skipping functions.

Fixes #9363
2022-11-20 13:46:07 +01:00
Dmitry Gerasimov
f130e36c7e Autocomplete tag names after vim -t
Implement completion for vim tags from any place within the source tree.

To prevent freezes on a huge tags file (e.g., on one from the Linux
kernel source tree), amount of completion lines is limited to 10000.

Note that the TAGS file (EMACS-compatible tags file) is not searched
here as it would not be used by vim anyway.
2022-11-18 12:52:37 -06:00
Terje Larsen
2cd063e28b Add curl request method argument completion 2022-11-18 12:47:28 -06:00
Mahmoud Al-Qudsi
03758ce129 completions/git: Add some options for init.defaultBranch
[ci skip]
2022-11-16 12:39:47 -06:00
Johannes Altmanninger
108108bb5e completions/flatpak: remove broken version checks
flatpak completions gate some features behind checks like

    test $flatpakversion -gt 1.2

which does a floating point comparison, which is different
from version comparison.

Most of these version checks are irrelevant anyway because they check for
a version that's not even in Debian oldstable.  The only one that might be
relevant is a check for version 1.5 but that only gates some extra subcommands;
there's little harm in providing them too.

So let's just remove the version check.

Hopefully fixes #9341 (untested)

Note that flatpak upstream provides a completion file too - but it's shadowed
by ours on my system. This is a tricky issue for another day.
2022-11-12 22:31:59 +01:00
Aaron Gyes
d31847b1d8 Fix apparent dyslexia 2022-11-12 05:47:27 -08:00
Collin Styles
9a870f40c2 Add --[no-]update-refs options to git-rebase completions
These were added in git 2.38.0:
https://github.com/git/git/blob/master/Documentation/RelNotes/2.38.0.txt
2022-11-12 00:04:30 +01:00
Mahmoud Al-Qudsi
51087fd39e Complete env var names and values from history 2022-11-09 15:37:40 -06:00
Mahmoud Al-Qudsi
add1df12b3 Fix env completions
Previously an environment variable to redefine would only be suggested if you
had not yet started typing one out. This makes it so that `env C<TAB>` will also
complete to, for example, [ `CC=`, `CXXFLAGS=`, ... ].

It also is smarter when suggesting variable names to complete: if a variable has
already been completed, it isn't suggested again. Additionally, it only suggests
names for variables that are exported, not all variables (the previous list was
insanely long and including things like all our `fish_...` variables).
2022-11-09 13:42:19 -06:00
Dmitry Gerasimov
3ac6bdd437 Update tree completions
Update completions for the tree command. There are a lot of new options
were added since the 1.6.0 release (which apparently was used to create
current completions).

Options are also reordered to follow the "tree" help.
2022-11-08 20:16:24 -06:00
exploide
ccebe1a169 completions: added systemd-cryptenroll 2022-11-06 11:38:42 -06:00
Sergei Shilovsky
022f42c3cd Update $fish_cursor_selection_mode in vi/default bindings
Introduced with 3.6.0 `fish_cursor_selection_mode` variable breaks
existing vi bindings (for example, input sequence `abc<Esc>0vd` doesn't
delete the `a` character as would be expected).

This patch fixes it by switching `fish_cursor_selection_mode` to
`inclusive` and back.
2022-11-01 19:04:55 +01:00
Branch Vincent
aa30774b0d completions: add op 2022-11-01 19:02:32 +01:00
exploide
535bba77c4 completions: added efivar 2022-11-01 18:52:24 +01:00
Lia Lenckowski
c5a026c955 add completion for loadkeys 2022-11-01 18:51:17 +01:00
Lia Lenckowski
0a6efdc4ad fix lsblk column completion 2022-11-01 18:50:21 +01:00
Mahmoud Al-Qudsi
36ae867e28 completions/git: Allow completing known values for config keys
Currently populated with support for handling just one key
(diff.algorithm) but there are others.
2022-10-31 12:45:56 -05:00
Aaron Gyes
3286c3cb6b funced: skip indent step if fish_indent not installed
Just in case.
2022-10-30 22:27:34 -07:00
Aaron Gyes
5447c130fc remove fish_key_reader finder/wrapper thing.
This was just added since "it works for fish_indent, might
as well". It's of limited utility, remove it.
2022-10-30 22:17:48 -07:00
Aaron Gyes
4906c680c6 remove fish_indent wrapper
When this was introduced, we used fish_indent --ansi to format
the output of `builtin functions` for color output in `type`, etc.

We don't anymore.

Today it's not a potential showstopper if one launches a fish
session with a five year-old fish_indent in $PATH. We need not
go to lengths to try to make sure we run whatever is in the
build dir adjacent to the `fish` binary.
2022-10-30 22:07:15 -07:00
Aaron Gyes
02998aba76 git.fish: update general options
Adds a few options I see in my git manpage that were omitted:
-v, -h, -P, --config-env, --no-optional-locks, --list-cmds

Reword most general option descriptions
2022-10-30 15:26:38 -07:00
Fabian Boehm
9948bc2264 completions/apt: Add quotes
Simple way to make the apt completions spew:

function apt; end

on a system without an apt command installed. (even if it isn't
Darwin, because this uses test combiners!)

This is a thing some people do to avoid learning other package managers.

(of course our completions would probably be *wrong* still, but at least they
won't spew a `test` error)
2022-10-30 11:27:34 +01:00
Aaron Gyes
7c680af4e3 disable apt completions on macOS
macOS has a /usr/bin/apt that is some tool requiring Java,
abort the completions to avoid the confusing package manager
completions.
2022-10-29 11:28:37 -07:00
Aaron Gyes
a6e2e52eef apropos completions for macOS/BSD variants
This should show the correct options for macOS, NetBSD,
FreeBSD, OpenBSD, and DragonFly.
2022-10-28 11:07:35 -07:00
Aaron Gyes
c887e5dbde Fix apropos completions
The 'str' variable was apparently mistakenly removed by 49c5f96470.

Re-add it, and regex-escape it as well.

Allow completing on apropos <TAB> instaed of requiring an initial char.

Use __fish_apropos instead of apropos.

New regex to hopefully work on more platforms.

Explicitly use ^ instead of adding it at __fish_apropos
2022-10-28 10:01:35 -07:00
Aaron Gyes
054d0ac0ea git completions: undo mistaken set -f usage
and fix issue in __fish_git_needs_command
2022-10-28 01:14:45 -07:00
Aaron Gyes
b8dee05ad0 completions: remove functions that are never used
None of these __functions defined in completions are used or
referenced anywhere.

Found with:

function unused -a file search -d 'find unused functions'
  set -f (string replace -fr '^[\s]*function ([\w_]+).*' '$1' < $file)
  for cmd in $cmds
    printf %d\ %s\n (grep -r ".*$cmd.*" $search < $argv | count) $cmd
  end | string match '1 *'
end

for file in share/*/*.fish
  unused $file share && printf "in %s\n" $file
end
2022-10-27 23:25:44 -07:00
Aaron Gyes
f5711ad5ed git.fish: collapse repeat complete cmds, set -f, rm unneeded funcs
Get rid of functions:
__fish_git_diff_opt,
__fish__git_append_letters_nosep,
__fish_git_sort_keys

Use `set -f` inside blocks instead of `set -l foo` before blocks.

Two of these just printed out the argument\tdescription dictionaries
without providing any utility: only used once, just do it inline.

Collapse adjacent lines that look like
complete git -n '(blah)' -l option -d 'option help'
complete git -n '(blah)' -l option -a 'arg1' -d 'description 1'
complete git -n '(blah)' -l option -a 'arg2' -d 'description 2'
complete git -n '(blah)' -l option -a 'arg2' -d 'description 3'
...

into

complete git -n '(blah)' -l option -d 'option help' -a "
arg1\t'description 1'
arg2\t'description 2'
arg3\t'description 3'
..."

This sped up the source time about 10% by running complete
less.
2022-10-27 22:19:32 -07:00
Fabian Boehm
14ecb63e40
completions/usermod: Fix subu/gid option spelling
It's "subuid", not "sub-uid".

Fixes #9303
2022-10-25 11:09:41 +02:00
Johannes Altmanninger
90b2c95bbc fish_clipboard_copy: bypass tmux, write OSC 52 to the underlying terminal
For security reasons, some terminals require explicit permission from the
user to interpret OSC 52. One of them is [tmux] but that one usually runs
inside another terminal. This means we can usually write directly to the
underlying terminal, bypassing tmux and the need for user configuration.

This only works if the underlying terminal is writable to the fish user,
which may not be the case if we switched user. For this reason, keep writing
to stdout as well, which should work fine if tmux is configured correctly.

[tmux]: https://github.com/tmux/tmux/wiki/Clipboard
2022-10-24 22:45:45 +02:00
Johannes Altmanninger
4de2891507 fish_clipboard_copy: make it work inside SSH/containers via OSC 52
When running inside SSH, Control-X runs a clipboard utility on the remote
system.  For pbcopy (and probably clip.exe too) this means that we write to the
remote system's clipboard. This is usually not what the user wants (although
it is consistent with  fish_clipboard_paste).  When X11 forwarding is used,
xclip/xsel copy to the SSH client's clipboard, which is what most users want.

When we don't have X11 forwarding, we need a different solution. Fortunately,
modern terminal emulators implement the OSC 52 escape sequence for setting
the clipboard of the terminal's system. Use it in fish_clipboard_copy.

Tested in SSH and Docker containers on foot, iTerm2, kitty, tmux and xterm
(this one requires "XTerm.vt100.allowWindowOps: true").

Should also work in GNU screen and Windows Terminal. On terminals that don't
support OSC 52 (like Gnome Terminal or Konsole), it seems to do nothing.

Since there does not seem to be a way to feature-probe OSC 52, let's just
always do both (pbcopy and friends as well as OSC 52).  In future, we should
probably stop calling pbpaste and clip.exe, at least on remote systems.

I think there is also an escape sequence to request pasting the system
clipboard but that's less important and less popular, possibly due to
security concerns.
2022-10-24 22:45:45 +02:00
Mahmoud Al-Qudsi
db0a297b8a Add new line between each trap -p output function
This makes the output a little easier on the eyes.
Tests appear to not need any changes to pass. I always forget whether or not
littlecheck cares about whitespace.
2022-10-24 15:36:02 -05:00
Mahmoud Al-Qudsi
c8f92878c3 Fix trap -p
Two different bugs completely broke `trap -p`. First bug broke filtering of
functions with trap handlers (`functions -na` prints functions separated by a
comma, not a new line). Second bug broke showing of function definitions for
traps because a refactor renamed only some call sites but references to `$i`
renamed.

These issues were introduced in a6820cbe and appear to have been caught just in
time: no released version is affected (changes made post-3.5.1).
2022-10-24 15:35:59 -05:00
Fabian Boehm
8d5198b9b4 fish_git_prompt: Fish show_upstream
This isn't a boolean option

Fixes #9301
2022-10-24 19:13:08 +02:00
Mahmoud Al-Qudsi
3f327dca79
Merge pull request #9295 from moverest/nvme-completions
Add `nvme` completions
2022-10-22 14:16:46 -05:00
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