Switch to vim-snippy for snippets
This commit is contained in:
		
							parent
							
								
									bf0f34cbaf
								
							
						
					
					
						commit
						ba3d067718
					
				|  | @ -12,9 +12,9 @@ cmp.setup({ | |||
|     snippet = { | ||||
|         -- REQUIRED - you must specify a snippet engine | ||||
|         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('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. | ||||
|         end, | ||||
|     }, | ||||
|  | @ -25,30 +25,40 @@ cmp.setup({ | |||
|     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. | ||||
|         ["<Tab>"] = cmp.mapping(function(fallback) | ||||
|             if vim.fn["vsnip#jumpable"](1) == 1 then | ||||
|                 feedkey("<Plug>(vsnip-jump-next)", "") | ||||
|             elseif cmp.visible() then | ||||
|                 cmp.select_next_item() | ||||
|       if cmp.visible() then | ||||
|         if require'snippy'.can_expand_or_advance() then | ||||
|           cmp.select_next_item({ behavior = cmp.SelectBehavior.Select }) | ||||
|         else | ||||
|                 fallback() -- The fallback function sends a already mapped key. In this case, it's probably `<Tab>`. | ||||
|           cmp.select_next_item({ behavior = cmp.SelectBehavior.Insert }) | ||||
|         end | ||||
|       elseif require'snippy'.can_expand_or_advance() then | ||||
|         require'snippy'.expand_or_advance() | ||||
|       else | ||||
|         fallback() | ||||
|       end | ||||
|     end, { "i", "s" }), | ||||
| 
 | ||||
|         ['<S-Tab>'] = cmp.mapping(function() | ||||
|             if vim.fn["vsnip#jumpable"](1) == 1 then | ||||
|                 feedkey("<Plug>(vsnip-jump-next)", "") | ||||
|             elseif cmp.visible() then | ||||
|                 cmp.select_next_item() | ||||
|     ["<S-Tab>"] = cmp.mapping(function(fallback) | ||||
|       if cmp.visible() then | ||||
|         if require'snippy'.can_expand_or_advance() then | ||||
|           cmp.select_prev_item({ behavior = cmp.SelectBehavior.Select }) | ||||
|         else | ||||
|           cmp.select_prev_item({ behavior = cmp.SelectBehavior.Insert }) | ||||
|         end | ||||
|       elseif require'snippy'.can_jump(-1) then | ||||
|         require'snippy'.previous() | ||||
|       else | ||||
|         fallback() | ||||
|       end | ||||
|     end, { "i", "s" }), | ||||
|     }), | ||||
|     sources = cmp.config.sources({ | ||||
|         { name = 'nvim_lsp' }, | ||||
|         { name = 'path' }, | ||||
|         { name = 'vsnip' }, -- For vsnip users. | ||||
|         -- { name = 'vsnip' }, -- For vsnip users. | ||||
|         -- { name = 'luasnip' }, -- For luasnip users. | ||||
|         -- { name = 'ultisnips' }, -- For ultisnips users. | ||||
|         -- { name = 'snippy' }, -- For snippy users. | ||||
|         { name = 'snippy' }, -- For snippy users. | ||||
|     }, { | ||||
|         { name = 'buffer' }, | ||||
|     }) | ||||
|  |  | |||
|  | @ -28,7 +28,7 @@ require('lazy').setup({ | |||
|     {"folke/trouble.nvim", dependencies = {"nvim-tree/nvim-web-devicons"}}, | ||||
|     {"nvim-treesitter/nvim-treesitter", build = ":TSUpdate"}, | ||||
|     {"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-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'}}, | ||||
|  |  | |||
		Loading…
	
		Reference in New Issue