How to have multiples matches for a snippet in Vim's snipMate plugin (with a dropdown menu)
snipmates expands div as <div id = " ">
. I want snipmate to show a dropdown menu where I can choose between div id ="" and div class=""
(after creating the second one).
The documentation says:
snippet trigger A description of snippet #1
expand this text开发者_StackOverflow
snippet trigger A description of snippet #2
expand THIS text!
but this effectively opens a small window below where I choose a number and then press enter. But is there a way to make it a dropdown menu?
No, there isn't a way to make the current implementation use a popup menu like is used for completion. You could file a feature request against snipMate and see if the author can change it to do that, but I'm not sure that'd be easy to do.
I like to use:
<div ${1:id}="${2}">
</div>
This allows me to replace id with class when needed, then tab to the value placeholder.
This doesnt answer your question directly, but if you dont get a definite answer from others consider making two keys words for the two snippets. Something like ..
divi
--> <div id=""
divc
--> <div class=""
精彩评论