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

Breaks Luasnip for triggers ending in '>' #102

Closed
ribru17 opened this issue Apr 12, 2023 · 3 comments
Closed

Breaks Luasnip for triggers ending in '>' #102

ribru17 opened this issue Apr 12, 2023 · 3 comments

Comments

@ribru17
Copy link

ribru17 commented Apr 12, 2023

See this issue. This plugin causes Luasnip snippets to not autoexpand when their trigger ends in the > character.

@windwp
Copy link
Owner

windwp commented Apr 12, 2023

you should choose 1 or write your own mapping function to combine both plugin

@yioneko
Copy link

yioneko commented Apr 25, 2023

Same issue here. I make a dirty hack to avoid '>' key mapping.

@ribru17
Copy link
Author

ribru17 commented May 9, 2023

To anyone facing this issue, add this after setting up your Luasnip:

local ls = require('luasnip')
local autotag = require('nvim-ts-autotag.internal')
vim.keymap.set('i', '>', function()
  local row, col = unpack(vim.api.nvim_win_get_cursor(0))
  vim.api.nvim_buf_set_text(0, row - 1, col, row - 1, col, { '>' })
  autotag.close_tag()
  vim.api.nvim_win_set_cursor(0, { row, col + 1 })
  ls.expand_auto()
end, { remap = false })

@ribru17 ribru17 closed this as completed May 9, 2023
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 a pull request may close this issue.

3 participants