Commit Graph

1746 Commits

Author SHA1 Message Date
Johannes Altmanninger
d6dd532d6a Do support the new realpath -s in our wrapper function
See #7574
2020-12-26 08:56:34 +01:00
Johannes Altmanninger
4dae106911 Use complete --keep-order with __fish_complete_suffix to prioritize files with matching suffixes
Part of #7040
2020-12-23 19:14:10 +01:00
Johannes Altmanninger
bae75c96d9 __fish_complete_suffix: complete all files, but sort files with matching suffix first
See #7040 and others.
2020-12-23 19:14:10 +01:00
Fabian Homborg
04d7d89020 __fish_print_packages: Extract the rest
Of note: The rpm/yum thing seems to be coupled, so I put it into one
function that tries the yum helper and uses the rpm path otherwise.
Zypper is already its own thing, so this should only be used for yum
and probably dnf (does that still have the helper?)

Zypper can be dropped, as that already used a separate function in the file.

Apk can just be inlined - it's literally one line for installed and another for all packages.
2020-12-22 17:10:02 +01:00
Fabian Homborg
97838657b9 Extract creating $XDG_CACHE_HOME into its own function 2020-12-22 17:10:02 +01:00
Fabian Homborg
24012b1941 __fish_print_packages: Break apart
This function doesn't make any sense.

Most things that expect package names expect package names for *one
specific package manager*.

It only happens to work, most of the time, because most people only
have one package manager installed.
2020-12-22 17:10:02 +01:00
ridiculousfish
90f4c458e5 Rename insert_line_above to insert_line_over
This is for symmetry with insert_line_under. See #7442.
2020-12-19 14:31:33 -08:00
ridiculousfish
2d2efc8b2e Implement o and O bindings for vi mode
Credit to @joallard for the patch. Fixes #7442
2020-12-19 14:28:00 -08:00
Johannes Altmanninger
f1478137dc __fish_complete_path: guard against non-matching input 2020-12-12 08:22:45 +01:00
Fabian Homborg
0fdef958b6 __fish_complete_blockdevice: Default to /dev
This gives all the blockdevices for `mount `

Fixes #7543.
2020-12-11 23:09:16 +01:00
Fabian Homborg
2aaa51e02e Repaint also for fish_color_{host_remote,error}
These are used in our prompts as well.
2020-12-11 20:55:09 +01:00
Vadim Zyamalov
0200fc0fbc
Creating cache for xbps-query in __fish_print_packages.fish (#7534)
* Completions for xbps were not showed on cache file creation

* Completions for xbps were not showed on cache file creation, small typo
2020-12-08 20:59:56 +01:00
Fabian Homborg
672fdde1f0 __fish_print_packages: Better parse apt-cache's weird format
Fixes #7521.
2020-12-04 16:45:14 +01:00
Fabian Homborg
eb592092a6 fixup! Only disable WINCH handling in VTE
Apparently iTerm doesn't reflow?

See #7491
2020-11-30 20:50:02 +01:00
Fabian Homborg
df137695bb Disable WINCH handler in reflowing terminals
Fixes #7491.
2020-11-30 20:01:33 +01:00
Enrico Maria De Angelis
2a86099cfd
fish_vi_key_bindings: Implement "d;" and "d," (#7516) 2020-11-29 21:24:42 +01:00
Mahmoud Al-Qudsi
a3cb1e2dcd Fix setting terminal title after fg
The code to override the `(status current-command) was present`, but not
handled in either the default `fish_title` function or the fallback.

Closes #7444.
2020-11-28 00:56:10 -06:00
Fabian Homborg
2e55e34544 Reformat 2020-11-22 14:39:48 +01:00
Mahmoud Al-Qudsi
01f239188d [zfs] Limit snapshots to spelled-out dataset
Use the `-d` parameter to `zfs list` to limit snapshots to the dataset
named in the current token being completed. Thanks to @Debilski for the
tip.

Closes #7472
2020-11-20 15:28:19 -06:00
Érico Rolim
31870e774a share/functions: account for the possibility of mktemp failure. 2020-11-14 15:57:42 +01:00
Mahmoud Al-Qudsi
6bd4f52b0d [zfs] Optimize enumeration of snapshots
Only generate the list of snapshots when
a) the argument must be a snapshot and nothing else, or
b) the argument as typed contains a literal @, or
c) a snapshot is a valid completion and there is only one dataset
   matching the argument as entered.

Unfortunately, it seems the `zfs` command itself is extremely primitive
and doesn't support listing snapshots by dataset so when we need to
generate completions, we end up needing to enumerate all snapshots
(ever) across all datasets. I'd be very happy to be proven wrong, but I
think the only other way would be manually parse `zdb` output.

See #7472
2020-11-12 22:24:29 -06:00
Shawn LeMaster
e4b64448fa Don't assume $__fish_git_prompt_char_cleanstate is non-empty
This fixes the case where an empty "clean state" character
can cause a spurious space character at the end of the git prompt.
2020-11-10 18:55:15 +01:00
Ayooluwa Isaiah
ea1dffd53d Add support for copy and paste in WSL
- clip.exe is used to copy to the Windows clipboard
- There's no binary for pasting from the Windows clipboard so
  `Get-Clipboard` from powershell is used as a workaround. The
  superflous carriage return is stripped from the output.
2020-11-06 22:10:04 +01:00
Jan-Jaap Korpershoek
4b74fbf1b7
Make mysql completions work with log-in (#7397)
Complete databases using credentials specified on the commandline.
2020-10-30 18:34:23 +01:00
Fabian Homborg
4bfda47449 Bind ctrl-r to search history if the commandline isn't empty
This is super cheesy.

One of the most common feature requests we get is "control-r must
search", even tho just using history-search-backward via e.g. up-arrow
is perfectly capable. The only real difference is that ctrl-r search
in other shells allows editing the search term by default, while we
stop the history search and edit the new commandline in those cases.

So, since the major problem is muscle-memory on ctrl-r,
let's just use that!

This makes ctrl-r do nothing on empty commandlines, and do
history-search-backward otherwise, so the basic flow of "press ctrl-r
to start history search, enter your search term, press ctrl-r to cycle
through matches" just works (except the first ctrl-r is useless and it
doesn't show anything).

See #602.
2020-10-23 13:42:54 +02:00
Mahmoud Al-Qudsi
7990bd3046 [npm/yarn] Add support for namespaced packages
The regex previously in use did not allow for namespaced packages and
wouldn't match against things like @types/foo.
2020-10-21 22:26:52 -05:00
Johannes Altmanninger
f20e8e5860 alias: don't add --wraps for wrappers with the same name
These aliases seem to be common, see #7389 and others.  This prevents
recursion on that example, so `alias ssh "env TERM=screen ssh"` will just
have the same completions as ssh.

Checking the last token is a heuristic which hopefully works for most
cases. Users are encouraged to use functions instead of aliases.
2020-10-10 09:24:49 +02:00
Johannes Altmanninger
03e0ec82af alias: use original body instead of escaping back and forth 2020-10-10 09:24:49 +02:00
Johannes Altmanninger
1173e8bda4 Clarify that some complete calls just need a command with no user-defined completion 2020-10-10 09:24:49 +02:00
Fabian Homborg
fb57ca8791 __fish_apropos: Use macOS' stat explicitly
Overrides the GNU tools some people use.

Fixes #7390.
2020-10-09 18:58:35 +02:00
Fabian Homborg
468c6ff0f8 abbr: Erase all abbrs in one go
Simplifies returns, also allows erroring out without erasing anything
if an abbr name was bogus
2020-10-04 12:34:51 +02:00
Fabian Homborg
420fa68c54 abbr: Fix check for spaces in the name
This used a non-existent variable
2020-10-04 12:34:51 +02:00
Fabian Homborg
135c5a9746 abbr: Don't write an error if erasing nonexisting abbrs
Fixes #7376.
2020-10-04 12:34:38 +02:00
Fabian Homborg
2ab4c10c47 abbr: Allow erasing multiple
Fixes #7377.
2020-10-04 12:27:59 +02:00
ridiculousfish
a6686ca310 Run makewhatis in the background
In the new __fish_apropos, makewhatis is run explicitly to generate the
whatis database. However this can be a little slow. Run it in the
background, after the apropos call completes so as to avoid a weird
race.

This means that descriptions may not be available the first time the
user invokes it, but that's better than appearing to hang for a while.
2020-10-03 17:09:00 -07:00
Folke Lemaitre
a6a0d43c9c Better __fish_describe_command for Macos
override MANPATH used by apropos with local whatis database and update it once a day

get rid of xargs

Created __fish_apropos and fixed __fish_complete_man to use that as well

moved macos apropos comment
2020-10-03 16:18:44 -07:00
Johannes Altmanninger
a1fd9e1b85 Fix invalid flags for builtin type
This combination of flags doesn't work anymore, which makes sense.
2020-09-30 21:46:43 +02:00
Johannes Altmanninger
e9582c41b2 Remove __fish_complete_external_command
It's no longer used.
2020-09-25 19:33:01 +02:00
Fabian Homborg
293a3a628d Remove pipestatus_with_signal
This was a wrapper around status_to_signal, just because that only
handled a single argument.

Instead, just teach status_to_signal to handle multiple arguments and
be done.
2020-09-24 20:14:10 +02:00
Fabian Homborg
dde8318e50 print_pipestatus: Simplify
Just some minor stylistic nits
2020-09-24 20:08:16 +02:00
Fabian Homborg
ef9c924960 Make type a builtin
This is too important to not be one.

For one if it couldn't be loaded for any reason it would
break a lot of fish scripts.

Also this is faster by ~20x.

Fixes #7342
2020-09-21 20:58:34 +02:00
Fabian Homborg
a3e20a4d38 Don't use abbreviated long options
"function --argument" is not a thing, it's "--argument-names". This only
accidentally works because our getopt is awful and allows abbreviated
long options.

Similarly, one argparse test used "--d" instead of "-d" or "--def".
2020-09-19 11:47:41 +02:00
Johannes Altmanninger
6ec0b583f5 __fish_paginate: move the cursor to end of recalled commandline
When pressing \ep on an empty commandline, the cursor would stay at the
beginning of the commandline. Move it to the end of the previous command,
this feels a bit more natural.
2020-09-17 18:44:54 +02:00
Fabian Homborg
e86a31f6d4 Use the newly fixed test -t in isatty
Removes a weird dependency on the test command.
2020-09-16 21:02:59 +02:00
Fabian Homborg
1c43030d79 cd: Remove unneeded code
This now works in cd proper, so it's unneeded in the function.
2020-09-12 20:17:30 +02:00
Fabian Homborg
0072367512 fish_add_path: Don't resolve symlinks
The case for symlinked directories being duplicated a lot isn't there,
but there *is* a usecase for adding the symlink rather than the
target, and that's homebrew.

E.g. homebrew installs ruby into /usr/local/Cellar/ruby/2.7.1_2/bin,
and links to it from /usr/local/opt/ruby/bin. If we add the target, we
would miss updates.

Having path entries that point to the same location isn't a big
problem - it's a path lookup, so it takes a teensy bit longer. The
canonicalization is mainly so paths don't end up duplicated via weird
spelling and so relative paths can be used.
2020-09-12 19:28:01 +02:00
Fabian Homborg
691deac1e4 Print default error in the pacman cnf-handler
Pacman *only* prints the package if it exists, no error or anything.

Fixes #7327.
2020-09-11 20:58:02 +02:00
Fabian Homborg
34be1b458a Add fish_command_not_found handler for pacman
Since version 5 (IIRC), pacman has a file database.

This is useful for people who don't have pkgfile, but we still prefer
that because it's much faster - pacman takes a full *second* on my system.
2020-09-09 17:44:25 +02:00
Fabian Homborg
576ce5f9f5 Remove __fish_command_not_found_handler
This could lead to an infinite loop (well, stack overflow) because
fish_command_not_found would also be defined to call
__fish_command_not_found_handler.

Since this is for

- missing command errors
- when downgrading

we can just remove it.
2020-09-06 13:50:38 +02:00
Fabian Homborg
0131974378 Use OpenSUSE command-not-found via $PATH
We check the full $PATH, so it's not guaranteed that it is in /usr/bin.
2020-09-06 11:15:54 +02:00