Fix remaining static_words and spell.kak for the new list syntax

This commit is contained in:
Shachaf Ben-Kiki 2018-06-16 20:30:40 -07:00 committed by Maxime Coste
parent 7abf04babd
commit 1b9474cd44
12 changed files with 31 additions and 30 deletions

View File

@ -68,8 +68,8 @@ evaluate-commands %sh{
# Add the language's grammar to the static completion list # Add the language's grammar to the static completion list
printf %s\\n "hook global WinSetOption filetype=d %{ printf %s\\n "hook global WinSetOption filetype=d %{
set-option window static_words '${keywords}:${attributes}:${types}:${values}:${decorators}:${properties}' set-option window static_words ${keywords} ${attributes} ${types} ${values} ${decorators} ${properties}
}" | tr '|' ':' }" | tr '|' ' '
# Highlight keywords # Highlight keywords
printf %s " printf %s "

View File

@ -37,8 +37,8 @@ evaluate-commands %sh{
# Add the language's grammar to the static completion list # Add the language's grammar to the static completion list
printf %s\\n "hook global WinSetOption filetype=go %{ printf %s\\n "hook global WinSetOption filetype=go %{
set-option window static_words '${keywords}:${attributes}:${types}:${values}:${functions}' set-option window static_words '${keywords} ${attributes} ${types} ${values} ${functions}'
}" | tr '|' ':' }" | tr '|' ' '
# Highlight keywords # Highlight keywords
printf %s " printf %s "

View File

@ -41,8 +41,8 @@ evaluate-commands %sh{
# Add the language's grammar to the static completion list # Add the language's grammar to the static completion list
printf %s\\n "hook global WinSetOption filetype=perl %{ printf %s\\n "hook global WinSetOption filetype=perl %{
set-option window static_words '${keywords}:${attributes}:${values}' set-option window static_words ${keywords} ${attributes} ${values}
}" | tr '|' ':' }" | tr '|' ' '
# Highlight keywords # Highlight keywords
printf %s " printf %s "

View File

@ -62,8 +62,8 @@ evaluate-commands %sh{
# Add the language's grammar to the static completion list # Add the language's grammar to the static completion list
printf %s\\n "hook global WinSetOption filetype=ruby %{ printf %s\\n "hook global WinSetOption filetype=ruby %{
set-option window static_words '${keywords}:${attributes}:${values}:${meta}' set-option window static_words ${keywords} ${attributes} ${values} ${meta}
}" | tr '|' ':' }" | tr '|' ' '
# Highlight keywords # Highlight keywords
printf %s " printf %s "

View File

@ -42,14 +42,14 @@ Formats of language supported:
fi fi
word=$(printf %s\\n "$line" | cut -d ' ' -f 2) word=$(printf %s\\n "$line" | cut -d ' ' -f 2)
len=$(printf %s "$word" | wc -c) len=$(printf %s "$word" | wc -c)
regions="$regions:$line_num.$pos+${len}|Error" regions="$regions $line_num.$pos+${len}|Error"
;; ;;
'') line_num=$((line_num + 1));; '') line_num=$((line_num + 1));;
\*) ;; \*) ;;
*) printf 'echo -markup %%{{Error}%s}\n' "${line}" | kak -p "${kak_session}";; *) printf 'echo -markup %%{{Error}%s}\n' "${line}" | kak -p "${kak_session}";;
esac esac
done done
printf 'set-option "buffer=%s" spell_regions %%{%s}' "${kak_bufname}" "${regions}" \ printf 'set-option "buffer=%s" spell_regions %s' "${kak_bufname}" "${regions}" \
| kak -p "${kak_session}" | kak -p "${kak_session}"
} }
rm -rf $(dirname "$kak_opt_spell_tmp_file") rm -rf $(dirname "$kak_opt_spell_tmp_file")
@ -62,15 +62,16 @@ define-command spell-next %{ evaluate-commands %sh{
anchor_col="${kak_selection_desc%%,*}" anchor_col="${kak_selection_desc%%,*}"
anchor_col="${anchor_col##*.}" anchor_col="${anchor_col##*.}"
start_first="${kak_opt_spell_regions#*:}" start_first="${kak_opt_spell_regions#* }"
start_first="${start_first%%|*}" start_first="${start_first%%|*}"
start_first="${start_first#'}"
find_next_word_desc() { find_next_word_desc() {
## XXX: the `spell` command adds sorted selection descriptions to the range ## XXX: the `spell` command adds sorted selection descriptions to the range
printf %s\\n "${1}" \ printf %s\\n "${1}" \
| sed -e 's/^[0-9]*://' -e 's/|[^:]*//g' -e 's/,/ /g' \ | sed -e "s/'//g" -e 's/^[0-9]* //' -e 's/|[^ ]*//g' \
| tr ':' '\n' \ | tr ' ' '\n' \
| while read -r start end; do | while IFS=, read -r start end; do
start_line="${start%.*}" start_line="${start%.*}"
start_col="${start#*.}" start_col="${start#*.}"
end_line="${end%.*}" end_line="${end%.*}"

View File

@ -80,8 +80,8 @@ evaluate-commands %sh{
# Add the language's grammar to the static completion list # Add the language's grammar to the static completion list
printf %s\\n "hook global WinSetOption filetype=sql %{ printf %s\\n "hook global WinSetOption filetype=sql %{
set-option window static_words '${keywords}:${operators}:${functions}:${data_types}:${data_types_fn}:NULL' set-option window static_words ${keywords} ${operators} ${functions} ${data_types} ${data_types_fn} NULL
}" | tr '|' ':' }" | tr '|' ' '
# Highlight keywords # Highlight keywords
printf %s " printf %s "

View File

@ -24,8 +24,8 @@ evaluate-commands %sh{
# Add the language's grammar to the static completion list # Add the language's grammar to the static completion list
printf %s\\n "hook global WinSetOption filetype=makefile %{ printf %s\\n "hook global WinSetOption filetype=makefile %{
set-option window static_words '${keywords}' set-option window static_words ${keywords}
}" | tr '|' ':' }" | tr '|' ' '
# Highlight keywords # Highlight keywords
printf %s "add-highlighter shared/makefile/content regex \b(${keywords})\b 0:keyword" printf %s "add-highlighter shared/makefile/content regex \b(${keywords})\b 0:keyword"

View File

@ -103,8 +103,8 @@ evaluate-commands %sh{
# Add the language's grammar to the static completion list # Add the language's grammar to the static completion list
printf %s\\n "hook global WinSetOption filetype=python %{ printf %s\\n "hook global WinSetOption filetype=python %{
set-option window static_words '${values}:${meta}:${attributes}:${methods}:${exceptions}:${keywords}:${types}:${functions}' set-option window static_words ${values} ${meta} ${attributes} ${methods} ${exceptions} ${keywords} ${types} ${functions}
}" | tr '|' ':' }" | tr '|' ' '
# Highlight keywords # Highlight keywords
printf %s " printf %s "

View File

@ -23,8 +23,8 @@ evaluate-commands %sh{
# Add the language's grammar to the static completion list # Add the language's grammar to the static completion list
printf %s\\n "hook global WinSetOption filetype=sh %{ printf %s\\n "hook global WinSetOption filetype=sh %{
set-option window static_words '${keywords}' set-option window static_words ${keywords}
}" | tr '|' ':' }" | tr '|' ' '
# Highlight keywords # Highlight keywords
printf %s "add-highlighter shared/sh/code regex \b(${keywords})\b 0:keyword" printf %s "add-highlighter shared/sh/code regex \b(${keywords})\b 0:keyword"

View File

@ -25,8 +25,8 @@ evaluate-commands %sh{
# Add the language's grammar to the static completion list # Add the language's grammar to the static completion list
printf %s\\n "hook global WinSetOption filetype=dockerfile %{ printf %s\\n "hook global WinSetOption filetype=dockerfile %{
set window static_words 'ONBUILD|${keywords}' set window static_words ONBUILD|${keywords}
}" | tr '|' ':' }" | tr '|' ' '
# Highlight keywords # Highlight keywords
printf %s " printf %s "

View File

@ -40,8 +40,8 @@ evaluate-commands %sh{
# Add the language's grammar to the static completion list # Add the language's grammar to the static completion list
printf %s\\n "hook global WinSetOption filetype=nim %{ printf %s\\n "hook global WinSetOption filetype=nim %{
set-option window static_words '${keywords}:${types}:${values}' set-option window static_words ${keywords} ${types} ${values}
}" | tr '|' ':' }" | tr '|' ' '
# Highlight keywords # Highlight keywords
printf %s " printf %s "

View File

@ -35,11 +35,11 @@ evaluate-commands %sh{
# Add the language's grammar to the static completion list # Add the language's grammar to the static completion list
static_words="${values}:${meta}:${keywords}:${types_decl}:${capabilities}" static_words="${values} ${meta} ${keywords} ${types_decl} ${capabilities}"
static_words="${static_words}::${struct}" static_words="${static_words} ${struct}"
printf %s\\n "hook global WinSetOption filetype=pony %{ printf %s\\n "hook global WinSetOption filetype=pony %{
set-option window static_words '${static_words}' set-option window static_words ${static_words}
}" | tr '|' ':' }" | tr '|' ' '
# Highlight keywords # Highlight keywords
printf %s " printf %s "