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

53 lines
1.6 KiB
Lua

local lspconfig = require('lspconfig')
local config = {
filetypes = { 'text', 'bib', 'gitcommit', 'markdown', 'org', 'plaintex', 'rst', 'rnoweb', 'tex', 'pandoc' },
settings = {
['ltex'] = {
language = "auto"
}
}
}
lspconfig.ltex.setup(config)
vim.api.nvim_create_user_command('SCOn', function (args)
lspconfig.ltex.setup(config)
end, { desc = "Enable spellcheck." })
vim.api.nvim_create_user_command('SCOff', function (args)
lspconfig.ltex.setup { filetypes = {} }
end, { desc = "Disable spellcheck." })
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." })
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." })
vim.api.nvim_create_user_command('SCLangAuto', function (args)
config.settings['ltex'].language = "auto"
lspconfig.ltex.setup(config)
end, { desc = "Set spellcheck to Auto." })
vim.api.nvim_create_user_command('SCForce', function (args)
vim.cmd("setfiletype text")
vim.cmd("SCOn")
end, { desc = "Set buffer type to text." })
vim.api.nvim_create_user_command('SCReset', function (args)
vim.cmd("filetype detect")
vim.cmd("SCLangAuto")
end, { desc = "Set buffer type to auto." })
vim.api.nvim_create_user_command('SCInfo', function (args)
vim.cmd("LspInfo")
end, { desc = "Show info about spellcheck." })
vim.api.nvim_create_user_command('SCInstall', function (args)
vim.cmd("MasonInstall ltex-ls")
end, { desc = "Install spellcheck (requires Mason)." })