From 0785260365b4394a40410676c3c2b72e777113a3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment=20Martinez?= Date: Fri, 2 Dec 2016 15:33:04 +0100 Subject: [PATCH] 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`. --- share/completions/pygmentize.fish | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/share/completions/pygmentize.fish b/share/completions/pygmentize.fish index aefa7bc65..8e3c0fe7a 100644 --- a/share/completions/pygmentize.fish +++ b/share/completions/pygmentize.fish @@ -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