Last active
April 21, 2016 05:42
-
-
Save mateor/c033d3d89b614513e4082f11cd2a9109 to your computer and use it in GitHub Desktop.
Settings that I use with FileHeader Sublime plugin to create headers for new python files.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
/* | |
options | |
======= | |
*/ | |
/* | |
The datetime format. | |
0: "%Y-%m-%d %H:%M:%S" | |
1: "%Y-%m-%d" | |
2: "%H:%M:%S" | |
*/ | |
"time_format": 0, | |
/* | |
The custom time format. It will format `create_time` and `last_modified_time` | |
instead of `time_format` if you set it. The time format refers to` | |
https://docs.python.org/2/library/datetime.html#strftime-and-strptime-behavior`. | |
*/ | |
"custom_time_format": "%Y", | |
/* | |
Whether add template to the empty file. | |
It's useful when you create new file through other command, for | |
example, the default Sublime Text's **New File...** or other plugin. | |
*/ | |
"enable_add_template_to_empty_file": true, | |
/* | |
Set your custom template header path here, it is a directory in which | |
you write your own header files. The file name should be a language, | |
"Python.tmpl" for example. | |
*/ | |
"custom_template_header_path": "~/Documents/Documents/sublime/headers", | |
/* | |
Set your custom template body path here, it is a directory in which | |
you write your own body files. The file name should be a language, | |
"Python.tmpl" for example. | |
The template structure is: | |
I am a file | |
----------- | |
header | |
body | |
*/ | |
"custom_template_body_path": "", | |
/* | |
Whether show input panel when you add header. The default file which | |
you add header to is the current file you edit. | |
*/ | |
"show_input_panel_when_add_header": true, | |
/* | |
Whether open file when you add header to files in the specified | |
directory. | |
*/ | |
"open_file_when_add_header_to_directory": true, | |
/* | |
Whether enable add header to hidden directory. If false, FileHeader | |
won't add header to files under it. | |
*/ | |
"enable_add_header_to_hidden_dir": false, | |
/* | |
Whether enable add header to hidden file. If false, FileHeader | |
won't add header to it. | |
*/ | |
"enable_add_header_to_hidden_file": true, | |
/* | |
FileHeader judges programming language according file suffix. | |
Default programming language if FileHeader judges failed when you | |
create new file. | |
*/ | |
"syntax_when_not_match": "Text", | |
/* | |
FileHeader will judge programming language according to file suffix. | |
You can add more file suffix here. Note: language should be one of | |
that under **Default**. If FileHeader don't find the suffix, | |
FileHeader will set language as **syntax_when_not_match** above. | |
*/ | |
"file_suffix_mapping": { | |
"as": "ActionScript", | |
"scpt": "AppleScript", | |
"asp": "ASP", | |
"aspx": "ASP", | |
"bat": "Batch File", | |
"cmd": "Batch File", | |
"c": "C", | |
"cs": "C#", | |
"cpp": "C++", | |
"clj": "Clojure", | |
"css": "CSS", | |
"D": "D", | |
"erl": "Erlang", | |
"go": "Go", | |
"groovy": "Groovy", | |
"hs": "Haskell", | |
"htm": "HTML", | |
"html": "HTML", | |
"java": "Java", | |
"js": "JavaScript", | |
"tex": "LaTeX", | |
"lsp": "Lisp", | |
"lua": "Lua", | |
"md": "Markdown", | |
"mat": "Matlab", | |
"m": "Objective-C", | |
"ml": "OCaml", | |
"p": "Pascal", | |
"pl": "Perl", | |
"php": "PHP", | |
"py": "Python", | |
"R": "R", | |
"rst": "RestructuredText", | |
"rb": "Ruby", | |
"scala": "Scala", | |
"scss": "SCSS", | |
"sh": "ShellScript", | |
"sql": "SQL", | |
"tcl": "TCL", | |
"txt": "Text", | |
"xml": "XML" | |
}, | |
/* | |
Set special file suffix equivalence. Take `blade.php` for example, | |
FileHeader will initial file with suffix `blade.php` with that of `html`. | |
*/ | |
"extension_equivalence": { | |
"blade.php": "html", | |
"__init__.py": "NONE" | |
}, | |
/* | |
Variables | |
========= | |
*/ | |
/* | |
Below is the variables you render templater. | |
*/ | |
"Default": { | |
/* | |
Builtin Variables | |
================= | |
- create_time | |
The file created time. It will be automatically set when you create | |
a new file if you use it. | |
Can't be set custom. | |
- author | |
The file creator. | |
FileHeader will set it automatically. If it's in | |
a git repository and the `user.name` has been set, `autor` | |
will set to `user.name`, otherwise it will be set to current | |
system user. | |
Can be set custom. | |
- last_modified_by | |
The file last modified by who? It is specially useful when | |
cooperation programming. | |
FileHeader will set it automatically. If it's in | |
a git repository and the `user.name` has been set, `autor` | |
will set to `user.name`, otherwise it will be set to current | |
system logined user. | |
Can be set custom. | |
- last_modified_time | |
The file last modified time. | |
FileHeader will set it automatically when you save the file. | |
Can't be set custom. | |
- file_path | |
The absolute path of the current file. | |
FileHeader will update it automatically when you change it. | |
Can't be set custom. | |
- file_name | |
The name of current file with extension. | |
FileHeader will update it automatically when you change it. | |
Can't be set custom. | |
- file_name_without_extension | |
The name of current file without extension. | |
FileHeader will update it automatically when you change it. | |
Can't be set custom. | |
- project_name | |
The project name. | |
Note: `project_name` only works in ST3. | |
Can't be set custom. | |
*/ | |
/* | |
*/ | |
"email": "[email protected]", | |
// You can add more here...... | |
"author": "mateor" | |
}, | |
/* | |
You can set different variables in different languages. It will cover | |
that in "Default". | |
*/ | |
"ASP": {}, | |
"ActionScript": {}, | |
"AppleScript": {}, | |
"Batch File": {}, | |
"C#": {}, | |
"C++": {}, | |
"CSS": {}, | |
"Clojure": {}, | |
"D": {}, | |
"Diff": {}, | |
"Erlang": {}, | |
"Go": {}, | |
"Graphviz": {}, | |
"Groovy": {}, | |
"HTML": {}, | |
"Haskell": {}, | |
"Java": {}, | |
"JavaScript": {}, | |
"LaTeX": {}, | |
"Lisp": {}, | |
"Lua": {}, | |
"Makefile": {}, | |
"Markdown": {}, | |
"Matlab": {}, | |
"OCaml": {}, | |
"Objective-C": {}, | |
"PHP": {}, | |
"Pascal": {}, | |
"Perl": {}, | |
"Python": {}, | |
"R": {}, | |
"RestructuredText": {}, | |
"Ruby": {}, | |
"SQL": {}, | |
"Scala": {}, | |
"ShellScript": {}, | |
"TCL": {}, | |
"Text": {}, | |
"Textile": {}, | |
"XML": {}, | |
"YAML": {} | |
} |
It treats the __init__.py
as a special file - in order to allow all new empty files to get the header but skip the __init__
files, which are best left empty.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I posted the Python template I use alongside this file when I am creating MIT licensed python code: https://gist.github.com/mateor/9f9e075819d5572b7b2770ac4c1209bb
A new file looks like: