Fixes
- Use the actual path when skipping unusable paths to fix all Include
directives being skipped when there is no ~/.ssh directory
- Prevent "No matches for wildcard" message
Improvements
- Skip paths that are directories since we only want files
- Remove `cd` as it is not needed
__fish_complete_suffix assumed that the only literal . in a path
would be the . before an extension, and stripped accordingly. This
behavior has been there for a long time, but broke many things
including completion of relative paths and completion of paths with
a literal . in a directory name.
__fish_complete_suffix does not just complete extensions (or at the
very least, it no longer does just that) but rather any suffix, so
isolating the path name without the extension was unnecessary in all
cases.
With a blank $suff (i.e. complete all files), __fish_complete_suffix
returned directories twice, once with the trailing `/` and once without.
This fixes that, and additionally speeds up the code by no longer
shelling out to `sort -u` as we no longer rely on brace expansion to
enumerate directories and files simultaneously.
In general, this behavior would occur when a directory exists that
matches the suffix search pattern (so a dir named 'foo.bar' with a
search pattern '.bar' would return 'foo.bar' twice).
Runtime has dropped from ~22ms to ~8ms on my machine, while also
returning more correct results.
This prints an escape sequence, so it can break scp or similar when
someone has an unqualified
fish_vi_key_bindings
in config.fish and happens to run a terminal that can set the cursor.
Under FreeBSD, as annoying as it is, switches must directly follow the
command or subcommand in question, and cannot come after actual payload
argument. Calling `zpool get all -H` instead of `zpool get -H all`
caused error messages to be spewed to the console under FreeBSD when
simply completing `zfs <TAB>`, this should fix that. The change should
also be compatible with other operating systems (namely Linux) that
don't have this requirement, as they (generally) allow arguments to come
before _or_ after the primary non-switch argument (though I do not have
access to a zfs-enabled Linux machine to test this).
Previously, trying to complete a token with any of these
expansion-related characters would cause the completion to return no
results, as it would emit expanded values which weren't matched by the
autocompleter.
Akin to __fish_complete_suffix, __fish_complete_directories now attempts
to complete the current commandline token if no token is explicitly
passed in as an argument.
The prompt is a fallback that is overridden via a function file
anyway.
Do that with the title as well, so we can use just builtins.
This removes error messages when $fish_function_path is borked.
Turns out that `make -pn` actually takes a while - about 300ms on
fish's makefile.
That's quite a bit of time just to throw away the output and use the
exit code.
So we just check for "GNU" in the version string.
It would be nice to just _do_ the completion and fall back on the
BSD-style if it doesn't work, but that is tricky to do with the pipe
to `awk` - the awk expression actually does not fail if `make` does
not print output.
And I don't know enough about awk to change that.
For usage in completion scripts.
Unlike `__fish_is_first_token` (which is probably not correctly named),
`__fish_is_first_arg` returns true regardless of whether existing tokens start with `-`
or not, to be used when an arg cannot be used with any other argument.
`__fish_prev_arg_in` is similar to `__fish_seen_...` but it explicitly
tests the preceding token only, for arguments that take only a single
parameter.
As it turns out, for some terminals backspace is \b but only when
preceded by \e.
All this makes about as much sense as the english language.
Fixes#4955.
The previous completion generation was broken for several reasons:
* ./foo would break detection of suffix due to the leading . being
interpreted an extension marker,
* ./foo would be completed as foo, which would be excluded from
matching inrcomplete.cpp
To be used by completions to directly determine whether it is either
possible or preferable to complete a switch (instead of a subcommand),
(presuming that switches must come before subcommands).
* __fish_can_complete_switches: we are in a position where a switch may
be placed.
* __fish_should_complete_switches: we're in a position to accept a
switch and the current token starts with `-` so we have no choice but
to do so.
Instead, attempt to extract the message that _would_ be displayed on
execution of `./configure --help` by relying on some markers present in
autoconf-generated configure files.
As measured with 'hyperfine' on a laptop running in reduced frequency
power savings mode, `fish -c "__fish_parse_configure ./configure"`
runtime dropped from ~1.25s to ~0.8ms, which is inline with the
previously observed ~350ms execution time for `./configure --help`.
fish's own startup time is approximately 75ms before parsing begins.
Still very slow, but much better.
This relies on the new `read --line/-L` support as an entire parser for
the output of `./configure --help` was written in fishscript. Also
doesn't work without 72f32e6d8a7905b064680ec4b578c41dea62bf84.
The completion script is slow... a function of both the autotools
configure script itself being written in a shell script combined with a
fishscript output parser.
fish's own `./configure --help` takes around 350ms to execute, while
`__fish_parse_configure ./configure` (which runs that behind the scenes)
takes around 660ms to run, all-in-all - a not insignificant overhead.
Output can be cached (based off of ./configure hash or mtime) in the
future if this is a big deal.
Now the description includes the variable scope, `set [-e] -[Ugl]`
completions only provide variables matching that scope, and completions
that shouldn't be modified are hidden from the user. Completions that
are often modified but rarely unset (`fish_*` variables) are omitted
from `set -e` completions.
A new helper function `__fish_seen_argument` has been added that makes
it easy to only provied completions for a specific flag.
Launch `cmd.exe /c "start URL"` under WSL for both `fish_config` and
`help`. This works around #4299 but does not address the underlying
issue (#1132).
no-op function for compatibility with sh, bash, and others.
Often used to insert a comment into a chain of commands without having
it eat up the remainder of the line, handy in Makefiles.
In similar vein to how fish_default_key_bindings works, parameters
passed to the function are automatically passed to bind upstream.
Additionally, -s is automatically added if no parameters had been
specified to prevent startup error messages. See 46d1334.
Closes#4494
Can be used to retrieve a list of parent paths, useful for searching
ancestors recursively via their absolute paths. Paths are returned from
deepest to shallowest, starting from the path passed in. Paths are not
validated for performance reasons. (Usually the input to
__fish_parent_directories would be (pwd) or (dir $file).)
* Add eopkg support
Add support for eopkg in __fish_print_packages function, and
add new completion eopkg.fish in share/completions
* Sorry for the empty file
* Sorry for the empty file again
* Use builtin function for checking subcommand and options
* Fix description
* Use string function to replace grep and cut
* Add completion for search command
This was caused by it prepending "-s" to argv always,
and later checking $argv[1].
As it turns out, that is kinda superfluous, so we can just add "-s" to
the `bind` calls.
Also adjust the tests so the vi-bindings are enabled via the function,
which would have caught this.
Fixes#4494.
The previous hack used to work around an OS X issue/bug where launching
a URL with a #fragment appended would drop the fragment by using
`osascript` does not seem to work any more. Append the section name as a
query string (in addition to, not instead of #section) and then use some
basic javascript appended to the user doc HTML template to parse that
and jump to the correct section (if the section was dropped).
Closes#4480
E.g. if "foo" is in CDPATH, and both "foo/bar" and "./bar" exist, `cd
bar` will go to ./bar.
The completions described "bar" as going to "foo/bar" ("CDPATH foo").
This fixes it by checking for ./bar's existence.
See #4475.
This silences binding errors due to keys not found in the current
termcap config in the default fish bindings.
Closes#4188, #4431, and obviates the original fix for #1155
It was necessary to re-implement builtin_bind as a class in order to
avoid passing around the options array from function to function and
as adding an opts parameter to `get_terminfo_sequence` would require
otps to be passed to all other builtin_bind_ functions so they could, in
turn, pass it to `get_terminfo_sequence`.
This
- Offers more candidates
- Is more reactive (it'll always incorporate "--state=" and "--type="
- Is faster (about 800ms to about 120ms)
- Needs fewer function files
All __fish_systemctl_* functions except __fish_systemctl_services have
been removed.