Take the 2-minute tour ×
Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. It's 100% free, no registration required.

The title should be rather explicit. When a file is created, I'd like to have a text automatically pasted at the top of it. The plugin would also be able to insert the text on existing files.

Of course, I'm thinking about a custom licence text. I saw this, but it requires a command in order to insert the text.

Does such a plugin exist for Sublime Text ?

share|improve this question

put on hold as off-topic by MichaelT, mattnz, Dan Pichelman, Wayne M, Bart van Ingen Schenau 5 hours ago

This question appears to be off-topic. The users who voted to close gave this specific reason:

  • "Questions asking us to recommend a tool, library or favorite off-site resource are off-topic for Programmers as they tend to attract opinionated answers and spam. Instead, describe the problem and what has been done so far to solve it." – MichaelT, mattnz, Dan Pichelman, Wayne M, Bart van Ingen Schenau
If this question can be reworded to fit the rules in the help center, please edit the question.

add comment

2 Answers

Just write a snippet on your own: http://docs.sublimetext.info/en/latest/extensibility/snippets.html

Or you could write a new plugin:

LicenseCommand.py

import sublime, sublime_plugin

class LicenseCommand(sublime_plugin.EventListener):
    def on_new(self, view):
    view.run_command("license_insert")

LicenseInsertCommand.py

import sublime, sublime_plugin

class LicenseInsertCommand(sublime_plugin.TextCommand):
    def run(self, edit):
        self.view.insert(edit, 0, "License Text!")

I'm sure you could optimize it....

share|improve this answer
add comment

You could write your own plugin as above, and fire a call to the plugin on creation of a file, i.e. Class sublime_plugin.EventListener on_new(view)

http://www.sublimetext.com/docs/2/api_reference.html

hope that helps

share|improve this answer
add comment

Not the answer you're looking for? Browse other questions tagged or ask your own question.