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

@ -57,18 +57,3 @@ vim.keymap.set('n', '<leader>q', vim.diagnostic.setloclist, { desc = 'Open diagn
-- NOTE: This won't work in all terminal emulators/tmux/etc. Try your own mapping -- NOTE: This won't work in all terminal emulators/tmux/etc. Try your own mapping
-- or just use <C-\><C-n> to exit terminal mode -- or just use <C-\><C-n> to exit terminal mode
vim.keymap.set('t', '<Esc><Esc>', '<C-\\><C-n>', { desc = 'Exit terminal mode' }) vim.keymap.set('t', '<Esc><Esc>', '<C-\\><C-n>', { desc = 'Exit terminal mode' })
-- TIP: Disable arrow keys in normal mode
-- vim.keymap.set('n', '<left>', '<cmd>echo "Use h to move!!"<CR>')
-- vim.keymap.set('n', '<right>', '<cmd>echo "Use l to move!!"<CR>')
-- vim.keymap.set('n', '<up>', '<cmd>echo "Use k to move!!"<CR>')
-- vim.keymap.set('n', '<down>', '<cmd>echo "Use j to move!!"<CR>')
-- Keybinds to make split navigation easier.
-- Use CTRL+<hjkl> to switch between windows
--
-- See `:help wincmd` for a list of all window commands
-- vim.keymap.set('n', '<C-h>', '<C-w><C-h>', { desc = 'Move focus to the left window' })
-- vim.keymap.set('n', '<C-l>', '<C-w><C-l>', { desc = 'Move focus to the right window' })
-- vim.keymap.set('n', '<C-j>', '<C-w><C-j>', { desc = 'Move focus to the lower window' })
-- vim.keymap.set('n', '<C-k>', '<C-w><C-k>', { desc = 'Move focus to the upper window' })

View File

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

View File

@ -18,6 +18,7 @@ require('lazy').setup({
require 'kickstart.plugins.autopairs', require 'kickstart.plugins.autopairs',
require 'kickstart.plugins.harpoon', require 'kickstart.plugins.harpoon',
require 'kickstart.plugins.todo_comments', require 'kickstart.plugins.todo_comments',
require 'kickstart.plugins.comments',
require 'kickstart.plugins.gitsigns', -- adds gitsigns recommend keymaps require 'kickstart.plugins.gitsigns', -- adds gitsigns recommend keymaps
-- require 'kickstart.plugins.debug', -- require 'kickstart.plugins.debug',