Get list of snippets for word under the cursor

17 views
Skip to first unread message

Israel Chauca F.

unread,
Dec 4, 2011, 4:34:21 AM12/4/11
to xptemplate
Hi,

Is there a way to get a list of the snippets that match the word under
the cursor or at least the list of available snippets for the
filetype?

I want to use that list for a plugin I'm working on that will
automatically display the available snippets on a scratch window. I
know there is the popup menu, it's just that for me is easier to have
the window always open.

Thanks!
Israel

dr-dr xp

unread,
Dec 21, 2011, 12:21:01 AM12/21/11
to xptem...@googlegroups.com
You know that xptemplate holds snippets belonging to multiple language(filetype) in a single buffer. Like that css snippets and html snippets are all loaded.

If you want to get snippets for a single filetype, use this:
echo keys(b:xptemplateData.filetypes[ 'vim' ].allTemplates)

To get filetype you can use variable &filetype, or call internal function :
echo b:XPTfiletypeDetect()

This function is only defined for filetypes with sub-filetype embedded, like html( with css and javascript embedded )

Be aware of that Some of snippets you get are internal snippets, which user should never use directly.




Israel

--
You received this message because you are subscribed to the Google Groups "xptemplate" group.
To post to this group, send email to xptem...@googlegroups.com.
To unsubscribe from this group, send email to xptemplate+...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/xptemplate?hl=en.




--
要了几天饱饭就不记得西北风啥味了
Reply all
Reply to author
Forward
0 new messages