pls be good

This commit is contained in:
cscherr 2025-06-24 11:00:31 +02:00
parent 9388a41ff1
commit 2a811dbcfd
Signed by: cscherrNT
GPG key ID: 8E2B45BC51A27EA7
2 changed files with 759 additions and 755 deletions

View file

@ -1,96 +1,100 @@
local utils = require 'custom.utils' local utils = require 'custom.utils'
local ltex_fts = { local ltex_fts = {
'bibtex', 'bibtex',
'bib', 'bib',
'tex', 'tex',
'typst', 'typst',
'latex', 'latex',
'gitcommit', 'gitcommit',
'markdown', 'markdown',
'org', 'org',
'restructuredtext', 'restructuredtext',
'rsweave', 'rsweave',
'quarto', 'quarto',
'rmd', 'rmd',
'context', 'context',
'text', 'text',
'html', 'html',
'pandoc', 'pandoc',
'xhtml', 'xhtml',
'plaintex', 'plaintex',
'quarto', 'quarto',
'mail', 'mail',
'mdx', 'mdx',
'rmd', 'rmd',
'rnoweb', 'rnoweb',
'rst', 'rst',
} }
local map = function(keys, func, desc) local map = function(keys, func, desc)
vim.keymap.set('n', keys, func, { buffer = vim.buf, desc = 'LSP[LTEX]: ' .. desc }) vim.keymap.set('n', keys, func, { buffer = vim.buf, desc = 'LSP[LTEX]: ' .. desc })
end end
LTEX_SETTINGS = { LTEX_SETTINGS = {
capabilities = CAPABILITIES, capabilities = CAPABILITIES,
on_attach = function(client, bufnr) on_attach = function(client, bufnr)
DEFAULT_ON_ATTACH(client, bufnr) DEFAULT_ON_ATTACH(client, bufnr)
end, end,
use_spellfile = true, autostart = false,
autostart = false, filetypes = ltex_fts,
filetypes = ltex_fts, settings = {
settings = { ltex = {
ltex = { checkFrequency = 'save', -- shut up while i'm just editing, see <https://github.com/folke/noice.nvim/issues/166>
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
-- specific language (such as en-GB or de-DE is recommended, but I -- want multilingual)
-- want multilingual) language = 'auto',
language = 'auto', enabled = ltex_fts,
enabled = ltex_fts, additionalRules = {
additionalRules = { enablePickyRules = true,
enablePickyRules = true, -- thats cool, but often adds diagnostics in
-- thats cool, but often adds diagnostics in -- places where a german might confuse words that are similar
-- places where a german might confuse words that are similar -- between english and german REGARDLESS of context. I seem to use the
-- between english and german REGARDLESS of context. I seem to use the -- english words only in the proper contexts, so leaving this on
-- english words only in the proper contexts, so leaving this on -- just adds annoying hints like 'Hinweis: "list/NN.*" (English) bedeutet "Liste",
-- just adds annoying hints like 'Hinweis: "list/NN.*" (English) bedeutet "Liste", -- "Verzeichnis" (German). Meinten Sie vielleicht 'cunning', 'trick'?'
-- "Verzeichnis" (German). Meinten Sie vielleicht 'cunning', 'trick'?' -- everytime I use the word "list". I liked that this makes the hints be
-- 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...
-- in german regardless of the language I'm working in through... motherTongue = 'de',
--motherTongue = "de", },
}, },
}, },
},
} }
-- load token and additional languagetool items later if specified -- load token and additional languagetool items later if specified
local do_not_use_api_key = true local do_not_use_api_key = true
local has_api_key, apiKey = utils.try_require 'custom.secret.languagetool' local has_api_key, apiKey = utils.try_require 'custom.secret.languagetool'
if not do_not_use_api_key and has_api_key and apiKey ~= '' then if not do_not_use_api_key and has_api_key and apiKey ~= '' then
LTEX_SETTINGS = vim.tbl_deep_extend('keep', LTEX_SETTINGS, { LTEX_SETTINGS = vim.tbl_deep_extend('keep', LTEX_SETTINGS, {
settings = { settings = {
languageToolOrg = { languageToolOrg = {
apiKey = apiKey, apiKey = apiKey,
username = 'accounts@cscherr.de', username = 'accounts@cscherr.de',
}, },
languageToolHttpServerUrl = 'https://api.languagetoolplus.com/', languageToolHttpServerUrl = 'https://api.languagetoolplus.com/',
}, },
}) })
else else
if not do_not_use_api_key then if not do_not_use_api_key then
print 'apiKey for ltex/languagetool is not specified' print 'apiKey for ltex/languagetool is not specified'
end end
end end
return { return {
'barreiroleo/ltex_extra.nvim', 'barreiroleo/ltex_extra.nvim',
ft = ltex_fts, ft = ltex_fts,
dependencies = { 'neovim/nvim-lspconfig' }, dependencies = { 'neovim/nvim-lspconfig' },
config = function() config = function()
require('ltex_extra').setup { require('ltex_extra').setup {
server_opts = LTEX_SETTINGS, load_langs = { 'en-US', 'de-DE' },
} init_check = true,
map('<leader>tS', function() server_opts = LTEX_SETTINGS, -- or use lspconfig regularly
vim.cmd 'LspStart ltex' }
end, 'Enable spell checking with languagetool') map('<leader>tS', function()
end, vim.opt.spell = true -- manually enable spell with `set spell` or `<leader>ts`
vim.opt.spelllang = 'en,de_de'
vim.opt.spellsuggest = 'double,50,timeout:5000'
vim.cmd 'LspStart ltex'
end, 'Enable spell checking with languagetool')
end,
} }

File diff suppressed because it is too large Load diff