asfaltboy / sublime-custom-code

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Custom Command

This is a fun excersize to show how to allow users to run arbitrary python code in sublime text, substituting variable text by prompting the user for each "context variable" (i.e a simple template system).

Usage:

  • Drop the custom_code.py python module into your Sublime user dir
  • define a custom command in your Packages/User/User.sublime-commands:
[
  {
    "caption": "custom: set git commit date",
    "command": "custom_code",
    "args": {
      "code": "import os\nos.environ.update(dict(GIT_COMMITTER_DATE='{{DATE}}', GIT_AUTHOR_DATE='{{DATE}}'))",
    }
  }
]

About


Languages

Language:Python 100.0%