forked from BurntSushi/ripgrep
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
complete/fish: Make fish completion more intelligent
- Stop using `-n __fish_use_subcommand`. This had the effect of ignoring options if a positional argument has already been given, but that's not how ripgrep works. - Only suggest negation options if the option they're negating is passed (e.g., only complete `--no-pcre2` if `--pcre2` is present). The zsh completions already do this. - Take into account whether an option takes an argument. If an option is not a switch then it won't suggest further options until the argument is given, e.g. `-C<tab>` won't suggest options but `-i<tab>` will. - Suggest correct arguments for options. We already completed a fixed set of choices where available, but now we go further: - Filenames are only suggested for options that take filenames. - `--pre` and `--hostname-bin` suggest binaries from `$PATH`. - `-t`/`--type`/&c use `--type-list` for suggestions, like in zsh, with a preview of the glob patterns. - `--encoding` uses a hardcoded list extracted from the zsh completions. This has been refactored into a separate file, and the range globs (`{1..5}`) replaced by comma globs (`{1,2,3,4,5}`) since those work in both shells. I verified that this produces the same list as before in zsh, and the same list in fish (albeit in a different order). PR BurntSushi#2684
- Loading branch information
1 parent
56c7ad1
commit af4ed71
Showing
8 changed files
with
131 additions
and
52 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
# This is impossible to read, but these encodings rarely if ever change, so | ||
# it probably does not matter. They are derived from the list given here: | ||
# https://encoding.spec.whatwg.org/#concept-encoding-get | ||
# | ||
# The globbing here works in both fish and zsh (though they expand it in | ||
# different orders). It may work in other shells too. | ||
|
||
{{,us-}ascii,arabic,chinese,cyrillic,greek{,8},hebrew,korean} | ||
logical visual mac {,cs}macintosh x-mac-{cyrillic,roman,ukrainian} | ||
866 ibm{819,866} csibm866 | ||
big5{,-hkscs} {cn-,cs}big5 x-x-big5 | ||
cp{819,866,125{0,1,2,3,4,5,6,7,8}} x-cp125{0,1,2,3,4,5,6,7,8} | ||
csiso2022{jp,kr} csiso8859{6,8}{e,i} | ||
csisolatin{1,2,3,4,5,6,9} csisolatin{arabic,cyrillic,greek,hebrew} | ||
ecma-{114,118} asmo-708 elot_928 sun_eu_greek | ||
euc-{jp,kr} x-euc-jp cseuckr cseucpkdfmtjapanese | ||
{,x-}gbk csiso58gb231280 gb18030 {,cs}gb2312 gb_2312{,-80} hz-gb-2312 | ||
iso-2022-{cn,cn-ext,jp,kr} | ||
iso8859{,-}{1,2,3,4,5,6,7,8,9,10,11,13,14,15} | ||
iso-8859-{1,2,3,4,5,6,7,8,9,10,11,{6,8}-{e,i},13,14,15,16} iso_8859-{1,2,3,4,5,6,7,8,9,15} | ||
iso_8859-{1,2,6,7}:1987 iso_8859-{3,4,5,8}:1988 iso_8859-9:1989 | ||
iso-ir-{58,100,101,109,110,126,127,138,144,148,149,157} | ||
koi{,8,8-r,8-ru,8-u,8_r} cskoi8r | ||
ks_c_5601-{1987,1989} ksc{,_}5691 csksc56011987 | ||
latin{1,2,3,4,5,6} l{1,2,3,4,5,6,9} | ||
shift{-,_}jis csshiftjis {,x-}sjis ms_kanji ms932 | ||
utf{,-}8 utf-16{,be,le} unicode-1-1-utf-8 | ||
windows-{31j,874,949,125{0,1,2,3,4,5,6,7,8}} dos-874 tis-620 ansi_x3.4-1968 | ||
x-user-defined auto none |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters