This enables fuzzy-matching outside of the current directory again.
As it turns out, the performance impact here isn't as large as I
thought - it's massively dependent on caching.
Fixes#5476.
Which is 4, apparently.. (builtin_set.cpp returns ENV_NOT_FOUND)
here. This was previously hardcoded to our 121, which used to be
what builtins used for invalid arguments.
4 is pretty arbitrary but at least this is more consistent.
I had previously introduced a lot of updates and fixes to npm registry
based completions for `yarn` but hadn't ported them to `npm` as well
(although they can be dropped in as-is). This patch shares the code
between the two, which resides in an explicitly sourced multi-function
fish script.
The informational message is only shown the first time an attempt at
completing `yarn add` is made per session. This should vastly improve
the discoverability of this feature as regular yarn/npm users would
never have `all-the-package-names` installed normally.
Starting with Fedora 30 and RHEL 8, ambiguous python shebangs will now
throw errors during the RPM build process instead of just warnings,
since these systems have moved to Python 3 by default, and Python 2 may
not be available in the future.
See [this
page](https://fedoraproject.org/wiki/Changes/Make_ambiguous_python_shebangs_error)
for more details.
Drop these shebangs as the scripts are only ever called from fish
wrappers.
This checks if uname exists (we already call it elsewhere without
check, nobody has complained, uname is in POSIX), then calls to see if
it's "Linux", and only then offers any completions.
Since we don't have any other version to offer, the check is worse
than useless.
* Severely extended the sorin theme
This theme should now mostly match the original.
* Removed superfluous whitespace
* Inlined external links as ASCII art
* Made myself the author of the sorin theme
* Removed superfluous read delemiter
* Renamed __fish_git_action to fish_print_git_action
* Adde a minor comment
Cleaned up the code to no longer replicate in fishscript what fish
already does (and caches to boot) in C++ in setting up the paths to the
user configuration directory.
Also introduced a `$__fish_user_data_dir` instead of the sporadic
definitions of `$userdatadir` that may or may not go through
`XDG_DATA_HOME`.
I spent some time figuring out $TERM_PROGRAM_VERSION and Terminal.app's
capabilities over time. [1]
Only use OSC 7 if running on the version of Terminal.app that added it
or newer. In the past this would have been harder because `test` couldn't
do float comparisons.
cleanup:
Don't bother setting a local $TERM_PROGRAM if it's unset: quoting
is enough to keep test happy. For the version numbers, 0"$var" is safe
against unset variables for numerical comparisons.
[1]: https://github.com/fish-shell/fish-shell/wiki/Terminal.app-characteristics
Instead of maybe adding "-s" and "-M" if "-s" hasn't already been
given, just add "-s" to _every_ bind invocation, and "-M" to those who
need it.
Fixes#5028.
Largely reverts 007d794b6e.
fish_indent is extremely resource-intensive on large inputs and can crash; it also does not handle
invalid characters gracefully.
Work on #5402.
The solarized themes now define pager colors, while other schemes
don't.
So if a user picks one of them, and then another, they'd keep the
pager colors.
Instead, since the default theme is now complete, any theme that does
not define its own pager colors will always get the default ones.
[ci skip]
This was missing a bunch of variables from __fish_config_interactive.
Ideally we wouldn't have to duplicate this info, but I don't have a
great solution either.
This removes ~140ms from every single prompt.
When not in a git repo, this prompt now takes ~9ms, as opposed to
~150ms before.
Fixes#5266 harder.
[ci skip]
This is quite ugly, but in lieu of putting in a proper ansi
parser (i.e. the output part of a terminal), since this is the only
such sequence we have seen until now, let's just match it.
Fixes#5312.
[ci skip]
- Remove use of `eval`
- Use `git rev-parse` instead of `git status` as its faster,
- especially in large repos. (in qt5: 600ms vs 1ms)
- Use return status instead of test -n
This should change nothing about the output.
This uses some more string, but the main improvement is using "git
rev-list" instead of parsing "git branch" output that happens to be localized.
[ci skip]
I can't see the value in this, given that we have a bunch of minimalist ones.
The "escaping" here is gnarly enough that I don't want to attempt to clean it up.
man.fish can be clarified a bit, by removing a superfluous early return. Additionally, performance can be
(ever so slightly) improved, by using the empty string to suffix an extra colon when `$MANPATH` is empty, as
described in `manpath(1)`. As `man` will internally call `manpath` as it starts, this eliminates a redundancy.
This adds the color variables from the docs to both the python script
and the js controller.
Among others, this includes "search_match", i.e.
"fish_color_search_match".
It still does not include the pager colors because the variable names
wouldn't match.
`ls` was suggesting options that are are not valid for my system,
omitting options that are on my system. Different BSD OSes have
different option extensions, and some of them do conflict with eachother.
I carefully checked the manuals of netbsd, macos, freebsd, and openbsd
`ls` and made the completions show the right completions in full for them.
Some verbiage tweaks as well.
- No longer uses sed, sort, uniq, uname
- Stop doing too-clever filtering (e.g. the kernel thread stuff never
- really worked)
- Don't truncate for all OSen, instead just use the (correctly
- truncated) comm field.
- Colorize history search output when interactive, using
fish_indent. This is the same way we colorize `type` output.
- Ask less to act like `cat` if the output will fit in the
terminal window, so it's less jaring with short output.
- history is viewed in a pager when interactive, but pagers
typically strip escape codes. We accomplish the above by
doing exactly what `git` does[1] when it has colored output
for a pager:
if $LESS is unset, set it to enable -R, -F, and -X options.
if $LV is unset, set it to -c.
[1]: 398dd4bd03/pager.c (L87)
Fixes some potentially unsafe uses of direct substitution into regex
expressions and also switches some completions to regex-based now that
there is a safe way of using it.
In writing the completion script for openocd I found the need to
complete paths at the command-line as if they were relative to a
path other than the current $PWD. Given that `$PWD` is currently
global in fish (i.e. no side-effect free `cd` within a subshell)
this is probably good to have for other completions too.
This also fixes a bug in support for explicitly supplying the
description for completions via a `$argv` parameter, which prefixed
the description with `\t` (which is correct) except it did so in
the local scope within an `if` statement, meaning the changes never
had any effect and in the output the description was directly
concatenated to the completions, instead of separated by a tab.
Incorrectly assumed that pandoc uses XDG_CONFIG_HOME, it turns out the
path is hard-coded as $HOME/.pandoc unless explicitly otherwise
specified in the command-line.
Don't attempt to complete against package names if the user is trying to
enter a switch to speed things up.
Also work around #5267 by not wrapping unfiltered `all-the-package-name`
calls in a function.
We do a bunch of escaping before to make `eval` work, and that needs to be removed as well or fragment-urls don't work.
This reverts commit e9568069a7.
Use clang/clang++'s own autocompletion support to complete arguments. It
is rather convoluted as clang generates autocompletions for a portion of
the current token rather than the entire token, e.g. while `--st` will
autocomplete to `--std=` (which is fine by fish), `--std=g` will
autocomplete to `gnu...` without the leading `--std=` which breaks fish'
support for the completion.
Additionally, on systems where clang/clang++ is the system compiler
(such as FreeBSD), it is very often for users to invoke a newer version
of clang/clang++ installed as clang[++]-NN instead of clang. Using a
monkey-patched version of `complete -p` to support that without breaking
(future) completions for commands like `clang-format`.
Closes#4174.
If you're using the old binding that only clears the commandline and
doesn't preserve its contents and start a new line, you can use
```fish
bind \cc "commandline -f cancel; commandline ''"
```
instead.
Closes#4298.
For some weird reason we only used $editor if it wasn't empty, but
then failed to fail if it was.
This will now print an error and use fish, just like if the $EDITOR
value is invalid in any other way.
Fixes#5257.
This is a wrapper that calls kitty to dynamically provide completions,
as generated by kitty itself, via `kitty + complete setup fish`.
ref: https://sw.kovidgoyal.net/kitty/#fish
The hg prompt walks up the directory hierarchy to decide if we are in a
repo subdirectory. Because hg is an external command, it resolves symlinks.
Switch to using pwd -P so hg and fish will have the same view of the hg repo.
Based on comment:
https://github.com/fish-shell/fish-shell/pull/5190#issuecomment-421912360
Mostly resolves#4862, though there remains the lingering question of
whether or not to emit a warning to /dev/tty or stderr when a
non-literal-zero index evaluates to zero.
This allows for marking certain bindings as part of a preset, which allows us to
- only erase those when switching presets
- go back to the preset binding when erasing a user binding
- only show user customization if requested
- make bare bind statements in config.fish work (!!!11elf!!!)
Fixes#5191.
Fixes#3699.
- Add support for:
- Jumping to the character before a target.
- Repeating the previous jump (same direction, same precision).
- Repeating the previous jump in the reverse order.
- Enhance vi bindings.
The Informative VCS sample prompt currently sets the `__fish_git_prompt_char_conflictedstate` variable which is unused.
It should instead set the `__fish_git_prompt_char_invalidstate` variable.
Ordering of directories above files was introduced in a recent change to
the same script. By default it does not matter as completions are sorted
by fish internally, but this allows the use of `-k` to sort files before
directories (or piped to `sort -r` for vice-versa).
Use `apt-cache show` instead of `apt-cache packagenames` to efficiently
print package names and a brief description instead of the placeholder
(localized) "Package" text that was previously printed. This applies to
both available and installed packages (for inistall and remove operations,
respectively).
TODO: update `__fish_print_packages` for non-debian platforms to do the
same.
When listing packages already installed (e.g. for use with `apt remove
...`), do not consider packages return by `dpkg --get-selections` with
state 'deinstall'.
Previously the `string replace` pattern was matching both 'install' and
'deinstall' packages.
Utilized the `--install` flag added in commit #8c09d6e.
Limit `eopkg remove/autoremove/check ...` completions to installed packages.
Limit `eopkg install/upgrade/info ...` completions to available packages.
Prior to this fix, __fish_describe_command would error if the
input contained any special characters, because it would be interpolated
into a regex. Hack in a guard to do nothing if the input contains
anything other than [a-zA-Z0-9_ ]
* update nim.fish sample prompt
- Use an helper function to wrap informations
- Add VIRTUAL_ENV infos, if any
- Add __fish_git_prompt, wrapped for the theme
- Add comments
- Remove ASCII failback symbols for tty
(no more useful for me, but if someone really needs it, just ask)
* fish.nim: test -n __fish_git_prompt
Added a new flag `--installed` via `argparse` to `__fish_print_packages`
which indicates that only installed packages should be listed.
TODO: Other non-debian/apt platforms should take advantage of this flag/
behavior as well.
It was only introduced in 2.16, which was released in January 2018.
Instead, we just use a bare "--ignored", which is equivalent to "--ignored=traditional".
The difference to "--ignored=matching" mode shouldn't matter to us here.
Fixes#5074.
Executes `whatis` safely, returns at most one line, and strips the name
of the command from the start of line, returning a value fit for use as
the description parameter for a completion argument value.
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.
I'm not sure what was wrong with the old syntax, but I needed to switch
the outer quotes to ' and the inner quotes to " in order for the
completions to work when they weren't explicitly sourced.
Additionally, realized that the overload for __fish_complete_suffix can
be used to get the filtered list of kernel modules from /boot/kernel in
the initial run.
Allows the most painful of curl's arguments to be completed by fish by
restoring file-based completions for paths prefixed with `@` (which are
typically used after parameters like --data).
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 allows snippets to use everything that is defined in config.fish,
which is our _base_ initialization.
Among other things, it enables snippets to use $PATH as it will appear
in the user's config.fish, or even to change $PATH.
Also, this is how it was in 2.7.1 and before (with the small change
that abbrs were upgraded after).
As defined in the `go help packages`:
Many commands apply to a set of packages:
go action [packages]
Usually, [packages] is a list of import paths.
This patch introduces automatic lookup of said packages from GOPATH
using `go list`, and provides them as options go subcmds.
I'm not sure what was up with the old completions,
`$__fish_service_commands` is not set anywhere and completions for the
command (not the service) were not being generated on my machine.
macOS and (AFAICT) most Linux distributions ship with the Info-ZIP
version of unzip, which has the `unzip -h` flag; but other
implementations of unzip do not necessarily have it (i.e. FreeBSD).
`unzip` under FreeBSD does not support `unzip -h`. Under both Linux and
FreeBSD, `unzip -v` presents the list of options, though. Using this
instead of `unzip -h` to detect the Debian-patched version of the
Info-ZIP unzip program.
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.
These completions are apparently based on an auto-generated version,
so there's a whole bunch of rewording to be done here.
Also for some reason some of the options are mentioned more than once?
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.