[NeoVim] LaTeX + Snippets

This commit is contained in:
2022-07-25 19:08:00 +02:00
committed by Pierre Jeanjean
parent 1d9f022627
commit 7924ab3ed1
3 changed files with 29 additions and 7 deletions

View File

@@ -1,4 +1,4 @@
local servers = { 'pyright', 'sumneko_lua', 'eslint', 'tsserver' }
local servers = { 'pyright', 'sumneko_lua', 'eslint', 'tsserver', 'ltex' }
-- Mappings.
-- See `:help vim.diagnostic.*` for documentation on any of the below functions
@@ -11,9 +11,6 @@ vim.keymap.set('n', '<space>q', vim.diagnostic.setloclist, opts)
-- Use an on_attach function to only map the following keys
-- after the language server attaches to the current buffer
local on_attach = function(client, bufnr)
-- Enable completion triggered by <c-x><c-o>
vim.api.nvim_buf_set_option(bufnr, 'omnifunc', 'v:lua.vim.lsp.omnifunc')
-- Mappings.
-- See `:help vim.lsp.*` for documentation on any of the below functions
local bufopts = { noremap=true, silent=true, buffer=bufnr }
@@ -52,8 +49,10 @@ end
-- luasnip setup
local luasnip = require 'luasnip'
require('luasnip.loaders.from_vscode').lazy_load()
-- nvim-cmp setup
local lspkind = require('lspkind')
local cmp = require 'cmp'
cmp.setup {
snippet = {
@@ -89,7 +88,18 @@ cmp.setup {
end, { 'i', 's' }),
}),
sources = {
{ name = 'nvim_lsp' },
{ name = 'luasnip' },
{ name = 'nvim_lsp' },
{ name = 'omni' }
},
formatting = {
format = lspkind.cmp_format({
mode = "symbol_text",
menu = ({
nvim_lsp = "[LSP]",
luasnip = "[LuaSnip]",
omni = "[Omni]"
})
})
}
}