Commit graph

4643 commits

Author SHA1 Message Date
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
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