mirror of
https://github.com/fish-shell/fish-shell
synced 2024-12-26 04:43:10 +00:00
Fix pygmentize completion
The previous implementation didn't take into account that a lexer could have multiple names and gave `cpp, c++` instead of `cpp` and `c++` when completing `pygmentize -l c`.
This commit is contained in:
parent
885de80a0e
commit
0785260365
1 changed files with 6 additions and 2 deletions
|
@ -1,8 +1,12 @@
|
|||
function __fish_print_pygmentize
|
||||
set -l lines (pygmentize -L $argv[1] | string match -r '^(?:\* | ).*(?:)$' | string replace -r '\* (.*):$' '$1' | string replace -r '^(.*).$' '$1' | string trim)
|
||||
set -l lines (pygmentize -L $argv[1] | string match -r '^(?:\* | ).*(?:)$' | string replace -r '\* (.*):$' '$1' | string replace -r '^(.*)\.$' '$1' | string trim)
|
||||
|
||||
while set -q lines[2]
|
||||
printf '%s\t%s\n' $lines[1] $lines[2]
|
||||
set -l names (string split ", " $lines[1])
|
||||
for name in $names
|
||||
printf '%s\t%s\n' $name $lines[2]
|
||||
end
|
||||
|
||||
set -e lines[1]
|
||||
set -e lines[1]
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue