LuaSnip icon indicating copy to clipboard operation
LuaSnip copied to clipboard

Convert UltiSnips snippets that are heavily based on advanced python parsing into LuaSnip

Open SingularisArt opened this issue 3 years ago • 8 comments

For a while, I've been wanting to migrate from UltiSnips to LuaSnip. But, my snippets rely heavily on advanced python setup (my snippets and its dependencies).

I only really care about the latex snippets, but how can I convert them into LuaSnips? I asked this question and @L3MON4D3 responded by saying all the python snippets have to be re-written in lua. How can I do that?

Thanks a ton!

SingularisArt avatar Aug 14 '22 02:08 SingularisArt

I'm afraid you'll have to get started from (almost) 0 :/

Might be you can reuse some Python-bits by accessing them through vim.fn.pyeval, snippets without Python could be converted using snippet-converter. For learning about luasnip, here are some great videos on YouTube (do note, we had some breaking changes after TJ made his videos, snippets are added via add_snippets now), those should get you started pretty quickly. Also, DOC.md is pretty complete, though not as beginner friendly as it could be.

If you have specific questions about some specific snippet, those are easier to help with, ask away :D

L3MON4D3 avatar Aug 14 '22 10:08 L3MON4D3

Alright. I'll start converting, and when I run into an issue, I'll ask here.

SingularisArt avatar Aug 14 '22 12:08 SingularisArt

Haha, I'm doing the same thing as well - let's get through this together. I've been slowly updating my snippets here; if you find something helpful, feel free to yank it for your own use.

P.S. perhaps we could make a megathread somewhere?

evesdropper avatar Aug 19 '22 03:08 evesdropper

@evesdropper Do you want to join my discord server?

SingularisArt avatar Aug 19 '22 21:08 SingularisArt

If that helps and can be a public forum for doing this task, sure. Otherwise, I think a thread like this here or a megathread on Reddit if possible would probably be better.

evesdropper avatar Aug 20 '22 18:08 evesdropper

Maybe a discussion? Better than an issue since there can be separate smaller threads (As answer+comments) Alternatively, general advice for converting could live in the wiki, I think that would be nice :D

L3MON4D3 avatar Aug 20 '22 21:08 L3MON4D3

+1 for discussion. Not sure how to create one though.

Alternatively, general advice for converting could live in the wiki, I think that would be nice :D

Once I get good that would be a great idea. I have some starter snippets for creating snippets and can do a few things but I'm far from knowledgeable :laughing:

evesdropper avatar Aug 20 '22 22:08 evesdropper

Opened one here for now :D https://github.com/L3MON4D3/LuaSnip/discussions/545

Once I get good that would be a great idea. I have some starter snippets for creating snippets and can do a few things but I'm far from knowledgeable :laughing:

I think there's value in giving advice before you're "good", especially in this case since most ppl converting ultisnippets will be beginners when it comes to luasnip (different perspective, you know what confused you/tripped you up/was hard to understand at first)

L3MON4D3 avatar Aug 21 '22 06:08 L3MON4D3