89 lines
2.4 KiB
Lua
89 lines
2.4 KiB
Lua
local utils = require 'custom.utils'
|
|
|
|
local ltex_fts = {
|
|
'bibtex',
|
|
'bib',
|
|
'tex',
|
|
'typst',
|
|
'latex',
|
|
'gitcommit',
|
|
'markdown',
|
|
'org',
|
|
'restructuredtext',
|
|
'rsweave',
|
|
'quarto',
|
|
'rmd',
|
|
'context',
|
|
'text',
|
|
'html',
|
|
'pandoc',
|
|
'xhtml',
|
|
'plaintex',
|
|
'quarto',
|
|
'mail',
|
|
'mdx',
|
|
'rmd',
|
|
'rnoweb',
|
|
'rst',
|
|
}
|
|
|
|
LTEX_SETTINGS = {
|
|
capabilities = CAPABILITIES,
|
|
on_attach = function(client, bufnr)
|
|
DEFAULT_ON_ATTACH(client, bufnr)
|
|
end,
|
|
use_spellfile = true,
|
|
autostart = false,
|
|
filetypes = ltex_fts,
|
|
settings = {
|
|
ltex = {
|
|
checkFrequency = 'save', -- shut up while i'm just editing, see <https://github.com/folke/noice.nvim/issues/166>
|
|
-- specific language (such as en-GB or de-DE is recommended, but I
|
|
-- want multilingual)
|
|
language = 'auto',
|
|
enabled = ltex_fts,
|
|
additionalRules = {
|
|
enablePickyRules = true,
|
|
-- thats cool, but often adds diagnostics in
|
|
-- places where a german might confuse words that are similar
|
|
-- between english and german REGARDLESS of context. I seem to use the
|
|
-- english words only in the proper contexts, so leaving this on
|
|
-- just adds annoying hints like 'Hinweis: "list/NN.*" (English) bedeutet "Liste",
|
|
-- "Verzeichnis" (German). Meinten Sie vielleicht 'cunning', 'trick'?'
|
|
-- everytime I use the word "list". I liked that this makes the hints be
|
|
-- in german regardless of the language I'm working in through...
|
|
--motherTongue = "de",
|
|
},
|
|
},
|
|
},
|
|
}
|
|
|
|
-- load token and additional languagetool items later if specified
|
|
local has_api_key, apiKey = utils.try_require 'custom.secret.languagetool'
|
|
if has_api_key and apiKey ~= '' then
|
|
print(string.format('apiKey for ltex found: %s' % apiKey))
|
|
LTEX_SETTINGS = vim.tbl_deep_extend('keep', LTEX_SETTINGS, {
|
|
settings = {
|
|
languageToolOrg = {
|
|
apiKey = apiKey,
|
|
username = 'accounts@cscherr.de',
|
|
languageToolHttpServerUrl = 'https://api.languagetoolplus.com/v2/',
|
|
},
|
|
languageToolHttpServerUrl = 'https://api.languagetoolplus.com/v2/',
|
|
},
|
|
})
|
|
else
|
|
print 'apiKey for ltex/languagetool is not specified'
|
|
end
|
|
|
|
return {
|
|
'barreiroleo/ltex_extra.nvim',
|
|
ft = { 'markdown', 'tex' },
|
|
dependencies = { 'neovim/nvim-lspconfig' },
|
|
-- yes, you can use the opts field, just I'm showing the setup explicitly
|
|
config = function()
|
|
require('ltex_extra').setup {
|
|
server_opts = LTEX_SETTINGS,
|
|
}
|
|
end,
|
|
}
|