From 43ba9953aa5b1d15e405bcd145a3170ed158f482 Mon Sep 17 00:00:00 2001 From: RhiobeT Date: Mon, 25 Jul 2022 19:08:00 +0200 Subject: [PATCH] [NeoVim] LaTeX + Snippets --- .config/nvim/init.lua | 4 ++++ .config/nvim/lua/lspconfig/settings.lua | 20 +++++++++++++++----- .config/nvim/lua/plugins.lua | 12 ++++++++++-- 3 files changed, 29 insertions(+), 7 deletions(-) diff --git a/.config/nvim/init.lua b/.config/nvim/init.lua index fd52c45..4c9e778 100644 --- a/.config/nvim/init.lua +++ b/.config/nvim/init.lua @@ -237,6 +237,10 @@ vim.keymap.set("n", "r", "DiffviewOpen") vim.keymap.set("n", "R", "DiffviewFileHistory %") +vim.g.vimtex_view_method = 'zathura' + + +vim.g.maplocalleader = ',' vim.o.clipboard = 'unnamedplus' vim.o.expandtab = true vim.o.fileencoding = 'utf-8' diff --git a/.config/nvim/lua/lspconfig/settings.lua b/.config/nvim/lua/lspconfig/settings.lua index 6b81f93..486c843 100644 --- a/.config/nvim/lua/lspconfig/settings.lua +++ b/.config/nvim/lua/lspconfig/settings.lua @@ -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', '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 - 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]" + }) + }) + } } diff --git a/.config/nvim/lua/plugins.lua b/.config/nvim/lua/plugins.lua index b07d87a..8d09744 100644 --- a/.config/nvim/lua/plugins.lua +++ b/.config/nvim/lua/plugins.lua @@ -48,9 +48,17 @@ return require('packer').startup(function() use { 'hrsh7th/nvim-cmp', + 'hrsh7th/cmp-omni', 'hrsh7th/cmp-nvim-lsp', - 'saadparwaiz1/cmp_luasnip', - 'L3MON4D3/LuaSnip' + 'onsails/lspkind.nvim' } + use { + 'L3MON4D3/LuaSnip', + 'saadparwaiz1/cmp_luasnip', + 'rafamadriz/friendly-snippets' + } + + use 'lervag/vimtex' + end)