## Sunday, November 4, 2012

### Using markdown format with TextMate

You want to execute "pandoc" when "⌘-R" is clicked, what would you do? There are some ideas you need to understand.
• Scope selection
• Activation
• Command
• Environment Variables

## Scope selection and Activation

Many of the keys are already assigned, so when you try to use the popular key such as "⌘-R", you need to select the scope. In other words, you need to teach TextMate that when you click "⌘-R" in markdown, it means something special.

## Command

In command editor, you can give any UNIX command you want. And many of the predefined environment variables are already given.

Combining the command and variable, you can come up wit the following commands.
/usr/local/bin/pandoc "$TM_FILEPATH" -o "$TM_FILEPATH".html
/usr/bin/open "$TM_FILEPATH".html echo File: "$TM_FILEPATH"