From 03e63fd28f54fbbd750b7bd8f8de67ebddf1081c Mon Sep 17 00:00:00 2001 From: kkard2 Date: Fri, 5 Apr 2024 10:39:41 +0200 Subject: merge confilict incoming --- nvim/init.lua | 33 ++++++++++++++++++++++++++++++--- 1 file changed, 30 insertions(+), 3 deletions(-) (limited to 'nvim') diff --git a/nvim/init.lua b/nvim/init.lua index 389e6cd..961d484 100644 --- a/nvim/init.lua +++ b/nvim/init.lua @@ -245,17 +245,44 @@ 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({ + [""] = cmp.mapping.select_next_item(), + [""] = cmp.mapping.select_prev_item(), + [""] = cmp.mapping.confirm({ select = true }), + }), + [""] = cmp.mapping(function() + if luasnip.expand_or_locally_jumpable() then + luasnip.expand_or_jump() + end + end, { "i", "s" }), + [""] = 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", @@ -277,5 +304,5 @@ require("lazy").setup({ vim.keymap.set("n", "8", function() harpoon:list():select(8) end) vim.keymap.set("n", "9", function() harpoon:list():select(9) end) end, - } + }, }) -- cgit v1.3.1