AutoYADM commit: 2025-06-14 02:45:38

This commit is contained in:
Daniel Fichtinger 2025-06-14 02:45:38 -04:00
parent 0d8b5aa3cd
commit 5e2ea8c965
3 changed files with 10 additions and 9 deletions

View file

@ -154,7 +154,6 @@ hook -group lsp-filetype-python global BufSetOption filetype=python %{
remove-hooks global lsp-filetype-latex remove-hooks global lsp-filetype-latex
hook -group lsp-filetype-latex global BufSetOption filetype=latex %{ hook -group lsp-filetype-latex global BufSetOption filetype=latex %{
declare-option str foobartest %{ declare-option str foobartest %{
dictionary = { "en-US" = ["builtin", "Fichtinger", "SonarAuth", "sexpenis" ], "en-CA" = ["more", "words"] }
} }
set-option buffer lsp_servers %{ set-option buffer lsp_servers %{
[ltex-ls-plus] [ltex-ls-plus]
@ -163,7 +162,8 @@ hook -group lsp-filetype-latex global BufSetOption filetype=latex %{
# TODO: write a script where the dictionary is a list of words # TODO: write a script where the dictionary is a list of words
# that's read from a file and then output in TOML format. # that's read from a file and then output in TOML format.
# This way we can implement adding our own words to this list dynamically # This way we can implement adding our own words to this list dynamically
%opt{foobartest} # dictionary = { "en-US" = ["builtin", "Fichtinger", "SonarAuth", "sexpenis" ], "en-CA" = ["more", "words"] }
dictionary = { "en-US" = [] }
[texlab] [texlab]
root_globs = [".git", ".hg"] root_globs = [".git", ".hg"]
@ -192,6 +192,8 @@ hook -group lsp-filetype-latex global BufSetOption filetype=latex %{
""", """,
] ]
} }
require-module ltex-dict
ltex-dict-set
define-command -docstring 'Add selection to ltex-ls dictionary' ltex-add %{ define-command -docstring 'Add selection to ltex-ls dictionary' ltex-add %{
set-option buffer lsp_servers %sh{ set-option buffer lsp_servers %sh{
printf %s "$kak_opt_lsp_servers" | kak -f "$(printf '<a-s><a-k>dictionary =<ret>s\\[.*\\]<ret><a-i>]_a, "%s"' "$kak_selection")" printf %s "$kak_opt_lsp_servers" | kak -f "$(printf '<a-s><a-k>dictionary =<ret>s\\[.*\\]<ret><a-i>]_a, "%s"' "$kak_selection")"

View file

@ -5,14 +5,15 @@ provide-module ltex-dict %~
'%<a-J>Zbi"<esc>a"<esc>z<a-,>r,x_i[<esc>a]<esc>' '%<a-J>Zbi"<esc>a"<esc>z<a-,>r,x_i[<esc>a]<esc>'
} }
define-command ltex-dict-set %{ define-command ltex-dict-set %{
declare-option str foobartest '' # declare-option str foobartest ''
set-option buffer foobartest %sh{ set-option buffer lsp_servers %sh{
# printf %s "$kak_opt_lsp_servers" | sed # printf %s "$kak_opt_lsp_servers" | sed
list="$(cat "$kak_opt_ltex_dict_path" | kak -f '%<a-J>Zbi"<esc>a"<esc>z<a-,>r,x_i[<esc>a]<esc>')" list="$(cat "$kak_opt_ltex_dict_path" | kak -f '%<a-J>Zbi"<esc>a"<esc>z<a-,>r,x_i[<esc>a]<esc>')"
# cat /tmp/lspconf.txt | sed "/^\s*dictionary =/ s/\[\]/$list/g" # cat /tmp/lspconf.txt | sed "/^\s*dictionary =/ s/\[\]/$list/g"
printf "$kak_opt_lsp_servers" | sed "/^\s*dictionary =/ s/\[\]/$list/g" echo "$kak_opt_lsp_servers" | sed "/^\s*dictionary =/ s/\[\]/$list/g"
} }
echo -debug %opt{foobartest} echo -debug %opt{lsp_servers}
# echo -debug %opt{foobartest}
} }
~ ~

View file

@ -1,4 +1,2 @@
foobartest
apple apple
banana
cherry