Home Download Buy Blog Forum Support

Formatting and replacing line with Snippet

Formatting and replacing line with Snippet

Postby iota on Mon Mar 11, 2013 5:10 pm

I have the following snippet:

Code: Select all
    <content><![CDATA[console.log( ${TM_CURRENT_LINE/;$/$1/m}$0);]]></content>

Which will wrap a line/selection with console.log(); replacing any ';' characters in the line. This is what I want if I select the line, but If I run the snippet (via a key binding) on a line without selecting text, it will duplicate the text.


Code: Select all
// If I trigger the keybinding while the cursor is at the beginning of the following line, with no text selected:
// becomes...
console.log( exampleFunction()); exampleFunction();

I'd prefer it replace the whole line. Is this possible?
Posts: 8
Joined: Fri Nov 18, 2011 5:43 pm

Return to General Discussion

Who is online

Users browsing this forum: Yahoo [Bot] and 11 guests