Skip to content

Conversation

@saifulapm
Copy link

Hi, In Luasnip, I prefer using <C-j> and <C-k> for snippet expanding/jumping. But here We can only jump if snippet already expanded. I didn't find anything that can solve my problem.

If I don't use cmp then how we can expand snippet ?

If req is a snippet for require() then after typing req then If I press , it should expand snippet.

This is the pull request what I have added in my nvim config. May be I was wrong. May be there is a better way to do this. I am new in Neovim. Sorry If I make something wrong.

Here is my <C-j> and <C-k> mapping.

vim.keymap.set({ "i", "s" }, "<C-j>", function()
  require("snippets").expand_or_jump()
end, { desc = "Snippet Expand/Jump Next" })

vim.keymap.set({ "i", "s" }, "<C-k>", function()
  if vim.snippet.active({ direction = -1 }) then
    vim.schedule(function()
      vim.snippet.jump(-1)
    end)
  end
end, { desc = "Snippet Jump Prev" })

Just add this feature if it's missing.

Thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant