FileHeader
A powerful file templating plugin for Sublime Text
Details
Installs
- Total 49K
- Win 32K
- Mac 10K
- Linux 7K
Dec 21 | Dec 20 | Dec 19 | Dec 18 | Dec 17 | Dec 16 | Dec 15 | Dec 14 | Dec 13 | Dec 12 | Dec 11 | Dec 10 | Dec 9 | Dec 8 | Dec 7 | Dec 6 | Dec 5 | Dec 4 | Dec 3 | Dec 2 | Dec 1 | Nov 30 | Nov 29 | Nov 28 | Nov 27 | Nov 26 | Nov 25 | Nov 24 | Nov 23 | Nov 22 | Nov 21 | Nov 20 | Nov 19 | Nov 18 | Nov 17 | Nov 16 | Nov 15 | Nov 14 | Nov 13 | Nov 12 | Nov 11 | Nov 10 | Nov 9 | Nov 8 | Nov 7 | Nov 6 | |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Windows | 1 | 2 | 0 | 2 | 1 | 1 | 1 | 0 | 0 | 3 | 1 | 0 | 2 | 0 | 0 | 0 | 2 | 9 | 0 | 0 | 0 | 1 | 1 | 2 | 0 | 0 | 0 | 1 | 0 | 1 | 3 | 0 | 0 | 3 | 0 | 1 | 0 | 0 | 0 | 2 | 0 | 2 | 0 | 1 | 0 | 1 |
Mac | 0 | 1 | 1 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 3 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 1 | 2 | 0 | 0 | 1 |
Linux | 0 | 0 | 0 | 1 | 4 | 2 | 0 | 0 | 1 | 1 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 |
Readme
- Source
- raw.githubusercontent.com
FileHeader
FileHeader is a powerful file templating plugin for SublimeText 2 and SublimeText 3. It makes it easier to create new file with initial contents. It also can add new header to an existed file or directory.
Features
- Add new file with initial contents.
- Auto detect New File action from SulimeText or other plugin.
- Add header to an existed file or directory.
- Batch add header to files in the specified directory.
- Auto update file last modified time and last modified by.
- Auto detect file type.
- Powerful template with Jinja2.
- Custom templates supported.
- Rich languages supported.
- Support both Sublime Text 2 and Sublime Text 3.
Installation
Package Control
Install Package Control. Then Package Control: Install Package, look for FileHeader and install it.
Source Installation
Go to the "Packages" directory (Preferences / Browse Packages). Then clone this repository:
git clone git@github.com:shiyanhui/FileHeader.git
Or download zip from Github, and put it in "Packages" directory (Preferences / Browse Packages).
Usage
Create a new file
Sidebar Menu
Shortcuts
The default shortcuts is super+alt+n on OS X, ctrl+alt+n on Windows and Linux.
Context Menu
Similar to Sidebar Menu.
Add header to an existed file
Sidebar Menu
Shortcuts
The default shortcuts is super+alt+a on OS X, ctrl+alt+a on Windows and Linux.
Context Menu
Similar to Sidebar Menu.
Add header to files in the specified directory
Sidebar Menu
A very important feature of FileHeader is that it can automatically update last_modified_time and last_modified_by (see options below). Just look this picture, take care of the @Last modified time: before save and after save:
Settings
There are two kinds of arguments: options and kinds of languages variables settings. options is the functional setting, Default is the default language variables settings. Language variables setting will cover that in Default.
Open Preferences => Package Settings => File Header => Settings - Default for more details.
Template
FileHeader use Jinja2 template, find out how to use it here.
The template is made up of header and body. You also can write you own templates. Take the Python template header Python.tmpl for example.
{{ }} is variable, you can set it in setting files. create_time will be set when you create a new file using FileHeader, last_modified_time and last_modified_by will be update every time you save your file.
You can define your functions and classes or other contents in your body file. Also take Python template body for example.
class MyClass(object): pass if __name__ == '__main__': pass
FAQ
How to customize my headers?
Set custom_template_header_path to your path of customized header in user-settings, for example, ~/header/
NOTE: DO NOT modify directly that in Packages/FileHeader
What if FileHeader conflicts with other file template plugin?
For example, FileHeader and Javatar conflicts in files with extension .java.
The solution is, open any file with extension .java in sublime text, and open Preferences ==> Settings - More ==> Syntax Specific - User, then add "enable_add_template_to_empty_file": false.
What if key-map of FileHeader conflicts with others?
Just change that of FileHeader or others.
Other Editors
If you have any questions, please let me know. 🙂