dotfiles/.config/kak/autoload/ltex-dict.kak

23 lines
909 B
Text

provide-module ltex-dict %~
declare-option str ltex_dict_path %exp{%val{config}/ltex-dict.txt}
define-command ltex-dict-set %{
set-option buffer lsp_servers %sh{
echo >/tmp/test.txt
list="$(cat "$kak_opt_ltex_dict_path" | kak -f '<a-o>%<a-J>Zbi\"<esc>a\"<esc>z<a-,>r,x_i[<esc>a]<esc>')"
notify-send "$list"
echo "$kak_opt_lsp_servers" | sed "/^\s*dictionary =/ s/\[\]/$list/g"
echo "$kak_opt_lsp_servers" | sed "/^\s*dictionary =/ s/\[\]/REPLACED/g" >/tmp/test.txt
}
}
define-command ltex-add %{
execute-keys -draft %sh{
if [ "$kak_selection_length" = 1 ]; then
printf 'bw_<a-|>{ cat; echo; } | tee -a %s<ret>\n' "$kak_opt_ltex_dict_path"
else
printf '<a-|>{ cat; echo; } | tee -a %s<ret>\n' "$kak_opt_ltex_dict_path"
fi
}
}
~