From fa31f10efeefbd10fcdfc386968cc4bd0e282e46 Mon Sep 17 00:00:00 2001 From: Yigit Sever Date: Wed, 14 Dec 2022 17:41:28 +0300 Subject: feat(nvim): use ltex-extra plugin https://valentjn.github.io/ltex/settings.html we use ltex-ls for prose, add to dictionary and hide false positives were pain, this plugin fixes that still need to invoke ltex-ls on save instead of on every keypress --- .config/nvim/lua/plugin_settings.lua | 27 +++++++++++++++++++++++---- .config/nvim/lua/plugins.lua | 2 ++ 2 files changed, 25 insertions(+), 4 deletions(-) diff --git a/.config/nvim/lua/plugin_settings.lua b/.config/nvim/lua/plugin_settings.lua index d103607..2149db0 100644 --- a/.config/nvim/lua/plugin_settings.lua +++ b/.config/nvim/lua/plugin_settings.lua @@ -331,10 +331,10 @@ vim.keymap.set('n', ']d', vim.diagnostic.goto_next, opts) vim.keymap.set('n', 'q', vim.diagnostic.setloclist, opts) local on_attach = function(client, bufnr) - -- Enable completion triggered by + -- enable completion triggered by vim.api.nvim_buf_set_option(bufnr, 'omnifunc', 'v:lua.vim.lsp.omnifunc') - -- See `:help vim.lsp.*` for documentation on any of the below functions + -- see `:help vim.lsp.*` for documentation on any of the below functions local bufopts = { noremap=true, silent=true, buffer=bufnr } vim.keymap.set('n', 'gD', vim.lsp.buf.declaration, bufopts) vim.keymap.set('n', 'gd', vim.lsp.buf.definition, bufopts) @@ -356,7 +356,7 @@ end -- bring in cmp_nvim_lsp local capabilities = require('cmp_nvim_lsp').default_capabilities() -local servers = { 'jedi_language_server', 'texlab', 'clangd', 'ltex' } +local servers = { 'jedi_language_server', 'texlab', 'clangd' } for _, lsp in ipairs(servers) do nvim_lsp[lsp].setup { on_attach = on_attach, @@ -364,12 +364,31 @@ for _, lsp in ipairs(servers) do } end -nvim_lsp['efm'].setup{ +nvim_lsp['efm'].setup { on_attach = on_attach, filetypes = { 'sh' }, capabilities = capabilities } +nvim_lsp.ltex.setup { + capabilities = capabilities, + on_attach = function(client, bufnr) + on_attach(client, bufnr) + require("ltex_extra").setup { + load_langs = { "en-GB" }, + init_check = true, + path = "/home/yigit/.local/share/nvim/ltex", + log_level = "none", + } + end, + settings = { + ltex = { + -- my settings here + } + } +} + + -- rust-tools {{{ -- -- Configure LSP through rust-tools.nvim plugin. diff --git a/.config/nvim/lua/plugins.lua b/.config/nvim/lua/plugins.lua index 38c1acc..9855045 100644 --- a/.config/nvim/lua/plugins.lua +++ b/.config/nvim/lua/plugins.lua @@ -16,6 +16,8 @@ return require('packer').startup(function(use) -- latex suite use {'lervag/vimtex', ft = {'tex', 'latex', 'plaintext'}} + -- provides external ltex file handling and other functions + use 'barreiroleo/ltex-extra.nvim' -- treesitter use { -- cgit v1.2.3-70-g09d2