This commit is contained in:
jimrothstein 2023-10-06 16:57:11 -07:00
parent 7c8571ae9f
commit 343f9cd394
1 changed files with 11 additions and 7 deletions

View File

@ -1,5 +1,5 @@
--
--[[ --[[
TODO: TODO:
===================================================================== =====================================================================
@ -112,7 +112,7 @@ require('lazy').setup({
}, },
{ {
-- Autocompletion -- Autocompletion; exist several `extensions` to nvim-cmp
'hrsh7th/nvim-cmp', 'hrsh7th/nvim-cmp',
dependencies = { dependencies = {
-- Snippet Engine & its associated nvim-cmp source -- Snippet Engine & its associated nvim-cmp source
@ -631,10 +631,6 @@ mason_lspconfig.setup_handlers {
end, end,
} }
-- [[ Configure nvim-cmp ]]
-- See `:help cmp`
local cmp = require 'cmp'
-- --
-- LUASNIP -- LUASNIP
local luasnip = require 'luasnip' local luasnip = require 'luasnip'
@ -668,6 +664,11 @@ ls.add_snippets('all', { -- `all` all filetypes, `lua` only lua ft
require('luasnip.loaders.from_vscode').lazy_load() require('luasnip.loaders.from_vscode').lazy_load()
luasnip.config.setup {} luasnip.config.setup {}
-- nvim-cmp configuration
-- [[ Configure hrsh7th nvim-cmp ]]
-- See `:help cmp`
local cmp = require 'cmp'
cmp.setup { cmp.setup {
snippet = { snippet = {
expand = function(args) expand = function(args)
@ -684,6 +685,7 @@ cmp.setup {
behavior = cmp.ConfirmBehavior.Replace, behavior = cmp.ConfirmBehavior.Replace,
select = true, select = true,
}, },
-- TAB selects NEXT item (CR to complete)
['<Tab>'] = cmp.mapping(function(fallback) ['<Tab>'] = cmp.mapping(function(fallback)
if cmp.visible() then if cmp.visible() then
cmp.select_next_item() cmp.select_next_item()
@ -703,9 +705,11 @@ cmp.setup {
end end
end, { 'i', 's' }), end, { 'i', 's' }),
}, },
sources = { sources = { -- need nvim-cmp extensions?
{ name = 'nvim_lsp' }, { name = 'nvim_lsp' },
{ name = 'luasnip' }, { name = 'luasnip' },
{ name = 'path' } ,
{ name = 'buffer', keyword_length = 5 },
}, },
} }