sublimetext2 - Create Key Binging in Sublime Text 2 that tags highlighted text with snippet -


i have built snippet. works fine.
better understand problem, lets snippet creates anchor tag inline styling:

<a style="color:red;font-weight:30px;"></a> 

my problem when attempt add key binding such as:

{ "keys": ["ctrl+a"], "command": "insert_snippet", "args": {"name": "packages/user/red-anchor.sublime-snippet"} } 

if select highlighted text, click ctrl+a, deletes text , adds snippet. rather wrap text inside snippet. such as:

<a style="color:red;font-weight:30px;">helloworld</a> 

any ideas?
in advance!!

if @ documentation on snippets, you'll see there number of variables can accessed, including $selection. so, snippet should be:

<snippet>     <content><![cdata[<a style="color:red;font-weight:30px;">$selection</a>]]></content>     <scope>text.html</scope> </snippet> 

Comments

Popular posts from this blog

how to insert data php javascript mysql with multiple array session 2 -

multithreading - Exception in Application constructor -

windows - CertCreateCertificateContext returns CRYPT_E_ASN1_BADTAG / 8009310b -