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
printf %s\\n "hook global WinSetOption filetype=d %{
set-option window static_words '${keywords}:${attributes}:${types}:${values}:${decorators}:${properties}'
}" | tr '|' ':'
set-option window static_words ${keywords} ${attributes} ${types} ${values} ${decorators} ${properties}
}" | tr '|' ' '
# Highlight keywords
printf %s "

View File

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

View File

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

View File

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

View File

@ -42,14 +42,14 @@ Formats of language supported:
fi
word=$(printf %s\\n "$line" | cut -d ' ' -f 2)
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));;
\*) ;;
*) printf 'echo -markup %%{{Error}%s}\n' "${line}" | kak -p "${kak_session}";;
esac
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}"
}
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="${anchor_col##*.}"
start_first="${kak_opt_spell_regions#*:}"
start_first="${kak_opt_spell_regions#* }"
start_first="${start_first%%|*}"
start_first="${start_first#'}"
find_next_word_desc() {
## XXX: the `spell` command adds sorted selection descriptions to the range
printf %s\\n "${1}" \
| sed -e 's/^[0-9]*://' -e 's/|[^:]*//g' -e 's/,/ /g' \
| tr ':' '\n' \
| while read -r start end; do
| sed -e "s/'//g" -e 's/^[0-9]* //' -e 's/|[^ ]*//g' \
| tr ' ' '\n' \
| while IFS=, read -r start end; do
start_line="${start%.*}"
start_col="${start#*.}"
end_line="${end%.*}"

View File

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

View File

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

View File

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

View File

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

View File

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