Add 'hrsh7th/cmp-path' as a dependency and load 'luasnip' snippets from VSCode in the 'init.lua' file, also include 'onsails/lspkind.nvim' and 'rafamadriz/friendly-snippets' in the list of plugins in the 'custom/plugins/init.lua' file

This commit is contained in:
PeteChu 2023-04-09 14:36:04 +07:00
parent bc702160c2
commit 082aedd752
2 changed files with 10 additions and 8 deletions

View File

@ -98,7 +98,7 @@ require('lazy').setup({
{ {
-- Autocompletion -- Autocompletion
'hrsh7th/nvim-cmp', 'hrsh7th/nvim-cmp',
dependencies = { 'hrsh7th/cmp-nvim-lsp', 'L3MON4D3/LuaSnip', 'saadparwaiz1/cmp_luasnip', 'hrsh7th/cmp-buffer' }, dependencies = { 'hrsh7th/cmp-nvim-lsp', 'L3MON4D3/LuaSnip', 'saadparwaiz1/cmp_luasnip', 'hrsh7th/cmp-buffer', 'hrsh7th/cmp-path' },
}, },
-- Useful plugin to show you pending keybinds. -- Useful plugin to show you pending keybinds.
@ -203,10 +203,6 @@ require('lazy').setup({
} }
end, end,
}, },
{ "onsails/lspkind.nvim" },
-- NOTE: Next Step on Your Neovim Journey: Add/Configure additional "plugins" for kickstart -- NOTE: Next Step on Your Neovim Journey: Add/Configure additional "plugins" for kickstart
-- These are some example plugins that I've included in the kickstart repository. -- These are some example plugins that I've included in the kickstart repository.
-- Uncomment any of the lines below to enable them. -- Uncomment any of the lines below to enable them.
@ -509,6 +505,8 @@ local lspkind = require 'lspkind'
luasnip.config.setup {} luasnip.config.setup {}
require("luasnip.loaders.from_vscode").lazy_load()
cmp.setup { cmp.setup {
snippet = { snippet = {
expand = function(args) expand = function(args)
@ -542,14 +540,16 @@ cmp.setup {
end end
end, { 'i', 's' }), end, { 'i', 's' }),
}, },
sources = { sources = cmp.config.sources({
{ name = 'nvim_lsp' }, { name = 'nvim_lsp' },
{ name = 'luasnip' }, { name = 'luasnip' },
{ name = 'buffer' }, { name = 'buffer' },
}, { name = 'path' },
}),
formatting = { formatting = {
format = lspkind.cmp_format({ format = lspkind.cmp_format({
maxwidth = 50, -- prevent the popup from showing more than provided characters (e.g 50 will not show more than 50 characters) maxwidth = 50, -- prevent the popup from showing more than provided characters (e.g 50 will not show more than 50 characters)
ellipsis_char = "...",
}) })
} }
} }

View File

@ -8,5 +8,7 @@ return {
'famiu/bufdelete.nvim', 'famiu/bufdelete.nvim',
'ThePrimeagen/harpoon', 'ThePrimeagen/harpoon',
'ThePrimeagen/vim-be-good', 'ThePrimeagen/vim-be-good',
'stevearc/dressing.nvim' 'stevearc/dressing.nvim',
"onsails/lspkind.nvim",
"rafamadriz/friendly-snippets"
} }