lunasnip super-tab like mapping example from hrsh7th/nvim-cmp
This commit is contained in:
		
							parent
							
								
									d0ad028efc
								
							
						
					
					
						commit
						2eab84f8f1
					
				| @ -41,24 +41,24 @@ local default = { | |||||||
|          behavior = cmp.ConfirmBehavior.Replace, |          behavior = cmp.ConfirmBehavior.Replace, | ||||||
|          select = true, |          select = true, | ||||||
|       }, |       }, | ||||||
|       ["<Tab>"] = function(fallback) |       ["<Tab>"] = cmp.mapping(function(fallback) | ||||||
|          if cmp.visible() then |          if cmp.visible() then | ||||||
|             cmp.select_next_item() |             cmp.select_next_item() | ||||||
|          elseif snippets_status and require("luasnip").expand_or_jumpable() then |          elseif snippets_status and require("luasnip").expand_or_jumpable() then | ||||||
|             vim.fn.feedkeys(vim.api.nvim_replace_termcodes("<Plug>luasnip-expand-or-jump", true, true, true), "") |             require("luasnip").expand_or_jump() | ||||||
|          else |          else | ||||||
|             fallback() |             fallback() | ||||||
|          end |          end | ||||||
|       end, |       end, { "i", "s" }), | ||||||
|       ["<S-Tab>"] = function(fallback) |       ["<S-Tab>"] = cmp.mapping(function(fallback) | ||||||
|          if cmp.visible() then |          if cmp.visible() then | ||||||
|             cmp.select_prev_item() |             cmp.select_prev_item() | ||||||
|          elseif snippets_status and require("luasnip").jumpable(-1) then |          elseif require("luasnip").jumpable(-1) then | ||||||
|             vim.fn.feedkeys(vim.api.nvim_replace_termcodes("<Plug>luasnip-jump-prev", true, true, true), "") |             require("luasnip").jump(-1) | ||||||
|          else |          else | ||||||
|             fallback() |             fallback() | ||||||
|          end |          end | ||||||
|       end, |       end, { "i", "s" }), | ||||||
|    }, |    }, | ||||||
|    sources = { |    sources = { | ||||||
|       { name = "nvim_lsp" }, |       { name = "nvim_lsp" }, | ||||||
|  | |||||||
		Loading…
	
		Reference in New Issue
	
	Block a user