[TxMt] snippet that replaces the current word

Timothy Bates timothy.c.bates at gmail.com
Mon Sep 22 22:34:34 UTC 2008


Dear regexeperts,

I'm trying to write a snippet for wikimedia for applying bold  
(wrapping a string in **str**)

I've attached cmd-B to the snippet, and I'd like it to bold the  
CURRENT_WORD if there is no selection.
Sounds like a job for:

     **${TM_SELECTED_TEXT:$TM_CURRENT_WORD}**

Works fine for the selected text, but not for the current word, where  
it returns things like this:

     he|re   -->cmd-B-->      he**here**re

Any pointers, or do I need to be made into a command? (in that case,  
what use does  $TM_CURRENT_WORD have in snippets?


cheerio,
tim



More information about the textmate mailing list