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{ list="$(cat "$kak_opt_ltex_dict_path" | kak -f '%Zbi\"a\"zr,x_i[a]')" echo "$kak_opt_lsp_servers" | sed "/^\s*dictionary =/ s/\[\]/$list/g" } } define-command ltex-add %{ evaluate-commands %sh{ if [ "$kak_selection_length" = 1 ]; then printf 'execute-keys bw_tee -a /tmp/test.txt' } } ~