diff --git a/lazy-lock-nvim_lsp.json b/lazy-lock-nvim_lsp.json index 0c9df2b..f005d5c 100644 --- a/lazy-lock-nvim_lsp.json +++ b/lazy-lock-nvim_lsp.json @@ -1,4 +1,5 @@ { + "LuaSnip": { "branch": "master", "commit": "7ad2eaeaca56d6ed63acacbfc114b99f1f67b982" }, "aerial.nvim": { "branch": "master", "commit": "4e77964569ef47a70f9bb76c668dcfea2d089d5a" }, "bufdelete.nvim": { "branch": "master", "commit": "576a142108117f9326365bf4f7c494619aed55fe" }, "bufferline.nvim": { "branch": "main", "commit": "99337f63f0a3c3ab9519f3d1da7618ca4f91cffe" }, @@ -9,6 +10,7 @@ "cmp-nvim-lsp": { "branch": "main", "commit": "39e2eda76828d88b773cc27a3f61d2ad782c922d" }, "cmp-nvim-lua": { "branch": "main", "commit": "f12408bdb54c39c23e67cab726264c10db33ada8" }, "cmp-tabnine": { "branch": "main", "commit": "d52aae40ee86b62960c31a003352ddfc9e31c8d2" }, + "cmp_luasnip": { "branch": "master", "commit": "05a9ab28b53f71d1aece421ef32fee2cb857a843" }, "conform.nvim": { "branch": "master", "commit": "9a06e83527407a7600a2fe4e0d10adf432b6215e" }, "copilot.lua": { "branch": "master", "commit": "86537b286f18783f8b67bccd78a4ef4345679625" }, "csv.vim": { "branch": "master", "commit": "4d5255829afe3b6badb0c8a040116704c0d3213c" }, @@ -38,6 +40,7 @@ "mini.pairs": { "branch": "main", "commit": "927d19cbdd0e752ab1c7eed87072e71d2cd6ff51" }, "neogen": { "branch": "main", "commit": "6de0add4805165317ab7d3d36b5cef48b1b865f3" }, "nvim-FeMaco.lua": { "branch": "main", "commit": "96bbf843595dbe865838b3f2484b73557f34700c" }, + "nvim-autopairs": { "branch": "master", "commit": "78a4507bb9ffc9b00f11ae0ac48243d00cb9194d" }, "nvim-bqf": { "branch": "main", "commit": "1b24dc6050c34e8cd377b6b4cd6abe40509e0187" }, "nvim-cmp": { "branch": "main", "commit": "d818fd0624205b34e14888358037fb6f5dc51234" }, "nvim-colorizer.lua": { "branch": "master", "commit": "08bd34bf0ed79723f62764c7f9ca70516d461d0d" }, diff --git a/lua/ysl/lsp/nvim_lsp.lua b/lua/ysl/lsp/nvim_lsp.lua index 42893c2..05df0d9 100644 --- a/lua/ysl/lsp/nvim_lsp.lua +++ b/lua/ysl/lsp/nvim_lsp.lua @@ -212,65 +212,65 @@ return { }) end }, - -- { - -- 'L3MON4D3/LuaSnip', -- Snippets plugin - -- build = 'make install_jsregexp', - -- lazy = true, - -- config = function () - -- require('luasnip.loaders.from_vscode').lazy_load({ paths = { - -- U.CUSTOM_SNIPPETS_PATH, - -- U.path({vim.fn.stdpath('data'), 'lazy', 'friendly-snippets'}), - -- U.path({vim.fn.stdpath('data'), 'lazy', 'cython-snips'}), - -- }}) - -- local luasnip = require('luasnip') - -- -- Stop snippets when you leave to normal mode - -- vim.api.nvim_create_autocmd('ModeChanged', { - -- callback = function() - -- if ((vim.v.event.old_mode == 's' and vim.v.event.new_mode == 'n') or vim.v.event.old_mode == 'i') - -- and luasnip.session.current_nodes[vim.api.nvim_get_current_buf()] - -- and not luasnip.session.jump_active - -- then - -- luasnip.unlink_current() - -- end - -- end - -- }) - -- end - -- }, { - 'garymjr/nvim-snippets', - dependencies = { - 'rafamadriz/friendly-snippets', - }, - keys = { - { - '', - function() - return vim.snippet.active({ direction = 1 }) and 'lua vim.snippet.jump(1)' or '' - end, - expr = true, - silent = true, - mode = { 'i', 's' }, - }, - { - '', - function() - return vim.snippet.active({ direction = -1 }) and 'lua vim.snippet.jump(-1)' or '' - end, - expr = true, - silent = true, - mode = { 'i', 's' }, - }, - }, - config = function() - require('snippets').setup({ - friendly_snippets = true, - search_paths = { - U.CUSTOM_SNIPPETS_PATH, - U.path({vim.fn.stdpath('data'), 'lazy', 'cython-snips'}), - } + 'L3MON4D3/LuaSnip', -- Snippets plugin + build = 'make install_jsregexp', + lazy = true, + config = function () + require('luasnip.loaders.from_vscode').lazy_load({ paths = { + U.CUSTOM_SNIPPETS_PATH, + U.path({vim.fn.stdpath('data'), 'lazy', 'friendly-snippets'}), + U.path({vim.fn.stdpath('data'), 'lazy', 'cython-snips'}), + }}) + local luasnip = require('luasnip') + -- Stop snippets when you leave to normal mode + vim.api.nvim_create_autocmd('ModeChanged', { + callback = function() + if ((vim.v.event.old_mode == 's' and vim.v.event.new_mode == 'n') or vim.v.event.old_mode == 'i') + and luasnip.session.current_nodes[vim.api.nvim_get_current_buf()] + and not luasnip.session.jump_active + then + luasnip.unlink_current() + end + end }) end }, + -- { + -- 'garymjr/nvim-snippets', + -- dependencies = { + -- 'rafamadriz/friendly-snippets', + -- }, + -- keys = { + -- { + -- '', + -- function() + -- return vim.snippet.active({ direction = 1 }) and 'lua vim.snippet.jump(1)' or '' + -- end, + -- expr = true, + -- silent = true, + -- mode = { 'i', 's' }, + -- }, + -- { + -- '', + -- function() + -- return vim.snippet.active({ direction = -1 }) and 'lua vim.snippet.jump(-1)' or '' + -- end, + -- expr = true, + -- silent = true, + -- mode = { 'i', 's' }, + -- }, + -- }, + -- config = function() + -- require('snippets').setup({ + -- friendly_snippets = true, + -- search_paths = { + -- U.CUSTOM_SNIPPETS_PATH, + -- U.path({vim.fn.stdpath('data'), 'lazy', 'cython-snips'}), + -- } + -- }) + -- end + -- }, { -- 'ysl2/nvim-cmp', -- Autocompletion plugin 'hrsh7th/nvim-cmp', -- Autocompletion plugin @@ -279,9 +279,9 @@ return { 'hrsh7th/cmp-nvim-lsp', -- LSP source for nvim-cmp 'hrsh7th/cmp-buffer', 'https://codeberg.org/FelipeLema/cmp-async-path', - -- 'L3MON4D3/LuaSnip', -- Snippets plugin + 'L3MON4D3/LuaSnip', -- Snippets plugin 'garymjr/nvim-snippets', - -- 'saadparwaiz1/cmp_luasnip', -- Snippets source for nvim-cmp + 'saadparwaiz1/cmp_luasnip', -- Snippets source for nvim-cmp { 'tzachar/cmp-tabnine', build = (vim.fn.has('win32') == 1) and 'powershell ./install.ps1' or './install.sh', @@ -295,14 +295,14 @@ return { config = function () -- Set up nvim-cmp. local cmp = require('cmp') - -- local luasnip = require('luasnip') + local luasnip = require('luasnip') cmp.setup({ completion = { completeopt = 'menu,menuone,noinsert' }, snippet = { expand = function(args) - -- luasnip.lsp_expand(args.body) -- For `luasnip` users. - -- vim.snippet.active() - vim.snippet.expand(args.body) + luasnip.lsp_expand(args.body) -- For `luasnip` users. + -- vim.snippet.active() -- No need to add this at all, whether or not `luasnip` or `nvim-snippets` users. + -- vim.snippet.expand(args.body) end, }, mapping = cmp.mapping.preset.insert({ @@ -325,24 +325,24 @@ return { -- fallback() -- end -- end, { 'i', 's' }), - -- [''] = cmp.mapping(function(fallback) - -- if luasnip.expand_or_jumpable() then - -- vim.fn.feedkeys(vim.api.nvim_replace_termcodes('luasnip-expand-or-jump', true, true, true), "") - -- else - -- fallback() - -- end - -- end, { 'i', 's' }), - -- [''] = cmp.mapping(function(fallback) - -- if luasnip.jumpable(-1) then - -- vim.fn.feedkeys(vim.api.nvim_replace_termcodes('luasnip-jump-prev', true, true, true), "") - -- else - -- fallback() - -- end - -- end, { 'i', 's' }), + [''] = cmp.mapping(function(fallback) + if luasnip.expand_or_jumpable() then + vim.fn.feedkeys(vim.api.nvim_replace_termcodes('luasnip-expand-or-jump', true, true, true), "") + else + fallback() + end + end, { 'i', 's' }), + [''] = cmp.mapping(function(fallback) + if luasnip.jumpable(-1) then + vim.fn.feedkeys(vim.api.nvim_replace_termcodes('luasnip-jump-prev', true, true, true), "") + else + fallback() + end + end, { 'i', 's' }), }), sources = cmp.config.sources({ { name = 'cmp_tabnine' }, - -- { name = 'luasnip' }, + { name = 'luasnip' }, { name = 'snippets' }, { name = 'lazydev' }, { name = 'nvim_lua' },