Small optimization in clojure.kak awk script

This commit is contained in:
Maxime Coste 2019-01-20 12:32:31 +11:00
parent a35a1591d0
commit a9ee4e8af4

View File

@ -122,18 +122,14 @@ evaluate-commands %sh{
"*print-length* *print-level* *print-meta* *print-namespace-maps* "\ "*print-length* *print-level* *print-meta* *print-namespace-maps* "\
"*print-readably* *read-eval* *unchecked-math* *warn-on-reflection*", core_vars); "*print-readably* *read-eval* *unchecked-math* *warn-on-reflection*", core_vars);
} }
function print_word_highlighter(words, face) { function print_word_highlighter(words, face, first) {
printf("add-highlighter shared/clojure/code/ regex (?<!%s)%s(", \ printf("add-highlighter shared/clojure/code/ regex (?<!%s)%s(", \
symbol_char, in_core); symbol_char, in_core);
first = 1; first = 1;
for (i in words) { for (i in words) {
if (!first) { if (!first) { printf("|"); }
printf("|"); printf("\\Q%s\\E", words[i]);
}
first = 0; first = 0;
word = words[i];
gsub(/[+?#*\.]/, "\\\\&", word);
printf("%s", word);
} }
printf(")(?!%s) 0:%s\n", symbol_char, face); printf(")(?!%s) 0:%s\n", symbol_char, face);
} }