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 59K
  • Win 46K
  • OS X 10K
  • Linux 4K
Mar 23 Mar 22 Mar 21 Mar 20 Mar 19 Mar 18 Mar 17 Mar 16 Mar 15 Mar 14 Mar 13 Mar 12 Mar 11 Mar 10 Mar 9 Mar 8 Mar 7 Mar 6 Mar 5 Mar 4 Mar 3 Mar 2 Mar 1 Feb 28 Feb 27 Feb 26 Feb 25 Feb 24 Feb 23 Feb 22 Feb 21 Feb 20 Feb 19 Feb 18 Feb 17 Feb 16 Feb 15 Feb 14 Feb 13 Feb 12 Feb 11 Feb 10 Feb 9 Feb 8 Feb 7 Feb 6
Windows 85 99 95 93 71 62 105 108 121 132 136 72 76 87 103 104 97 103 57 50 84 105 84 86 91 51 62 114 86 90 85 101 46 63 76 91 136 71 71 38 42 70 51 72 70 52
OS X 21 15 17 15 17 17 25 13 20 22 17 8 10 21 18 20 14 23 12 9 27 27 18 15 17 12 15 16 16 22 13 18 10 9 21 19 16 12 16 18 7 12 9 19 22 17
Linux 8 5 7 10 8 3 11 4 8 2 13 2 5 3 2 9 7 9 2 5 10 5 11 8 7 10 8 8 8 5 4 7 4 7 8 11 11 9 3 6 7 5 4 3 5 6

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.

Authors

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: 中文文档