- 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.
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.
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
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.
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_ ]
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.
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.