aboutsummaryrefslogtreecommitdiff
path: root/lua
diff options
context:
space:
mode:
Diffstat (limited to 'lua')
-rw-r--r--lua/config/nvim-cmp.lua18
-rw-r--r--lua/plugins.lua4
2 files changed, 20 insertions, 2 deletions
diff --git a/lua/config/nvim-cmp.lua b/lua/config/nvim-cmp.lua
index 7d6a122..a96dc6f 100644
--- a/lua/config/nvim-cmp.lua
+++ b/lua/config/nvim-cmp.lua
@@ -1,5 +1,6 @@
-- Setup nvim-cmp.
local cmp = require'cmp'
+local lspkind = require'lspkind'
cmp.setup({
snippet = {
@@ -31,6 +32,7 @@ cmp.setup({
sources = {
{ name = 'nvim_lsp' }, -- For nvim-lsp
{ name = 'ultisnips' }, -- For ultisnips user.
+ { name = 'nvim_lua' }, -- for nvim lua function
{ name = 'path' }, -- for path completion
{ name = 'emoji', insert = true, } -- emoji completion
},
@@ -40,5 +42,19 @@ cmp.setup({
},
experimental = {
ghost_text = false
- }
+ },
+ formatting = {
+ format = lspkind.cmp_format({
+ with_text = false,
+ menu = {
+ nvim_lsp = "[LSP]",
+ ultisnips = "[US]",
+ nvim_lua = "[Lua]",
+ path = "[Path]",
+ emoji = "[Emoji]",
+ },
+ }),
+ },
})
+
+vim.cmd("hi link CmpItemMenu Comment")
diff --git a/lua/plugins.lua b/lua/plugins.lua
index ef7e20f..28f7e49 100644
--- a/lua/plugins.lua
+++ b/lua/plugins.lua
@@ -27,8 +27,9 @@ require("packer").startup({
function(use)
use({"wbthomason/packer.nvim", opt = true})
+ use {"onsails/lspkind-nvim", event = "BufEnter"}
-- auto-completion engine
- use {"hrsh7th/nvim-cmp", event = "BufEnter", config = [[require('config.nvim-cmp')]]}
+ use {"hrsh7th/nvim-cmp", after = "lspkind-nvim", config = [[require('config.nvim-cmp')]]}
-- nvim-cmp completion sources
use {"hrsh7th/cmp-nvim-lsp", after = "nvim-cmp"}
@@ -36,6 +37,7 @@ require("packer").startup({
-- nvim-lsp configuration (it relies on cmp-nvim-lsp, so it should be loaded after cmp-nvim-lsp).
use({ "neovim/nvim-lspconfig", after = "cmp-nvim-lsp", config = [[require('config.lsp')]] })
+ use {"hrsh7th/cmp-nvim-lua", after = "nvim-cmp"}
use {"hrsh7th/cmp-path", after = "nvim-cmp"}
use {"quangnguyen30192/cmp-nvim-ultisnips", after = {'nvim-cmp', 'ultisnips'}}
if vim.g.is_mac then