This commit is contained in:
jay 2022-04-27 12:27:21 +08:00
parent 77ae3b52f1
commit a37ceaed83

View File

@ -30,6 +30,8 @@ Plug 'hrsh7th/cmp-cmdline'
Plug 'hrsh7th/cmp-vsnip' Plug 'hrsh7th/cmp-vsnip'
Plug 'hrsh7th/vim-vsnip' Plug 'hrsh7th/vim-vsnip'
Plug 'ray-x/lsp_signature.nvim'
Plug 'tomasr/molokai' Plug 'tomasr/molokai'
Plug 'scrooloose/nerdcommenter' Plug 'scrooloose/nerdcommenter'
Plug 'vim-scripts/DrawIt' Plug 'vim-scripts/DrawIt'
@ -320,6 +322,12 @@ lua << EOF
local nvlsp = require'lspconfig' local nvlsp = require'lspconfig'
local lspSig = require'lsp_signature'
lspSig.setup{
hint_enable = true,
}
-- Add additional capabilities supported by nvim-cmp -- Add additional capabilities supported by nvim-cmp
local capabilities = vim.lsp.protocol.make_client_capabilities() local capabilities = vim.lsp.protocol.make_client_capabilities()
capabilities = require('cmp_nvim_lsp').update_capabilities(capabilities) capabilities = require('cmp_nvim_lsp').update_capabilities(capabilities)
@ -330,6 +338,8 @@ local on_attach = function(client, bufnr)
local function buf_set_keymap(...) vim.api.nvim_buf_set_keymap(bufnr, ...) end local function buf_set_keymap(...) vim.api.nvim_buf_set_keymap(bufnr, ...) end
local function buf_set_option(...) vim.api.nvim_buf_set_option(bufnr, ...) end local function buf_set_option(...) vim.api.nvim_buf_set_option(bufnr, ...) end
lspSig.on_attach()
-- Enable completion triggered by <c-x><c-o> -- Enable completion triggered by <c-x><c-o>
buf_set_option('omnifunc', 'v:lua.vim.lsp.omnifunc') buf_set_option('omnifunc', 'v:lua.vim.lsp.omnifunc')
@ -374,13 +384,13 @@ nvlsp['rust_analyzer'].setup{
-- nvim-cmp setup -- nvim-cmp setup
local cmp = require 'cmp' local cmp = require 'cmp'
cmp.setup { cmp.setup {
mapping = { mapping = cmp.mapping.preset.insert({
['<CR>'] = cmp.mapping.confirm({ ['<CR>'] = cmp.mapping.confirm({
-- behavior = cmp.ConfirmBehavior.Insert, -- behavior = cmp.ConfirmBehavior.Insert,
select = true, select = true,
}), }),
-- ['<Tab>'] = cmp.mapping(cmp.mapping.select_next_item(), { 'i', 's' }), -- ['<Tab>'] = cmp.mapping(cmp.mapping.select_next_item(), { 'i', 's' }),
}, }),
snippet = { snippet = {
-- REQUIRED - you must specify a snippet engine -- REQUIRED - you must specify a snippet engine
expand = function(args) expand = function(args)