-
-
Notifications
You must be signed in to change notification settings - Fork 690
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
Use tabstop exclusively in an interpolation #1511
Comments
how should the snippet know which |
I imagined the following: I type my snippet shortcut (rh for react hook or something like that), click tab to get the boilerplate code without the name & when I start typing, it will take the text I type and capitalize it. Kind of like a normal snippet with just 1 tabstop, but the text from this tabstop should instantly get capitalized. I.e., once I type the first letter "n" (for name) it should give me an N instead of an n. So, it would still have the tabstop, but that tabstop would only be found "inside" of the interpolation. |
Ah, this is difficult to do, since UltiSnips cannot control the text that Vim types into the buffer. And it would confuse Vim a lot to modify text "under it" so to speak, so unfortunately this will not be easy to implement. |
Hmm, guess there's no simple built-in solution for this then, maybe I'll have a try at implementing it at some point. Could you elaborate on what you mean by "it cannot control the text that Vim types into the buffer"? |
@alexandersokolow Patch would be very welcome! What I mean is that if you type a character, Vim is interpreting your input and puts the char in the buffer. Only after, UltiSnips gets a chance to modify the buffer. If it overwrites what Vim just put into the buffer, vim gets really confused. |
Hi, I wanted to create a snippet for react hooks, which usually go by the naming convention of "useName".
It's easy to do if I have use the uncapitalized version somewhere else, but if I only want to have the capitalized version of my input, it won't prompt me for the first tabstop & just complete the snippet with an empty input.
I.e., look at this snippet (where capitalize_first is a function doing exactly what the name says haha):
It will complete immediately without prompting me for text & just return "use"
The following works:
But it will give me:
name
useName
instead of just:
useName
How can I make it just give me the useName?
Btw, if you wondering whether this simple snippet isn't pretty useless, I actually want to generate the following:
The text was updated successfully, but these errors were encountered: