Monday, June 23, 2008

TextMate:Create Snippet

  1. -plain text: just insert text
  2. -variables: $TM_SELECTED_TEXT
  3. -variables with default: ${TM_SELECTED_TEXT:default text}
  4. -variables with regexp: ${TM_SELECTED_TEXT/regexp/format/options}
  5.   ex. ${TM_SELECTED_TEXT/w+/<$0>/g}
  6. -Shell Code Insertion: ex. <a href="`pbpaste`">$TM_SELECTED_TEXT</a>
  7. -Tab Stops: $0 or $1..$n
  8. -Tab Stops with Default(Placeholders): ${1:default}
  9. -Mirrors: ex. <${1:div}>  $0  </$1>
  10. -Transformations: ${1/regexp/format/options}
  11. -Transformations with condition: ${1/x$|(.+)/(?1:other)/}
  12. -Cascading placeholders: ${1:default${2:default}}

No comments: