Sublime Text New File template plugin: Sublimetmpl

Source: Internet
Author: User
Tags sublime text



Wrote a sublime template plugin, project home: Https://github.com/kairyou/SublimeTmpl
This allows you to use the content of the template when creating a new file, and now adds the Html/js/css/php/python/ruby template. You don't need to create a new blank file, and then copy the content from another file.
Support for sublime Text3 has been increased.


Use:


1. St Menu, file-new file (Sublimetmpl), select the corresponding menu in the list, you can use the template to create new files directly.
2. Command, Cmd+shift+p, enter: "Tmpl:", you can find the menu list to create the file.
3. Shortcut keys, see below for default shortcuts. You can modify it yourself by seeing the "Settings" section.


Default shortcut keys:


  1. CTRL+ALT+h html
  2. CTRL+Alt+j JavaScript
  3. CTRL+Alt+c CSS
  4. CTRL+alt+p PHP
  5. CTRL+Alt+r Ruby
  6. CTRL+ALT + +shift+p python


Installation:


Method 1. Through the package Control
Package Control/install, search for "Sublimetmpl" or "Tmpl", install.
* [2012/08/01] has passed the package control audit



Method 2. Github
Open the Project home page, git clone to St's Packages folder (\data\packages), or download the zip file directly to the Packages folder (the folder name must be: Sublimetmpl).


Set up:


Menu: Preferences/packages settings/sublimetmpl, can Edit menu/shortcut/new syntax and so on.



If you would like to contribute your own package, you can refer to my introduction to this post:
http://www.fantxi.com/blog/archives/how-to-submit-a-sublime-package/


New features:


1. User-defined templates (Thanks @Xu Cheng)
Custom template path: "data\packages\user\sublimetmpl\templates" directory, will be used first (can refer to: the default template).
Default template path: "Data\packages\sublimetmpl\templates" directory.
using your own custom template : It is recommended to copy the default template directory's *.tmpl file to the custom templates path and then modify it.



2. Template supports ${date} variables
Settings-user inside can modify ${date} default output Format ("%y-%m-%d%h:%m:%s"), such as: "Date_format": "%y-%m-%d"



3. Templates support Custom attr
Added in Settings-user:


  1. "attr": {

  2. " Author": "Your name" ,

  3. " Email": "[email protected]",

  4. " link": "http://yours.com",

  5. "Hello": "word"

  6. }




You can use ${author} ${email} ${link} ${hello} variables in the template
Thanks @vfasky (Blog)





In addition, additional instructions on the new language


1. New language not in Sublimetmpl



First look at: Packages Settings/sublimetmpl/settings-default's default syntax setting.
If you want to add syntax, select: sublimetmpl/settings-user, Content format reference Settings-default content, such as two new language test and yours:


    1. {
    2. < Span class= "PLN" >        "test" : { "syntax" : },
    3.         "Yours" Span class= "pun" >: { "syntax" : "packages/yours/yours.tmlanguage" }


The above "Packages/test/test.tmlanguage" is the syntax path within the Packages directory, and the file must exist before it can be valid.



New Start Menu: You can add test and yours in Sublimetmpl/settings-menu with reference to other syntax.
New shortcut key: Can edit: Sublimetmpl/key Bindings User (format reference: Sublimetmpl/key Bindings Default)



2. New language for Sublime



I don't have a new one, I can go to the package control or GitHub to find someone else to add a new language, reference.
If you do not find someone else to write well, you can refer to the following Web site, do it yourself:
http://docs.sublimetext.info/en/latest/extensibility/syntaxdefs.html (official documentation, made with Aaapackagedev this plugin)
Http://manual.macromates.com/en/language_grammars (TextMate doc, and Sublime are mostly the same)
Https://github.com/LearnBoost/stylus/blob/master/editors/Stylus.tmbundle/Syntaxes/Stylus.tmLanguage (Someone else writes good grammar, Can be compared with their own new)






Turn from Kairyou's Blog http://www.fantxi.com/blog/archives/sublime-template-engine-sublimetmpl/



Sublime Text New File template plugin: Sublimetmpl


Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.