Fix 'string length: Unknown option': add `--` before $subcommand
Fix count $subcommand always = 1 with `sudo` and `doas`:
give argv as array to __fish_complete_subcommand
[ci skip]
This mostly fixes some wrong indents or replaces some stray tab indents.
I excluded alignment on purpose, because we have a whole bunch of code
that goes like
```fish
complete -c foo -n 'some-condition' -l someoption
complete -c foo -n 'some-longer-condition' -l someotheroption
```
and changing it seems like a larger thing and would include more
thrashing.
See #3622.
This would have prevented #6323.
While we don't want to pepper `command` everywhere, `psub` is kind of
a core thing, so we should try to proof it against common problems.
This reverts commit f620ddf03b.
Setting the paste handler isn't performance-sensitive.
On the other hand setting it this way makes things less transparent,
less flexible (if e.g. a paste handler is installed while the shell is running),
and causes #6286.
Fixes#6286.
[ci skip]
Presently the completion engine ignores builtins that are part of the
fish syntax. This can be a problem when completing a string that was
based on the output of `commandline -p`. This changes completions to
treat these builtins like any other command.
This also disables generic (filename) completion inside comments and
after strings that do not tokenize.
Additionally, comments are stripped off the output of `commandline -p`.
Fixes#5415Fixes#2705
This just makes more sense, as people don't want to enter exact
matches if they delete interactively.
It also brings it in line with "search".
Fixes#6142
Rejects #6070
MacOS Catalina apparently ships a stripped down svn that doesn't have
`svnversion`, which we use to print the revision.
For now skip the entire step to remove error spam.
Fixes#6267.
[ci skip]
Every builtin or function shipped with fish supports flag -h or --help to
print a slightly condensed version of its manpage.
Some of those help messages are longer than a typical screen;
this commit pipes the help to a pager to make it easier to read.
As in other places in fish we assume that either $PAGER or "less" is a
valid pager and use that.
In three places (error messages for bg, break and continue) the help is
printed to stderr instead of stdout. To make sure the error message is
visible in the pager, we pass it to builtin_print_help, every call of which
needs to be updated.
Fixes#6227
* functions/__fish_print_hostnames: Fix ssh_configs no values return
`string replace` not working with mutlilines variable.
So split per line first.
* functions/__fish_print_hostnames: remove quotes at `split '\n'`
"\n with quotes" will cause `string split` weird issues.
* functions/__fish_print_hostnames: using `read -alz -d \n`
Fix `$contents` issues together
Corrects #6110
BSD `seq` produces a down-counting sequence when the second argument is
smaller than the first, e.g.:
$ seq 2 1
2
1
$
While GNU `seq` produces no output at all:
$ seq 2 1
$
To accommodate for this behavior, only run `seq` when we are sure that
the second argument is greater than or equal to the first (in this case,
the second argument `line_count` should be greater than 1).
Revert "gut gpg.fish/gpg1.fish/gpg2.fish; migrate functionality to __fish_complete_gpg.fish"
This reverts commit d558218d03.
Revert "break version-specific completions out into independent function;"
This reverts commit 9160e77b01.
Revert "split gpg2- and gpg1-specific completions to conditional block"
This reverts commit a069b95f63.
* Fix default Alt+W keybinding
The old keybinding would chop off the last line of the `whatis` output
when using a multi-line prompt. This fix corrects that.
* Make variable local and remove unneeded if statement
* Test that token is non-empty
Reproducer: type `: \<RET><M-p>`. This used to print an error due to builtin test receiving
too many arguments.
It looks like (commandline -j) can return multiple items, because a job can be broken up in multiple
lines terminated by backslashes.
With the new support for self-insert inserting a bound sequence,
the default binding for space as expanding abbreviations can be simplified
to just `self-insert expand-abbr`. This also fixes the bug where space
would cancel pager search.