Worked on cmp completion
This commit is contained in:
parent
7ed897230b
commit
58df3fd422
1 changed files with 15 additions and 1 deletions
|
@ -13,7 +13,7 @@ require('packer').startup(function(use)
|
||||||
use 'nvim-treesitter/nvim-treesitter'
|
use 'nvim-treesitter/nvim-treesitter'
|
||||||
use {
|
use {
|
||||||
'hrsh7th/nvim-cmp',
|
'hrsh7th/nvim-cmp',
|
||||||
requires = { 'hrsh7th/cmp-nvim-lsp', 'hrsh7th/cmp-buffer', 'hrsh7th/cmp-cmdline', 'hrsh7th/cmp-path', 'hrsh7th/cmp-nvim-lua' }
|
requires = { 'hrsh7th/cmp-nvim-lsp', 'hrsh7th/cmp-buffer', 'hrsh7th/cmp-cmdline', 'hrsh7th/cmp-path', 'hrsh7th/cmp-nvim-lua', 'onsails/lspkind.nvim' }
|
||||||
}
|
}
|
||||||
if is_bootstrap then
|
if is_bootstrap then
|
||||||
require('packer').sync()
|
require('packer').sync()
|
||||||
|
@ -33,6 +33,7 @@ end
|
||||||
-- Some basic settings
|
-- Some basic settings
|
||||||
vim.wo.number = true
|
vim.wo.number = true
|
||||||
vim.wo.relativenumber = true
|
vim.wo.relativenumber = true
|
||||||
|
vim.o.pumheight = 20
|
||||||
|
|
||||||
-- Additional keybinds if lsp running
|
-- Additional keybinds if lsp running
|
||||||
local on_attach = function(client, bufnr)
|
local on_attach = function(client, bufnr)
|
||||||
|
@ -71,6 +72,7 @@ require('nvim-treesitter.configs').setup{
|
||||||
|
|
||||||
-- autocompletion
|
-- autocompletion
|
||||||
local cmp = require 'cmp'
|
local cmp = require 'cmp'
|
||||||
|
local lspkind = require 'lspkind'
|
||||||
cmp.setup {
|
cmp.setup {
|
||||||
sources = {
|
sources = {
|
||||||
{ name = 'nvim_lsp' },
|
{ name = 'nvim_lsp' },
|
||||||
|
@ -78,5 +80,17 @@ cmp.setup {
|
||||||
{ name = 'cmdline' },
|
{ name = 'cmdline' },
|
||||||
{ name = 'path' },
|
{ name = 'path' },
|
||||||
{ name = 'nvim-lua' }
|
{ name = 'nvim-lua' }
|
||||||
|
},
|
||||||
|
formatting = {
|
||||||
|
format = lspkind.cmp_format()
|
||||||
|
},
|
||||||
|
mapping = cmp.mapping.preset.insert {
|
||||||
|
['<Tab>'] = cmp.mapping(function(fallback)
|
||||||
|
if cmp.visible() then
|
||||||
|
cmp.select_next_item()
|
||||||
|
else
|
||||||
|
fallback()
|
||||||
|
end
|
||||||
|
end, {'i', 's'})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue