add: snippet engine to lsp config master
authorLukas Hägele <lukas.haegele93@web.de>
Sat, 28 Oct 2023 15:35:40 +0000 (17:35 +0200)
committerLukas Hägele <lukas.haegele93@web.de>
Sat, 28 Oct 2023 15:35:40 +0000 (17:35 +0200)
after/plugin/lsp.lua
lua/lukas/packer.lua
plugin/packer_compiled.lua

index 9b6e7a01dbb1d8ffcd88d20c55b6fee8ce3b4180..c2493b622a50d803d328e025437b1db23d7d2745 100644 (file)
@@ -58,12 +58,19 @@ local cmp_mappings = cmp.mapping.preset.insert({
     ['<Tab>'] = cmp.mapping.select_next_item(cmp_select),
 })
 
     ['<Tab>'] = cmp.mapping.select_next_item(cmp_select),
 })
 
+local cmp_snippet = {
+    expand = function(args)
+        require('luasnip').lsp_expand(args.body)
+    end
+}
+
 local cmp_sources = cmp.config.sources({
 local cmp_sources = cmp.config.sources({
-    { name = 'nvim_lsp' }
+    { name = 'nvim_lsp' },
+    { name = 'luasnip' }
 })
 
 cmp.setup {
     mapping = cmp_mappings,
 })
 
 cmp.setup {
     mapping = cmp_mappings,
-    --TODO snippet = ...,
+    snippet = cmp_snippet,
     sources = cmp_sources
 }
     sources = cmp_sources
 }
index 45e9c211587fe326991201d7b4a343ef90c28988..c9d857f30576298a08ea78d907601e4bf5673f22 100644 (file)
@@ -34,6 +34,9 @@ return require('packer').startup(function(use)
     use('hrsh7th/nvim-cmp')
     -- additional capabilities
     use('hrsh7th/cmp-nvim-lsp')
     use('hrsh7th/nvim-cmp')
     -- additional capabilities
     use('hrsh7th/cmp-nvim-lsp')
+    -- snippet engine
+    use({"L3MON4D3/LuaSnip", tag = "v2.*"})
+    use{'saadparwaiz1/cmp_luasnip'}
 
     -- syntax highlighting
     use {
 
     -- syntax highlighting
     use {
@@ -41,7 +44,7 @@ return require('packer').startup(function(use)
         run = function()
             local ts_update = require('nvim-treesitter.install').update({ with_sync = true })
             ts_update()
         run = function()
             local ts_update = require('nvim-treesitter.install').update({ with_sync = true })
             ts_update()
-        end, 
+        end,
     }
 
     -- diagnostics
     }
 
     -- diagnostics
@@ -56,7 +59,7 @@ return require('packer').startup(function(use)
 
     -- wiki
     use {
 
     -- wiki
     use {
-        'serenevoid/kiwi.nvim', 
+        'serenevoid/kiwi.nvim',
         requires = { {'nvim-lua/plenary.nvim'} }
     }
 end)
         requires = { {'nvim-lua/plenary.nvim'} }
     }
 end)
index 2048e5a7aa06f43a93cf3cc97b48afba50e07fea..268f210df59e55741747f549cf6ef0eaa03c193b 100644 (file)
@@ -74,11 +74,21 @@ end
 time([[try_loadstring definition]], false)
 time([[Defining packer_plugins]], true)
 _G.packer_plugins = {
 time([[try_loadstring definition]], false)
 time([[Defining packer_plugins]], true)
 _G.packer_plugins = {
+  LuaSnip = {
+    loaded = true,
+    path = "/home/lukas/.local/share/nvim/site/pack/packer/start/LuaSnip",
+    url = "https://github.com/L3MON4D3/LuaSnip"
+  },
   ["cmp-nvim-lsp"] = {
     loaded = true,
     path = "/home/lukas/.local/share/nvim/site/pack/packer/start/cmp-nvim-lsp",
     url = "https://github.com/hrsh7th/cmp-nvim-lsp"
   },
   ["cmp-nvim-lsp"] = {
     loaded = true,
     path = "/home/lukas/.local/share/nvim/site/pack/packer/start/cmp-nvim-lsp",
     url = "https://github.com/hrsh7th/cmp-nvim-lsp"
   },
+  cmp_luasnip = {
+    loaded = true,
+    path = "/home/lukas/.local/share/nvim/site/pack/packer/start/cmp_luasnip",
+    url = "https://github.com/saadparwaiz1/cmp_luasnip"
+  },
   harpoon = {
     loaded = true,
     path = "/home/lukas/.local/share/nvim/site/pack/packer/start/harpoon",
   harpoon = {
     loaded = true,
     path = "/home/lukas/.local/share/nvim/site/pack/packer/start/harpoon",