diff options
Diffstat (limited to '.config/nvim/lua/plugins/cmp.lua')
-rw-r--r-- | .config/nvim/lua/plugins/cmp.lua | 39 |
1 files changed, 26 insertions, 13 deletions
diff --git a/.config/nvim/lua/plugins/cmp.lua b/.config/nvim/lua/plugins/cmp.lua index 6a93009..2e8fade 100644 --- a/.config/nvim/lua/plugins/cmp.lua +++ b/.config/nvim/lua/plugins/cmp.lua | |||
@@ -10,7 +10,6 @@ return { | |||
10 | "hrsh7th/cmp-nvim-lsp-signature-help", | 10 | "hrsh7th/cmp-nvim-lsp-signature-help", |
11 | "L3MON4D3/LuaSnip", | 11 | "L3MON4D3/LuaSnip", |
12 | "saadparwaiz1/cmp_luasnip", | 12 | "saadparwaiz1/cmp_luasnip", |
13 | "honza/vim-snippets", | ||
14 | }, | 13 | }, |
15 | config = function() | 14 | config = function() |
16 | local cmp = require("cmp") | 15 | local cmp = require("cmp") |
@@ -142,27 +141,41 @@ return { | |||
142 | end, | 141 | end, |
143 | }, | 142 | }, |
144 | { | 143 | { |
144 | 'mireq/luasnip-snippets', | ||
145 | dependencies = {'L3MON4D3/LuaSnip'}, | ||
146 | init = function() | ||
147 | require('luasnip_snippets.common.snip_utils').setup() | ||
148 | end | ||
149 | |||
150 | }, | ||
151 | { | ||
145 | "L3MON4D3/LuaSnip", | 152 | "L3MON4D3/LuaSnip", |
146 | version = "v2.*", | 153 | version = "v2.*", |
147 | dependencies = { | 154 | dependencies = { |
148 | "honza/vim-snippets", | 155 | 'nvim-treesitter/nvim-treesitter', |
149 | }, | 156 | }, |
150 | build = "make install_jsregexp", | 157 | build = "make install_jsregexp", |
151 | keys = { | ||
152 | { | ||
153 | "<C-l>", | ||
154 | function() require("luasnip").expand_or_jump() end, | ||
155 | mode = { "i", "s" }, | ||
156 | }, | ||
157 | }, | ||
158 | opts = { | 158 | opts = { |
159 | history = false, | 159 | history = false, |
160 | region_check_events = 'InsertEnter', | 160 | region_check_events = 'InsertEnter', |
161 | delete_check_events = 'InsertLeave', | 161 | delete_check_events = 'InsertLeave', |
162 | }, | 162 | }, |
163 | config = function(_, opts) | 163 | init = function() |
164 | require("luasnip").setup(opts) | 164 | local ls = require('luasnip') |
165 | require("luasnip.loaders.from_snipmate").lazy_load() | 165 | ls.setup({ |
166 | end, | 166 | -- Required to automatically include base snippets, like "c" snippets for "cpp" |
167 | load_ft_func = require('luasnip_snippets.common.snip_utils').load_ft_func, | ||
168 | ft_func = require('luasnip_snippets.common.snip_utils').ft_func, | ||
169 | -- To enable auto expansin | ||
170 | enable_autosnippets = true, | ||
171 | -- Uncomment to enable visual snippets triggered using <c-x> | ||
172 | -- store_selection_keys = '<c-x>', | ||
173 | }) | ||
174 | -- LuaSnip key bindings | ||
175 | vim.keymap.set({"i", "s"}, "<C-l>", function() if ls.expand_or_jumpable() then ls.expand_or_jump() else vim.api.nvim_input('<C-l>') end end, {silent = true}) | ||
176 | vim.keymap.set({"i", "s"}, "<C-k>", function() ls.jump(-1) end, {silent = true}) | ||
177 | vim.keymap.set({"i", "s"}, "<C-E>", function() if ls.choice_active() then ls.change_choice(1) end end, {silent = true}) | ||
178 | end | ||
179 | |||
167 | }, | 180 | }, |
168 | } | 181 | } |