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 '%Zbi\"a\"zr,x_i[a]')" 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_{ cat; echo; } | tee -a %s\n' "$kak_opt_ltex_dict_path" else printf '{ cat; echo; } | tee -a %s\n' "$kak_opt_ltex_dict_path" fi } } ~