mirror of
https://github.com/elkowar/dots-of-war.git
synced 2024-12-25 21:52:23 +00:00
More latex stuff
This commit is contained in:
parent
b92795c816
commit
a06faa9507
7 changed files with 187 additions and 8 deletions
|
@ -150,6 +150,7 @@
|
|||
:hrsh7th/vim-vsnip-integ {}
|
||||
:rafamadriz/friendly-snippets {}
|
||||
|
||||
:hrsh7th/cmp-omni {}
|
||||
:hrsh7th/cmp-vsnip {}
|
||||
:hrsh7th/cmp-nvim-lsp {}
|
||||
:hrsh7th/cmp-buffer {}
|
||||
|
@ -163,7 +164,8 @@
|
|||
:hrsh7th/cmp-vsnip
|
||||
:hrsh7th/cmp-nvim-lua
|
||||
:hrsh7th/cmp-calc
|
||||
:hrsh7th/cmp-path]
|
||||
:hrsh7th/cmp-path
|
||||
:hrsh7th/cmp-omni]
|
||||
:config #(require "dots.plugins.cmp")}
|
||||
; >>>
|
||||
|
||||
|
|
|
@ -27,6 +27,7 @@
|
|||
|
||||
:sources [{:name "nvim_lsp" :priority 5}
|
||||
{:name "vsnip" :priority 3}
|
||||
{:name "omni"}
|
||||
{:name "nvim_lua"}
|
||||
{:name "calc"}
|
||||
{:name "path"}
|
||||
|
|
|
@ -8,6 +8,8 @@
|
|||
|
||||
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
|
||||
|
||||
(tset vim.lsp.handlers :textDocument/publishDiagnostics
|
||||
|
@ -60,7 +62,7 @@
|
|||
((. lsp lsp-name :setup) merged-opts)))
|
||||
|
||||
(init-lsp :jsonls {:commands {:Format [ #(vim.lsp.buf.range_formatting [] [0 0] [(vim.fn.line "$") 0])]}})
|
||||
(init-lsp :denols {:root_dir (better_root_pattern [".git"] ["package.json"])})
|
||||
;(init-lsp :denols {:root_dir (better_root_pattern [".git"] ["package.json"])})
|
||||
(init-lsp :hls {:settings {:languageServerHaskell {:formattingProvider "stylish-haskell"}}})
|
||||
(init-lsp :ocamllsp)
|
||||
(init-lsp :vimls)
|
||||
|
@ -72,6 +74,11 @@
|
|||
(init-lsp :svelte)
|
||||
(init-lsp :elmls)
|
||||
(init-lsp :texlab)
|
||||
;(init-lsp :ltex {:settings {:ltex {:dictionary {:de-DE [":~/.config/ltex-ls/dictionary.txt"]}
|
||||
;:disabledRules {:de-DE [":~/.config/ltex-ls/disabledRules.txt"]}
|
||||
;:hiddenFalsePositives {:de-DE [":~/.config/ltex-ls/hiddenFalsePositives.txt"]}
|
||||
;:additionalRules {:motherTongue "de-DE"}}}})
|
||||
|
||||
|
||||
(init-lsp :powershell_es {:bundle_path "/home/leon/powershell"})
|
||||
|
||||
|
@ -85,10 +92,10 @@
|
|||
|
||||
|
||||
|
||||
((. (require "grammar-guard") :init))
|
||||
(init-lsp :grammar_guard {:cmd "~/.local/share/nvim/lsp_servers/ltex/ltex-ls/bin/ltex-ls"
|
||||
:settings {:ltex {:language "de"
|
||||
:enabled ["latex" "tex"]}}})
|
||||
;((. (require "grammar-guard") :init))
|
||||
;(init-lsp :grammar_guard {:cmd "~/.local/share/nvim/lsp_servers/ltex/ltex-ls/bin/ltex-ls"
|
||||
;:settings {:ltex {:enabled ["latex" "tex"]
|
||||
;:additionalRules {:motherTongue "de-DE"}}}})
|
||||
|
||||
|
||||
|
||||
|
|
141
nvim/.config/nvim/fnl/dots/plugins/ltex-ls.fnl
Normal file
141
nvim/.config/nvim/fnl/dots/plugins/ltex-ls.fnl
Normal file
|
@ -0,0 +1,141 @@
|
|||
(module dots.plugins.ltex-ls
|
||||
{autoload {a aniseed.core
|
||||
str aniseed.string
|
||||
lsp lspconfig
|
||||
configs lspconfig/configs
|
||||
lsputil lspconfig/util
|
||||
utils dots.utils
|
||||
cmp_nvim_lsp cmp_nvim_lsp}})
|
||||
|
||||
|
||||
(local Dictionary-file {:de-DE [(.. (vim.fn.getenv "HOME") "/.config/ltex-ls/dictionary.txt")]})
|
||||
(local Disabled-rules-file {:de-DE [(.. (vim.fn.getenv "HOME") "/.config/ltex-ls/disable.txt")]})
|
||||
(local False-positives-file {:de-DE [(.. (vim.fn.getenv "HOME") "/.config/ltex-ls/false.txt")]})
|
||||
|
||||
(fn read-files [files]
|
||||
(let [dict {}]
|
||||
(each [_ file (ipairs files)]
|
||||
(local f (io.open file :r))
|
||||
(when (~= nil f)
|
||||
(each [l (f:lines)]
|
||||
(table.insert dict l))))
|
||||
dict))
|
||||
|
||||
(fn find-ltex-lang []
|
||||
(let [buf-clients (vim.lsp.buf_get_clients)]
|
||||
(each [_ client (ipairs buf-clients)]
|
||||
(when (= client.name :ltex)
|
||||
(let [___antifnl_rtn_1___ client.config.settings.ltex.language]
|
||||
(lua "return ___antifnl_rtn_1___"))))))
|
||||
|
||||
(fn find-ltex-files [filetype value]
|
||||
(if (= filetype :dictionary)
|
||||
(. Dictionary-file (or value (find-ltex-lang)))
|
||||
(= filetype :disable)
|
||||
(. Disabled-rules-file (or value (find-ltex-lang)))
|
||||
(= filetype :falsePositive)
|
||||
(. False-positives-file (or value (find-ltex-lang)))))
|
||||
|
||||
(fn update-config [lang configtype]
|
||||
(let [buf-clients (vim.lsp.buf_get_clients)]
|
||||
(var client nil)
|
||||
(each [_ lsp (ipairs buf-clients)]
|
||||
(when (= lsp.name :ltex)
|
||||
(set client lsp)))
|
||||
(if client
|
||||
(if (= configtype :dictionary)
|
||||
(if client.config.settings.ltex.dictionary
|
||||
(do
|
||||
(set client.config.settings.ltex.dictionary
|
||||
{lang (read-files (. Dictionary-file lang))})
|
||||
(client.notify :workspace/didChangeConfiguration
|
||||
client.config.settings))
|
||||
(vim.notify "Error when reading dictionary config, check it"))
|
||||
(= configtype :disable)
|
||||
(if client.config.settings.ltex.disabledRules
|
||||
(do
|
||||
(set client.config.settings.ltex.disabledRules
|
||||
{lang (read-files (. Disabled-rules-file lang))})
|
||||
(client.notify :workspace/didChangeConfiguration
|
||||
client.config.settings))
|
||||
(vim.notify "Error when reading disabledRules config, check it"))
|
||||
(= configtype :falsePositive)
|
||||
(if client.config.settings.ltex.hiddenFalsePositives
|
||||
(do
|
||||
(set client.config.settings.ltex.hiddenFalsePositives
|
||||
{lang (read-files (. False-positives-file lang))})
|
||||
(client.notify :workspace/didChangeConfiguration
|
||||
client.config.settings))
|
||||
(vim.notify "Error when reading hiddenFalsePositives config, check it")))
|
||||
nil)))
|
||||
|
||||
(fn add-to-file [filetype lang file value]
|
||||
(set-forcibly! file (io.open (. file (- (length file) 0)) :a+))
|
||||
(if file (do
|
||||
(file:write (.. value "\n"))
|
||||
(file:close))
|
||||
(let [___antifnl_rtns_1___ [(print "Failed insert %q" value)]]
|
||||
(lua "return (table.unpack or _G.unpack)(___antifnl_rtns_1___)")))
|
||||
(if (= filetype :dictionary) (update-config lang :dictionary)
|
||||
(= filetype :disable) (update-config lang :disable)
|
||||
(= filetype :falsePositive) (update-config lang :disable)))
|
||||
|
||||
(fn add-to [filetype lang file value]
|
||||
(let [dict (read-files file)]
|
||||
(each [_ v (ipairs dict)]
|
||||
(when (= v value)
|
||||
(lua "return nil")))
|
||||
(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]
|
||||
: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))}}}})
|
||||
|
||||
(set lsp.ltex.dictionary_file Dictionary-file)
|
||||
(set lsp.ltex.disabledrules_file Disabled-rules-file)
|
||||
(set lsp.ltex.falsepostivies_file False-positives-file)
|
||||
(local orig-execute-command vim.lsp.buf.execute_command)
|
||||
|
||||
(set vim.lsp.buf.execute_command
|
||||
(fn [command]
|
||||
(if (= command.command :_ltex.addToDictionary)
|
||||
(let [arg (. (. command.arguments 1) :words)]
|
||||
(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))))
|
|
@ -4,8 +4,26 @@
|
|||
;(set vim.g.vimtex_quickfix_enabled 0)
|
||||
|
||||
(set vim.g.vimtex_view_method "general")
|
||||
(set vim.g.vimtex_view_general_viewer "okular")
|
||||
(set vim.g.vimtex_view_general_options "--unique file:@pdf#src:@line@tex")
|
||||
;(set vim.g.vimtex_view_general_viewer "okular")
|
||||
(set vim.g.vimtex_view_general_viewer "zathura")
|
||||
;(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_mode 2)
|
||||
(set vim.g.vimtex_quickfix_open_on_warning 0)
|
||||
|
||||
(set vim.g.vimtex_compiler_latexmk {:build_dir ""
|
||||
:callback 1
|
||||
:continuous 1
|
||||
:executable "latexmk"
|
||||
:hooks []
|
||||
:options ["-verbose"
|
||||
"-file-line-error"
|
||||
"-synctex=1"
|
||||
"-interaction=nonstopmode"
|
||||
"-shell-escape"]})
|
||||
|
||||
(set vim.g.vimtex_syntax_custom_cmds
|
||||
[{:name "scripture" :argstyle "ital"}])
|
||||
|
||||
(set vim.g.vimtex_syntax_conceal {:accents 1
|
||||
:cites 1
|
||||
|
|
|
@ -594,6 +594,7 @@ mySwallowEventHook = WindowSwallowing.swallowEventHook
|
|||
(not <$> foldl1 (<||>) [ className =* "eww"
|
||||
, className =? "Dragon"
|
||||
, className =? "okular"
|
||||
, className =? "Zathura"
|
||||
, className =? "noswallow"
|
||||
])
|
||||
|
||||
|
|
9
zathura/.config/zathura/zathurarc
Normal file
9
zathura/.config/zathura/zathurarc
Normal file
|
@ -0,0 +1,9 @@
|
|||
set default-bg "#282828"
|
||||
set recolor true
|
||||
set recolor-lightcolor "#282828"
|
||||
set recolor-darkcolor "#ebdbb2"
|
||||
set recolor-keephue
|
||||
set inputbar-bg "#1d2021"
|
||||
set inputbar-fg "#ebdbb2"
|
||||
set statusbar-bg "#1d2021"
|
||||
set statusbar-fg "#ebdbb2"
|
Loading…
Reference in a new issue