mirror of
https://github.com/elkowar/dots-of-war.git
synced 2024-12-26 06:02:23 +00:00
More latex stuff
This commit is contained in:
parent
a06faa9507
commit
b5cab2b19f
4 changed files with 80 additions and 56 deletions
|
@ -4,12 +4,11 @@
|
||||||
lsp lspconfig
|
lsp lspconfig
|
||||||
lsp-configs lspconfig/configs
|
lsp-configs lspconfig/configs
|
||||||
utils dots.utils
|
utils dots.utils
|
||||||
|
ltex-ls dots.plugins.ltex-ls
|
||||||
cmp_nvim_lsp cmp_nvim_lsp}
|
cmp_nvim_lsp cmp_nvim_lsp}
|
||||||
|
|
||||||
require-macros [macros]})
|
require-macros [macros]})
|
||||||
|
|
||||||
(require dots.plugins.ltex-ls)
|
|
||||||
|
|
||||||
; TODO check https://github.com/neovim/nvim-lspconfig/blob/master/ADVANCED_README.md for default config for all of them
|
; TODO check https://github.com/neovim/nvim-lspconfig/blob/master/ADVANCED_README.md for default config for all of them
|
||||||
|
|
||||||
(tset vim.lsp.handlers :textDocument/publishDiagnostics
|
(tset vim.lsp.handlers :textDocument/publishDiagnostics
|
||||||
|
@ -81,6 +80,7 @@
|
||||||
|
|
||||||
|
|
||||||
(init-lsp :powershell_es {:bundle_path "/home/leon/powershell"})
|
(init-lsp :powershell_es {:bundle_path "/home/leon/powershell"})
|
||||||
|
(ltex-ls.init)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -8,9 +8,23 @@
|
||||||
cmp_nvim_lsp cmp_nvim_lsp}})
|
cmp_nvim_lsp cmp_nvim_lsp}})
|
||||||
|
|
||||||
|
|
||||||
(local Dictionary-file {:de-DE [(.. (vim.fn.getenv "HOME") "/.config/ltex-ls/dictionary.txt")]})
|
(def latex-command-settings
|
||||||
(local Disabled-rules-file {:de-DE [(.. (vim.fn.getenv "HOME") "/.config/ltex-ls/disable.txt")]})
|
{:dummy ["\\texttt{}"]})
|
||||||
(local False-positives-file {:de-DE [(.. (vim.fn.getenv "HOME") "/.config/ltex-ls/false.txt")]})
|
|
||||||
|
|
||||||
|
|
||||||
|
(def Dictionary-file {:de-DE [(.. (vim.fn.getenv "HOME") "/.config/ltex-ls/dictionary.txt")]})
|
||||||
|
(def Disabled-rules-file {:de-DE [(.. (vim.fn.getenv "HOME") "/.config/ltex-ls/disable.txt")]})
|
||||||
|
(def False-positives-file {:de-DE [(.. (vim.fn.getenv "HOME") "/.config/ltex-ls/false.txt")]})
|
||||||
|
|
||||||
|
|
||||||
|
(def latex-command-settings-formatted
|
||||||
|
(let [tbl {}]
|
||||||
|
(each [option commands (pairs latex-command-settings)]
|
||||||
|
(each [_ command (ipairs commands)]
|
||||||
|
(tset tbl command option))))
|
||||||
|
(tbl))
|
||||||
|
|
||||||
|
|
||||||
(fn read-files [files]
|
(fn read-files [files]
|
||||||
(let [dict {}]
|
(let [dict {}]
|
||||||
|
@ -87,55 +101,58 @@
|
||||||
(lua "return nil")))
|
(lua "return nil")))
|
||||||
(add-to-file filetype lang file value)))
|
(add-to-file filetype lang file value)))
|
||||||
|
|
||||||
(set configs.ltex
|
|
||||||
{:default_config {:cmd [:ltex-ls]
|
|
||||||
:filetypes [:tex :bib :md]
|
|
||||||
:root_dir (fn [filename] (lsputil.path.dirname filename))
|
|
||||||
:settings {:ltex {:enabled [:latex :tex :bib :md]
|
|
||||||
:language "de-DE"
|
|
||||||
:checkFrequency "save"
|
|
||||||
:diagnosticSeverity "information"
|
|
||||||
:setenceCacheSize 5000
|
|
||||||
:additionalRules {:enablePickyRules true
|
|
||||||
:motherTongue "de-DE"}
|
|
||||||
:dictionary {:de-DE (read-files (. Dictionary-file :de-DE))}
|
|
||||||
:disabledRules {:de-DE (read-files (. Disabled-rules-file :de-DE))}
|
|
||||||
:hiddenFalsePositives {:de-DE (read-files (. False-positives-file :de-DE))}}}}})
|
|
||||||
|
|
||||||
(lsp.ltex.setup {:settings {:ltex {:enabled [:latex :tex :bib :md]
|
(defn init []
|
||||||
:language "de-DE"
|
(set configs.ltex
|
||||||
:checkFrequency "save"
|
{:default_config {:cmd [:ltex-ls]
|
||||||
:diagnosticSeverity "information"
|
:filetypes [:tex :bib :md]
|
||||||
:setenceCacheSize 5000
|
:root_dir (fn [filename] (lsputil.path.dirname filename))
|
||||||
:additionalRules {:enablePickyRules true
|
:settings {:ltex {:enabled [:latex :tex :bib :md]
|
||||||
:motherTongue "de-DE"}
|
:language "de-DE"
|
||||||
:dictionary {:de-DE (read-files (. Dictionary-file :de-DE))}
|
:checkFrequency "save"
|
||||||
:disabledRules {:de-DE (read-files (. Disabled-rules-file :de-DE))}
|
:diagnosticSeverity "information"
|
||||||
:hiddenFalsePositives {:de-DE (read-files (. False-positives-file :de-DE))}}}})
|
:setenceCacheSize 5000
|
||||||
|
:additionalRules {:enablePickyRules true
|
||||||
(set lsp.ltex.dictionary_file Dictionary-file)
|
:motherTongue "de-DE"}
|
||||||
(set lsp.ltex.disabledrules_file Disabled-rules-file)
|
:dictionary {:de-DE (read-files (. Dictionary-file :de-DE))}
|
||||||
(set lsp.ltex.falsepostivies_file False-positives-file)
|
:disabledRules {:de-DE (read-files (. Disabled-rules-file :de-DE))}
|
||||||
(local orig-execute-command vim.lsp.buf.execute_command)
|
:hiddenFalsePositives {:de-DE (read-files (. False-positives-file :de-DE))}
|
||||||
|
:latex {:commands latex-command-settings-formatted}}}}})
|
||||||
|
|
||||||
(set vim.lsp.buf.execute_command
|
(lsp.ltex.setup {:settings {:ltex {:enabled [:latex :tex :bib :md]
|
||||||
(fn [command]
|
:language "de-DE"
|
||||||
(if (= command.command :_ltex.addToDictionary)
|
:checkFrequency "save"
|
||||||
(let [arg (. (. command.arguments 1) :words)]
|
:diagnosticSeverity "information"
|
||||||
(each [lang words (pairs arg)]
|
:setenceCacheSize 5000
|
||||||
(each [_ word (ipairs words)]
|
:additionalRules {:enablePickyRules true
|
||||||
(local filetype :dictionary)
|
:motherTongue "de-DE"}
|
||||||
(add-to filetype lang (find-ltex-files filetype lang) word))))
|
:dictionary {:de-DE (read-files (. Dictionary-file :de-DE))}
|
||||||
(= command.command :_ltex.disableRules)
|
:disabledRules {:de-DE (read-files (. Disabled-rules-file :de-DE))}
|
||||||
(let [arg (. (. command.arguments 1) :ruleIds)]
|
:hiddenFalsePositives {:de-DE (read-files (. False-positives-file :de-DE))}}}})
|
||||||
(each [lang rules (pairs arg)]
|
|
||||||
(each [_ rule (ipairs rules)]
|
(set lsp.ltex.dictionary_file Dictionary-file)
|
||||||
(local filetype :disable)
|
(set lsp.ltex.disabledrules_file Disabled-rules-file)
|
||||||
(add-to filetype lang (find-ltex-files filetype lang) rule))))
|
(set lsp.ltex.falsepostivies_file False-positives-file)
|
||||||
(= command.command :_ltex.hideFalsePositives)
|
(local orig-execute-command vim.lsp.buf.execute_command)
|
||||||
(let [arg (. (. command.arguments 1) :falsePositives)]
|
|
||||||
(each [lang rules (pairs arg)]
|
(set vim.lsp.buf.execute_command
|
||||||
(each [_ rule (ipairs rules)]
|
(fn [command]
|
||||||
(local filetype :falsePositive)
|
(if (= command.command :_ltex.addToDictionary)
|
||||||
(add-to filetype lang (find-ltex-files filetype lang) rule))))
|
(let [arg (. (. command.arguments 1) :words)]
|
||||||
(orig-execute-command command))))
|
(each [lang words (pairs arg)]
|
||||||
|
(each [_ word (ipairs words)]
|
||||||
|
(local filetype :dictionary)
|
||||||
|
(add-to filetype lang (find-ltex-files filetype lang) word))))
|
||||||
|
(= command.command :_ltex.disableRules)
|
||||||
|
(let [arg (. (. command.arguments 1) :ruleIds)]
|
||||||
|
(each [lang rules (pairs arg)]
|
||||||
|
(each [_ rule (ipairs rules)]
|
||||||
|
(local filetype :disable)
|
||||||
|
(add-to filetype lang (find-ltex-files filetype lang) rule))))
|
||||||
|
(= command.command :_ltex.hideFalsePositives)
|
||||||
|
(let [arg (. (. command.arguments 1) :falsePositives)]
|
||||||
|
(each [lang rules (pairs arg)]
|
||||||
|
(each [_ rule (ipairs rules)]
|
||||||
|
(local filetype :falsePositive)
|
||||||
|
(add-to filetype lang (find-ltex-files filetype lang) rule))))
|
||||||
|
(orig-execute-command command)))))
|
||||||
|
|
|
@ -6,6 +6,7 @@
|
||||||
(set vim.g.vimtex_view_method "general")
|
(set vim.g.vimtex_view_method "general")
|
||||||
;(set vim.g.vimtex_view_general_viewer "okular")
|
;(set vim.g.vimtex_view_general_viewer "okular")
|
||||||
(set vim.g.vimtex_view_general_viewer "zathura")
|
(set vim.g.vimtex_view_general_viewer "zathura")
|
||||||
|
(set vim.g.vimtex_view_general_options "--synctex-forward @line:1:@tex @pdf")
|
||||||
;(set vim.g.vimtex_view_general_options "--unique file:@pdf#src:@line@tex")
|
;(set vim.g.vimtex_view_general_options "--unique file:@pdf#src:@line@tex")
|
||||||
(set vim.g.vimtex_quickfix_method "pplatex")
|
(set vim.g.vimtex_quickfix_method "pplatex")
|
||||||
(set vim.g.vimtex_quickfix_mode 2)
|
(set vim.g.vimtex_quickfix_mode 2)
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
set default-bg "#282828"
|
set default-bg "#1d2021"
|
||||||
set recolor true
|
set recolor true
|
||||||
set recolor-lightcolor "#282828"
|
set recolor-lightcolor "#282828"
|
||||||
set recolor-darkcolor "#ebdbb2"
|
set recolor-darkcolor "#ebdbb2"
|
||||||
|
@ -7,3 +7,9 @@ set inputbar-bg "#1d2021"
|
||||||
set inputbar-fg "#ebdbb2"
|
set inputbar-fg "#ebdbb2"
|
||||||
set statusbar-bg "#1d2021"
|
set statusbar-bg "#1d2021"
|
||||||
set statusbar-fg "#ebdbb2"
|
set statusbar-fg "#ebdbb2"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
set synctex true
|
||||||
|
set synctex-editor-command "nvim --headless -c \"VimtexInverseSearch %{line} '%{input}'\""
|
||||||
|
set highlight-transparency 0
|
||||||
|
|
Loading…
Reference in a new issue