wyc
wyc

Reputation: 55293

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
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?

Upvotes: 2

Views: 612

Answers (3)

jinfield
jinfield

Reputation: 312

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.

Upvotes: 3

jamessan
jamessan

Reputation: 42727

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.

Upvotes: 3

Jeffrey Jose
Jeffrey Jose

Reputation: 2052

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=""

Upvotes: 1

Related Questions