Add fallback() to autocompletion, add comments shortcut, add require

plugins
This commit is contained in:
Miguel Da Silva 2024-09-11 21:30:20 +02:00
parent bfa0fbfd68
commit c88ea4938a
4 changed files with 32 additions and 21 deletions

View file

@ -86,16 +86,24 @@ return { -- Autocompletion
--
-- <c-l> will move you to the right of each of the expansion locations.
-- <c-h> is similar, except moving you backwards.
['<Tab>'] = cmp.mapping(function()
if luasnip.expand_or_locally_jumpable() then
['<Tab>'] = cmp.mapping(function(fallback)
if cmp.visible() then
cmp.select_next_item()
elseif luasnip.expand_or_locally_jumpable() then
luasnip.expand_or_jump()
else
fallback()
end
end, { 's' }),
['<S-Tab>'] = cmp.mapping(function()
if luasnip.locally_jumpable(-1) then
end, { 'i', 's' }),
['<S-Tab>'] = cmp.mapping(function(fallback)
if cmp.visible() then
cmp.select_next_item()
elseif luasnip.locally_jumpable(-1) then
luasnip.jump(-1)
else
fallback()
end
end, { 's' }),
end, { 'i', 's' }),
-- For more advanced Luasnip keymaps (e.g. selecting choice nodes, expansion) see:
-- https://github.com/L3MON4D3/LuaSnip?tab=readme-ov-file#keymaps

View file

@ -0,0 +1,17 @@
return {
'numToStr/Comment.nvim',
config = function()
require('Comment').setup {
opleader = {
---Line-comment keymap
line = '<leader>/',
},
toggler = {
line = '<leader>/',
},
}
end,
lazy = false,
}