问题
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