This repository has been archived on 2024-03-04. You can view files and clone it, but cannot push or open issues or pull requests.
linux/.config/nvim/lua/plugin/lsp/Tex.lua

65 lines
1.7 KiB
Lua
Raw Normal View History

2023-08-08 16:24:15 +03:00
local lspconfig = require('lspconfig')
local config = {
2024-02-06 15:25:18 +03:00
filetypes = {
"bib",
"gitcommit",
"markdown",
"org",
"pandoc",
"plaintex",
"rnoweb",
"rst",
"tex",
"text",
},
2023-12-05 22:06:39 +03:00
settings = {
2024-02-06 15:25:18 +03:00
["ltex"] = {
2023-12-05 22:06:39 +03:00
language = "auto"
}
}
2023-08-08 16:24:15 +03:00
}
lspconfig.ltex.setup(config)
2024-02-06 15:25:18 +03:00
-- Use TeX LSP for spellcheck.
vim.api.nvim_create_user_command("SCOn", function (args)
2023-12-05 22:06:39 +03:00
lspconfig.ltex.setup(config)
2023-08-08 16:24:15 +03:00
end, { desc = "Enable spellcheck." })
2024-02-06 15:25:18 +03:00
vim.api.nvim_create_user_command("SCOff", function (args)
2023-12-05 22:06:39 +03:00
lspconfig.ltex.setup { filetypes = {} }
2023-08-08 16:24:15 +03:00
end, { desc = "Disable spellcheck." })
2024-02-06 15:25:18 +03:00
vim.api.nvim_create_user_command("SCLangRU", function (args)
2023-12-05 22:06:39 +03:00
config.settings['ltex'].language = "ru-RU"
lspconfig.ltex.setup(config)
2023-08-08 16:24:15 +03:00
end, { desc = "Set spellcheck to Russian." })
2024-02-06 15:25:18 +03:00
vim.api.nvim_create_user_command("SCLangEN", function (args)
2023-12-05 22:06:39 +03:00
config.settings['ltex'].language = "en-US"
lspconfig.ltex.setup(config)
2023-08-08 16:24:15 +03:00
end, { desc = "Set spellcheck to English." })
2024-02-06 15:25:18 +03:00
vim.api.nvim_create_user_command("SCLangAuto", function (args)
2023-12-05 22:06:39 +03:00
config.settings['ltex'].language = "auto"
lspconfig.ltex.setup(config)
2023-08-08 16:24:15 +03:00
end, { desc = "Set spellcheck to Auto." })
2024-02-06 15:25:18 +03:00
vim.api.nvim_create_user_command("SCForce", function (args)
2023-12-05 22:06:39 +03:00
vim.cmd("setfiletype text")
vim.cmd("SCOn")
2023-08-08 16:24:15 +03:00
end, { desc = "Set buffer type to text." })
2024-02-06 15:25:18 +03:00
vim.api.nvim_create_user_command("SCReset", function (args)
2023-12-05 22:06:39 +03:00
vim.cmd("filetype detect")
vim.cmd("SCLangAuto")
2023-08-08 16:24:15 +03:00
end, { desc = "Set buffer type to auto." })
2024-02-06 15:25:18 +03:00
vim.api.nvim_create_user_command("SCInfo", function (args)
2023-12-05 22:06:39 +03:00
vim.cmd("LspInfo")
2023-08-08 16:24:15 +03:00
end, { desc = "Show info about spellcheck." })
2024-02-06 15:25:18 +03:00
vim.api.nvim_create_user_command("SCInstall", function (args)
2023-12-05 22:06:39 +03:00
vim.cmd("MasonInstall ltex-ls")
2023-08-08 16:24:15 +03:00
end, { desc = "Install spellcheck (requires Mason)." })