nix/home/file/nvim/module/plugin/lsp/Tex.nix

65 lines
1.6 KiB
Nix
Raw Normal View History

2024-11-04 04:37:29 +03:00
{ ... }: {
text = ''
local lspconfig = require('lspconfig')
local config = {
filetypes = {
"bib",
"gitcommit",
"markdown",
"org",
"pandoc",
"plaintex",
"rnoweb",
"rst",
"tex",
"text",
},
settings = {
["ltex"] = {
language = "auto"
}
}
}
2024-04-06 03:03:58 +03:00
2024-11-04 04:37:29 +03:00
lspconfig.ltex.setup(config)
2024-04-06 03:03:58 +03:00
2024-11-04 04:37:29 +03:00
-- Use TeX LSP for spellcheck.
vim.api.nvim_create_user_command("SCOn", function (args)
lspconfig.ltex.setup(config)
end, { desc = "Enable spellcheck." })
2024-04-06 03:03:58 +03:00
2024-11-04 04:37:29 +03:00
vim.api.nvim_create_user_command("SCOff", function (args)
lspconfig.ltex.setup { filetypes = {} }
end, { desc = "Disable spellcheck." })
2024-04-06 03:03:58 +03:00
2024-11-04 04:37:29 +03:00
vim.api.nvim_create_user_command("SCLangRU", function (args)
config.settings['ltex'].language = "ru-RU"
lspconfig.ltex.setup(config)
end, { desc = "Set spellcheck to Russian." })
2024-04-06 03:03:58 +03:00
2024-11-04 04:37:29 +03:00
vim.api.nvim_create_user_command("SCLangEN", function (args)
config.settings['ltex'].language = "en-US"
lspconfig.ltex.setup(config)
end, { desc = "Set spellcheck to English." })
2024-04-06 03:03:58 +03:00
2024-11-04 04:37:29 +03:00
vim.api.nvim_create_user_command("SCLangAuto", function (args)
config.settings['ltex'].language = "auto"
lspconfig.ltex.setup(config)
end, { desc = "Set spellcheck to Auto." })
2024-04-06 03:03:58 +03:00
2024-11-04 04:37:29 +03:00
vim.api.nvim_create_user_command("SCForce", function (args)
vim.cmd("setfiletype text")
vim.cmd("SCOn")
end, { desc = "Set buffer type to text." })
2024-04-06 03:03:58 +03:00
2024-11-04 04:37:29 +03:00
vim.api.nvim_create_user_command("SCReset", function (args)
vim.cmd("filetype detect")
vim.cmd("SCLangAuto")
end, { desc = "Set buffer type to auto." })
2024-04-06 03:03:58 +03:00
2024-11-04 04:37:29 +03:00
vim.api.nvim_create_user_command("SCInfo", function (args)
vim.cmd("LspInfo")
end, { desc = "Show info about spellcheck." })
'';
2024-04-06 03:03:58 +03:00
}