Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tab jump is working but normal tab for tab space is not! #1268

Open
patelharsh9797 opened this issue Dec 6, 2024 · 1 comment
Open

Tab jump is working but normal tab for tab space is not! #1268

patelharsh9797 opened this issue Dec 6, 2024 · 1 comment

Comments

@patelharsh9797
Copy link

patelharsh9797 commented Dec 6, 2024

I'm using this below LuaSnip config with nvim-cmp. Now, when is the snippets and press the <Tab> it's move to the next jump.
However, if I'm not using any snippets and let say i'm just editing normal text and if I press <Tab> it's not working for a tab space as it should by default. If i comment below code it's works fine for the tab space but not for the snippets jump.

Is there anyway to work around for both?

      local luasnip = require("luasnip")
      vim.keymap.set({ "i", "s" }, "<Tab>", function()
        luasnip.jump(1)
      end, { silent = true })
      vim.keymap.set({ "i", "s" }, "<S-Tab>", function()
        luasnip.jump(-1)
      end, { silent = true })

      luasnip.setup({
        region_check_events = "CursorHold,InsertLeave",
        delete_check_events = "TextChanged,InsertEnter",
      })

@L3MON4D3
Copy link
Owner

Hi :)
You could make <Tab> jump if luasnip.locally_jumpable returns true (it indicates whether there is a node that can be jumped to), and just insert a <Tab> otherwise

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

No branches or pull requests

2 participants