diff --git a/.config/kak-tree-sitter/config.toml b/.config/kak-tree-sitter/config.toml index adf1adf3..2a50774c 100644 --- a/.config/kak-tree-sitter/config.toml +++ b/.config/kak-tree-sitter/config.toml @@ -1,15 +1,15 @@ [highlight] groups = [ - "punctuation.bracket", - "punctuation.delimiter", - "constant.builtin", - "constant.character.escape", - "constant.numeric", - "string.special.url", - "comment.block.documentation", - "keyword.operator", - "markup.list", + "punctuation.bracket", + "punctuation.delimiter", + "constant.builtin", + "constant.character.escape", + "constant.numeric", + "string.special.url", + "comment.block.documentation", + "keyword.operator", + "markup.list", ] [language.typst] @@ -162,4 +162,24 @@ pin = "aeded3c10b41508c2d044cb8bcf728f9b5138d89" [language.task.queries] path = "runtime/queries/task" +# bibtex +[language.bibtex.grammar.source.git] +url = "https://github.com/latex-lsp/tree-sitter-bibtex" +pin = "ccfd77db0ed799b6c22c214fe9d2937f47bc8b34" + +[language.bibtex.grammar] +path = "src" +compile = "cc" +compile_args = ["-c", "-fpic", "../parser.c", "-I", ".."] +compile_flags = ["-O3"] +link = "cc" +link_args = ["-shared", "-fpic", "parser.o", "-o", "bibtex.so"] +link_flags = ["-O3"] + +[language.bibtex.queries.source.git] +url = "https://github.com/helix-editor/helix" +pin = "fed3edcab70b31b416eb31c2ccf4a979c120d640" + +[language.bibtex.queries] +path = "runtime/queries/bibtex" diff --git a/.config/kak/autoload/filetype.kak b/.config/kak/autoload/filetype.kak index d9d46692..887d2d32 100644 --- a/.config/kak/autoload/filetype.kak +++ b/.config/kak/autoload/filetype.kak @@ -11,6 +11,17 @@ hook global WinSetOption filetype=python %{ } } +hook global WinSetOption filetype=toml %{ + set-option window formatcmd "taplo fmt -" + hook -group toml-auto-format window BufWritePre .* %{ + try format + } + hook -once -always window WinSetOption filetype=.* %{ + unset-option window formatcmd + remove-hooks window toml-auto-format + } +} + hook global WinSetOption filetype=latex %{ set-option window formatcmd "tex-fmt --stdin" hook -group latex-auto-format window BufWritePre .* %{ @@ -126,3 +137,4 @@ hook global BufCreate .*[.](conf) %{ hook global BufCreate .*[.](jinja) %{ set-option buffer filetype html } + diff --git a/.config/kak/autoload/filetype/bibtex.kak b/.config/kak/autoload/filetype/bibtex.kak new file mode 100644 index 00000000..5ce148be --- /dev/null +++ b/.config/kak/autoload/filetype/bibtex.kak @@ -0,0 +1,15 @@ +hook global BufCreate .*[.](bib) %{ + set-option buffer filetype bibtex +} + +hook global WinSetOption filetype=bibtex %{ + set-option window comment_line '%' + set-option window formatcmd "bibtex-tidy - --curly --drop-all-caps --remove-empty-fields --sort-fields --sort=year,author,id --strip-enclosing-braces --trailing-commas" + hook -group bibtex-auto-format window BufWritePre .* %{ + try format + } + hook -once -always WinSetOption filetype=.* %{ + unset-option window formatcmd + remove-hooks window bibtex-auto-format + } +} diff --git a/.config/kak/autoload/lsp.kak b/.config/kak/autoload/lsp.kak index 5f03d9f6..1163a0a2 100644 --- a/.config/kak/autoload/lsp.kak +++ b/.config/kak/autoload/lsp.kak @@ -280,6 +280,7 @@ hook -group lsp-filetype-typst global BufSetOption filetype=typst %{ set-option -add buffer lsp_servers "formatterPrintWidth = %opt{autowrap_column}" } +remove-hooks global lsp-filetype-toml hook -group lsp-filetype-toml global BufSetOption filetype=toml %{ set-option buffer lsp_servers %{ [taplo]