Switch to vim-snippy for snippets
This commit is contained in:
		
							parent
							
								
									bf0f34cbaf
								
							
						
					
					
						commit
						ba3d067718
					
				|  | @ -12,9 +12,9 @@ cmp.setup({ | ||||||
|     snippet = { |     snippet = { | ||||||
|         -- REQUIRED - you must specify a snippet engine |         -- REQUIRED - you must specify a snippet engine | ||||||
|         expand = function(args) |         expand = function(args) | ||||||
|             vim.fn["vsnip#anonymous"](args.body) -- For `vsnip` users. |             -- vim.fn["vsnip#anonymous"](args.body) -- For `vsnip` users. | ||||||
|             -- require('luasnip').lsp_expand(args.body) -- For `luasnip` users. |             -- require('luasnip').lsp_expand(args.body) -- For `luasnip` users. | ||||||
|             -- require('snippy').expand_snippet(args.body) -- For `snippy` users. |             require('snippy').expand_snippet(args.body) -- For `snippy` users. | ||||||
|             -- vim.fn["UltiSnips#Anon"](args.body) -- For `ultisnips` users. |             -- vim.fn["UltiSnips#Anon"](args.body) -- For `ultisnips` users. | ||||||
|         end, |         end, | ||||||
|     }, |     }, | ||||||
|  | @ -25,30 +25,40 @@ cmp.setup({ | ||||||
|     mapping = cmp.mapping.preset.insert({ |     mapping = cmp.mapping.preset.insert({ | ||||||
|         ['<CR>'] = cmp.mapping.confirm({ select = true }), -- Accept currently selected item. Set `select` to `false` to only confirm explicitly selected items. |         ['<CR>'] = cmp.mapping.confirm({ select = true }), -- Accept currently selected item. Set `select` to `false` to only confirm explicitly selected items. | ||||||
|         ["<Tab>"] = cmp.mapping(function(fallback) |         ["<Tab>"] = cmp.mapping(function(fallback) | ||||||
|             if vim.fn["vsnip#jumpable"](1) == 1 then |       if cmp.visible() then | ||||||
|                 feedkey("<Plug>(vsnip-jump-next)", "") |         if require'snippy'.can_expand_or_advance() then | ||||||
|             elseif cmp.visible() then |           cmp.select_next_item({ behavior = cmp.SelectBehavior.Select }) | ||||||
|                 cmp.select_next_item() |         else | ||||||
|             else |           cmp.select_next_item({ behavior = cmp.SelectBehavior.Insert }) | ||||||
|                 fallback() -- The fallback function sends a already mapped key. In this case, it's probably `<Tab>`. |         end | ||||||
|             end |       elseif require'snippy'.can_expand_or_advance() then | ||||||
|         end, { "i", "s" }), |         require'snippy'.expand_or_advance() | ||||||
|  |       else | ||||||
|  |         fallback() | ||||||
|  |       end | ||||||
|  |     end, { "i", "s" }), | ||||||
| 
 | 
 | ||||||
|         ['<S-Tab>'] = cmp.mapping(function() |     ["<S-Tab>"] = cmp.mapping(function(fallback) | ||||||
|             if vim.fn["vsnip#jumpable"](1) == 1 then |       if cmp.visible() then | ||||||
|                 feedkey("<Plug>(vsnip-jump-next)", "") |         if require'snippy'.can_expand_or_advance() then | ||||||
|             elseif cmp.visible() then |           cmp.select_prev_item({ behavior = cmp.SelectBehavior.Select }) | ||||||
|                 cmp.select_next_item() |         else | ||||||
|             end |           cmp.select_prev_item({ behavior = cmp.SelectBehavior.Insert }) | ||||||
|         end, { "i", "s"}), |         end | ||||||
|  |       elseif require'snippy'.can_jump(-1) then | ||||||
|  |         require'snippy'.previous() | ||||||
|  |       else | ||||||
|  |         fallback() | ||||||
|  |       end | ||||||
|  |     end, { "i", "s" }), | ||||||
|     }), |     }), | ||||||
|     sources = cmp.config.sources({ |     sources = cmp.config.sources({ | ||||||
|         { name = 'nvim_lsp' }, |         { name = 'nvim_lsp' }, | ||||||
|         { name = 'path' }, |         { name = 'path' }, | ||||||
|         { name = 'vsnip' }, -- For vsnip users. |         -- { name = 'vsnip' }, -- For vsnip users. | ||||||
|         -- { name = 'luasnip' }, -- For luasnip users. |         -- { name = 'luasnip' }, -- For luasnip users. | ||||||
|         -- { name = 'ultisnips' }, -- For ultisnips users. |         -- { name = 'ultisnips' }, -- For ultisnips users. | ||||||
|         -- { name = 'snippy' }, -- For snippy users. |         { name = 'snippy' }, -- For snippy users. | ||||||
|     }, { |     }, { | ||||||
|         { name = 'buffer' }, |         { name = 'buffer' }, | ||||||
|     }) |     }) | ||||||
|  |  | ||||||
|  | @ -28,7 +28,7 @@ require('lazy').setup({ | ||||||
|     {"folke/trouble.nvim", dependencies = {"nvim-tree/nvim-web-devicons"}}, |     {"folke/trouble.nvim", dependencies = {"nvim-tree/nvim-web-devicons"}}, | ||||||
|     {"nvim-treesitter/nvim-treesitter", build = ":TSUpdate"}, |     {"nvim-treesitter/nvim-treesitter", build = ":TSUpdate"}, | ||||||
|     {"NeogitOrg/neogit", dependencies = {"nvim-lua/plenary.nvim", "nvim-telescope/telescope.nvim", "sindrets/diffview.nvim"}, config = true}, |     {"NeogitOrg/neogit", dependencies = {"nvim-lua/plenary.nvim", "nvim-telescope/telescope.nvim", "sindrets/diffview.nvim"}, config = true}, | ||||||
|     {'hrsh7th/nvim-cmp', dependencies = {'hrsh7th/cmp-buffer', 'hrsh7th/cmp-cmdline', 'hrsh7th/cmp-nvim-lsp', 'hrsh7th/cmp-path', 'hrsh7th/vim-vsnip', 'hrsh7th/vim-vsnip-integ'}}, |     {'hrsh7th/nvim-cmp', dependencies = {'hrsh7th/cmp-buffer', 'hrsh7th/cmp-cmdline', 'hrsh7th/cmp-nvim-lsp', 'hrsh7th/cmp-path', 'dcampos/nvim-snippy', 'honza/vim-snippets','dcampos/cmp-snippy' }}, | ||||||
|     {'nvim-lualine/lualine.nvim', dependencies = { 'nvim-tree/nvim-web-devicons', opt = true }}, |     {'nvim-lualine/lualine.nvim', dependencies = { 'nvim-tree/nvim-web-devicons', opt = true }}, | ||||||
|     {'nvim-telescope/telescope-fzf-native.nvim', build = 'cmake -S. -Bbuild -DCMAKE_BUILD_TYPE=Release && cmake --build build --config Release && cmake --install build --prefix build' }, |     {'nvim-telescope/telescope-fzf-native.nvim', build = 'cmake -S. -Bbuild -DCMAKE_BUILD_TYPE=Release && cmake --build build --config Release && cmake --install build --prefix build' }, | ||||||
|     {'nvim-telescope/telescope.nvim', dependencies = {'nvim-lua/plenary.nvim'}}, |     {'nvim-telescope/telescope.nvim', dependencies = {'nvim-lua/plenary.nvim'}}, | ||||||
|  |  | ||||||
		Loading…
	
		Reference in New Issue