Hey,
iāve just finished my first Version of SublimeFileTemplates.
Basically it enables you to create Files with Snippet Content in one swoop.
Check out the GitHub Page or this Video to learn more:
Hey,
iāve just finished my first Version of SublimeFileTemplates.
Basically it enables you to create Files with Snippet Content in one swoop.
Check out the GitHub Page or this Video to learn more:
I saw this the other day.
I wondered why not just bind ctrl+n a show_quick_panel command that lists and executes new template commands.
When you select the
For example: new_templates.py
class NewHtmlCommand(sublime_plugin.WindowCommand):
def run(self):
v = self.window.new_file()
v.settings().set('default_extension', 'html')
v.set_syntax_file('Packages/HTML/HTML.tmLanguage')
template = """<!doctype html>
<html>
<head>
<title>$1</title>
</head>
<body>
$0
</body>
</html>"""
v.run_command("insert_snippet", {"contents": template})
class NewMarkdownCommand(sublime_plugin.WindowCommand):
def run(self):
v = self.window.new_file()
v.settings().set('default_extension', 'md')
v.set_syntax_file('Packages/Markdown/Markdown.tmLanguage')
template = """---
layout: $1
title: $2
---
#$2
$0
"""
v.run_command("insert_snippet", {"contents": template})
My Plugin does a few more things:
you can predefine the filename based on a specific need. For example, if you Controllers all have be named MyController.php you can define an argument to enter the controllerās name and then use this argument in the filename: ā$nameController.phpā and then you can use this argument inside the template as well.
Additionally you can specify a predefined path for files. In case of the example above you could pre-define the path to be āClasses/Controllers/ā. So this file will be easily created inside that Folder by default.
i guess you could do all that inside your own custom commands, but my package bundles this behavior neatly into a plugin so anyone can just create some file-templates inside their packages.
greetings marc
HI, Iāll try your plugin, but on my sublime text 2 rel. 2195 the plugin didnāt create file or directory, is possible that changes in the API breaks the program?
Hi,
The plugin creates the file, but puts nothing inside. The console shows the contents of my template with the variables still there. Not sure what I am doing wrong. I am using Build 2181. Also, I can not hear anything in the video. I am running on a Windows 7 system. Have not tried it under Linux yet.
Brilliant! Just what I was looking for, and am excited to try this out immediately! Thanks!
2 apocalip
Can you add option, to create several files from one template?
like arguments:
<files>
<file1>$name.php</file1>
<file2>$name.bro.php</file2>
</files>
<arguments>
<name>Name:</name>
</arguments>
It will be very useful.
Thanks.
Hey, iām trying to make a template for latex.
I guess iāve to make a Latex.file-template file in /Templates. But when i open the command palette and select Create New Template i really donāt understand what is the idea of that file that popās up. Could you help me?
Thanks
github.com/lawlist/ST2-plugin-Insert-File-Here
This is an insert file here plugin ST2 (OSX Mountain Lion), which is a modification of the plugin developed by the original poster.