From 491f44f7af95014838d1f6625d4f56408fbd1369 Mon Sep 17 00:00:00 2001 From: Minijackson Date: Fri, 4 Jun 2021 15:06:12 +0200 Subject: vim: completion -> compe, snippets -> vsnip --- common/vim.nix | 8 ++++---- dotfiles/vim-dev.lua | 13 +++++++++++-- dotfiles/vim.lua | 33 +++++++++++++++++++++------------ 3 files changed, 36 insertions(+), 18 deletions(-) diff --git a/common/vim.nix b/common/vim.nix index 8a27b06..ade66e1 100644 --- a/common/vim.nix +++ b/common/vim.nix @@ -57,15 +57,15 @@ let vim-dirvish lsp-status-nvim - completion-nvim - completion-buffers - snippets-nvim + nvim-compe + + vim-vsnip + vim-vsnip-integ telescope-nvim # Treesitter nvim-treesitter - completion-treesitter nvim-treesitter-textobjects nvim-treesitter-context diff --git a/dotfiles/vim-dev.lua b/dotfiles/vim-dev.lua index 6b78022..d89a3bb 100644 --- a/dotfiles/vim-dev.lua +++ b/dotfiles/vim-dev.lua @@ -34,13 +34,22 @@ function on_attach(client, bufnr) -- Rust specific buf_set_keymap("n", "sh", "RustToggleInlayHints", opts) - - require("completion").on_attach() end +local capabilities = vim.lsp.protocol.make_client_capabilities() +capabilities.textDocument.completion.completionItem.snippetSupport = true +capabilities.textDocument.completion.completionItem.resolveSupport = { + properties = { + 'documentation', + 'detail', + 'additionalTextEdits', + } +} + function setup_lsp_with(servers) for _, server in ipairs(servers) do lspconfig[server].setup { + capabilities = capabilities, cmd = { vim.g[server .. "_path"] }, on_attach = on_attach, } diff --git a/dotfiles/vim.lua b/dotfiles/vim.lua index 27fa722..c09b8e0 100644 --- a/dotfiles/vim.lua +++ b/dotfiles/vim.lua @@ -5,6 +5,8 @@ vim.o.undofile = true vim.o.backup = true vim.cmd "set backupdir-=." +vim.cmd "set shortmess+=c" + vim.o.mouse = "a" vim.o.ignorecase = true @@ -163,21 +165,24 @@ require('nvim-treesitter.configs').setup { vim.o.foldmethod = 'expr' vim.o.foldexpr = 'nvim_treesitter#foldexpr()' --- Completion-nvim +-- nvim-compe -vim.g.completion_chain_complete_list = { - default = { - { - complete_items = { 'lsp', 'ts', 'path', 'snippet', 'buffers', 'tmux', }, - } +require("compe").setup { + source = { + buffer = true, + calc = true, + nvim_lsp = true, + nvim_lua = true, + nvim_treesitter = true, + path = true, + spell = true, + vsnip = true, }, } -vim.cmd [[autocmd BufEnter * lua require'completion'.on_attach()]] -local map = vim.api.nvim_set_keymap - -vim.g.completion_enable_snippet = "snippets.nvim" +map("i", "", "compe#confirm('')", { noremap = true, silent = true, expr = true }) +map("i", "", "compe#close('')", { noremap = true, silent = true, expr = true }) -- Telescope @@ -218,9 +223,13 @@ require("lualine").setup { }, } --- Snippets.nvim +-- VSnip + +map("i", "", "vsnip#jumpable(1) ? '(vsnip-jump-next)' : ''", { silent = true, expr = true }) +map("s", "", "vsnip#jumpable(1) ? '(vsnip-jump-next)' : ''", { silent = true, expr = true }) -require("snippets").use_suggested_mappings() +map("i", "", "vsnip#jumpable(-1) ? '(vsnip-jump-prev)' : ''", { silent = true, expr = true }) +map("s", "", "vsnip#jumpable(-1) ? '(vsnip-jump-prev)' : ''", { silent = true, expr = true }) -- OSCyank -- cgit v1.2.3