diff options
| -rw-r--r-- | nvim/init.lua | 33 |
1 files changed, 30 insertions, 3 deletions
diff --git a/nvim/init.lua b/nvim/init.lua index 389e6cd..961d484 100644 --- a/nvim/init.lua +++ b/nvim/init.lua @@ -245,18 +245,45 @@ require("lazy").setup({ { "hrsh7th/cmp-nvim-lsp" }, { "hrsh7th/nvim-cmp", - dependencies = { "quangnguyen30192/cmp-nvim-tags" }, + dependencies = { "quangnguyen30192/cmp-nvim-tags", "L3MON4D3/LuaSnip", "saadparwaiz1/cmp_luasnip" }, config = function() - require("cmp").setup({ + local cmp = require("cmp") + local luasnip = require("luasnip") + cmp.setup({ + snippet = { + expand = function(args) + luasnip.lsp_expand(args.body) + end, + }, sources = { { name = "nvim_lsp" }, + { name = "luasnip" }, { name = "tags" }, }, + mapping = cmp.mapping.preset.insert({ + ["<C-n>"] = cmp.mapping.select_next_item(), + ["<C-p>"] = cmp.mapping.select_prev_item(), + ["<C-y>"] = cmp.mapping.confirm({ select = true }), + }), + ["<C-l>"] = cmp.mapping(function() + if luasnip.expand_or_locally_jumpable() then + luasnip.expand_or_jump() + end + end, { "i", "s" }), + ["<C-h>"] = cmp.mapping(function() + if luasnip.locally_jumpable(-1) then + luasnip.jump(-1) + end + end, { "i", "s" }), }) end }, { + "L3MON4D3/LuaSnip", + version = "v2.*", + }, + { "ThePrimeagen/harpoon", branch = "harpoon2", dependencies = { "nvim-lua/plenary.nvim" }, @@ -277,5 +304,5 @@ require("lazy").setup({ vim.keymap.set("n", "<leader>8", function() harpoon:list():select(8) end) vim.keymap.set("n", "<leader>9", function() harpoon:list():select(9) end) end, - } + }, }) |
