kairyou / SublimeTmpl

Create File From Templates for SublimeText 2 / SublimeText 3
https://xhl.me
MIT License
226 stars 68 forks source link
snippets sublime sublime-package sublimetmpl templates

SublimeTmpl

A Sublime Text 2/3 plugin for create file from templates.

Installation

Github

Go to the "Packages" directory (Preferences / Browse Packages). Then clone this repository:

$ git clone https://github.com/kairyou/SublimeTmpl.git

Package Control

Install Package Control. Then Package Control: Install Package, look for SublimeTmpl / tmpl and install it.

Usage

Settings

Default Settings: Preferences > Packages Settings > SublimeTmpl > Settings - Default

Custom settings (*Recommend): Preferences > Package Settings > SublimeTmpl > Settings - User

Default template files: Packages/SublimeTmpl/templates

Custom template files (Recommend): Packages/User/SublimeTmpl/templates/

Project-specific template files (ST3 only): via settings: SublimeTmpl: template_folder key within your sublime-project file (see "Features added" below)

Default key bindings

ctrl+alt+h html
ctrl+alt+j javascript
ctrl+alt+c css
ctrl+alt+p php
ctrl+alt+r ruby
ctrl+alt+shift+p python

Disable shortcuts

If you’re unhappy with default keymap, you can disable keyboard shortcuts with disable_keymap_actions preference of SublimeTmpl.sublime-settings.

Use a comma-separated list of action names which default keyboard shortcuts should be disabled. For example, if you want to disable creat html and css shortcuts, your must set the following value:

"disabled_keymap_actions": "html, css"

To disable all default shortcuts, set value to all.

Features added

It is recommended that you put your own custom settings in settings - user. Please see note below in "*Detailed Instructions for Sublime Newbies"

*Detailed Instructions for Sublime Newbies

Sublime Text keeps settings in bunch of files in a folder. For example, OS X, it is located at

/Users/yourusername/Library/Application Support/Sublime Text 3/Packages

You can navigate to it easily by using the following menu item in Sublime, for example: Sublime Text>Preferences>Browse Packages

Now go to Packages\SublimeTmpl folder and open the file SublimeTmpl.sublime-settings. Save the file with the same file name under Packages\User. Delete everything except the variables that are custom to you. By the time you are finished, the file might look as simple as this (JSON format):

{
    "attr": {
        "author": "Chuck Norris" ,
        "email": "chuck@kickbutt.com",
    }
}

If you don't want the "link" and "hello" variables to show up, you should copy the (for example) python.tmpl file to Packages/User/SublimeTmpl/templates and remove those elements from it.

Contributors

Donate

PayPal donate button

FAQ


Source: https://github.com/kairyou/SublimeTmpl

Docs: 中文文档