Sublime snippet with params on tabTrigger

核能气质少年 提交于 2020-01-04 02:54:27

问题


For example somewhere inside .html file i type:

temp:some-id

And expect my snippet creation magic to return this with the specified "some-id" :

<script type="text/template" id="some-id"></script>

So i need a way to trigger some text and pass through some arguments to the snippet creation file so when the triggering happens I can assign that arguments to some tab-placeholder inside .sublime-snippet. Any ideas?

P.S. im using sublime text 2, if it matters.


回答1:


You should use the variable $TM_CURRENT_WORD, you can look into this page for more detail

However when testing this I noticed that if I have the snippet:

Hello, $TM_CURRENT_WORD

with the trigger hello: with my desired word directly after : something like hello:user i must have user highlighted if I want a tab to trigger my snippet so it should work just as fine with the variable $SELECTION in this case.

Hope this helps.



来源:https://stackoverflow.com/questions/20056617/sublime-snippet-with-params-on-tabtrigger

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!