ctrl+shift+p filters: :st2 :st3 :win :osx :linux
Browse

Sublime​Tmpl

by kairyou ST2/ST3

Create File From Templates for ST2/ST3.

Labels file creation

Details

Installs

  • Total 76K
  • Win 59K
  • OS X 12K
  • Linux 5K
Sep 26 Sep 25 Sep 24 Sep 23 Sep 22 Sep 21 Sep 20 Sep 19 Sep 18 Sep 17 Sep 16 Sep 15 Sep 14 Sep 13 Sep 12 Sep 11 Sep 10 Sep 9 Sep 8 Sep 7 Sep 6 Sep 5 Sep 4 Sep 3 Sep 2 Sep 1 Aug 31 Aug 30 Aug 29 Aug 28 Aug 27 Aug 26 Aug 25 Aug 24 Aug 23 Aug 22 Aug 21 Aug 20 Aug 19 Aug 18 Aug 17 Aug 16 Aug 15 Aug 14 Aug 13 Aug 12
Windows 7 119 68 84 108 127 119 135 164 88 95 164 175 138 123 57 53 58 96 115 125 108 100 54 55 103 112 96 62 107 54 55 88 115 101 126 108 34 71 106 76 151 121 94 66 80
OS X 0 23 12 18 23 24 18 23 17 13 21 30 28 15 20 8 10 11 20 23 18 18 23 6 11 22 18 19 9 19 5 14 18 27 12 19 19 5 10 20 7 10 19 15 13 7
Linux 1 13 6 10 5 8 10 7 12 6 5 20 14 7 6 6 9 7 9 6 5 4 13 7 11 5 10 6 7 7 8 9 12 12 5 13 10 3 8 7 2 9 7 7 3 7

Readme

Source
raw.​githubusercontent.​com

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

  • Creat file with menu File - New File (SublimeTmpl)

  • Creat file with command use cmd+shift+p then look for tmpl:

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/

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

  • custom template files

    put your custom template files in Packages/User/SublimeTmpl/templates

  • *.tmpl file support ${date} variable

    default “date_format” : “%Y-%m-%d %H:%M:%S” .

  • *.tmpl file support ${saved_filename}, ${saved_filepath} on save file

    Enable: SublimeTmpl > settings - user add "enable_file_variables_on_save": true,

  • *.tmpl file support ${project_base_name}, ${project_path} and ${platform}

    NOTE: This will only work with SublimeText 3.0 or above.

    Enable: SublimeTmpl > settings - user add "enable_project_variables": true,

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

  • custom variables: attr

    custom the attr variables in settings, example:

"attr": {
        "author": "Your Name" ,
        "email": "you@example.org",
        "link": "http://example.org",
        "hello": "word"
    }
> The `*.tmpl` file will support `${author}` `${email}` `${link}` `${hello}` variables.

*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

  • SublimeTmpl not work after update the package.

    Please open Preferences / Settings - User, remove “SublimeTmpl” from ignored_packages.


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

Docs: 中文文档