Sublime Forum

TemplateNinja [Alpha]

#1

Hey guys, I’m new here and I’ve been only using ST2 for 2 days, but I wanted to share my first plugin with you. It’s probablly still full of bugs that I’m gonna be sorting through, and it’s still missing a couple of features that I want to implement, but I’m already using it myself.

TemplateNinja is a combination of both a “quick new file” style plugin (with directory selection in the quick panel, enabling quick fuzzy searching of those nasty long namespace paths) and “snippets”, although it requires it’s own files (mostly for additional metadata) but these template files are basically snippets, so it has all the goodies of being a snippet.

If you already have several snippets that you use to populate empty files, converting these to templates is pretty easy (info on github).

The main reason that motivated me to do this was that PHP files when created have a default scope of text.html, it’s not until that you type both the open and close tags <?php ?> that you can actually use a php snippet to create an empty class (I’m now using several templates for working with Symfony2), so I wanted to make something that created a new file and added a template, and well, then I started adding more features like the directory browser, exclusion dirs and the ones I’m still working on (project based tags for filtering templates is one).

Here’s the github repo:
github.com/xamado/sublime-templateninja

Any feedback, bug reports, and suggestions are more than welcome, and also your own templates if you want to bother sending them my way :smile:

Thanks for your time!

0 Likes

#2

Any ideas on fixing that:

Reloading plugin C:\Users\Pawel\AppData\Roaming\Sublime Text 2\Packages\templateninja\TemplateNinja.py
__main__:27: DeprecationWarning: The xmllib module is obsolete.  Use xml.sax instead.
found 14 files for base name Default.sublime-keymap
i: 0, text: <?php
i: 1, text: /*=============
Traceback (most recent call last):
  File ".\sublime_plugin.py", line 339, in run_
  File ".\TemplateNinja.py", line 22, in run
  File ".\TemplateNinja.py", line 39, in show_directory_selection
  File ".\os.py", line 276, in walk
TypeError: coercing to Unicode: need string or buffer, NoneType found
0 Likes

#3

Hey there,

Do you have a project created? Or are you using just opened files or opened folders?

There’s some things about folders that I still need to figure out how they work in ST2.

0 Likes