Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Inserts named snippets from various other files into a file
Python VimL C++
tree: d05377d28a

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.
plugin/SnippetySnip
python/SnippetySnip
README

README

This is a mirror of http://www.vim.org/scripts/script.php?script_id=3717

SnippetySnip is a vim tool for automatically inserting parts (snippets) of other files in a file. I wrote it to insert sourcecode examples from source files into html blog-posts, but it can be used for all sorts of text files.

In the source file, you mark up a region of text (a snippet) and give it a name. In the target file, you mark where you want this particular snippet inserted.

For instance:

source.py:
    (...)
    #snippetysnip_begin:foo
    def foo():
        return 0
    #snippetysnip_end
    (...)

target.html:
    <p><code>
    <!-- snippetysnip:/path/to/source.py:foo -->
    </code></p>

When SnippetySnip is run, the function foo() from source.py is inserted into the html file, which then looks like this:

target.html:
    <p><code>
    <!-- snippetysnip:/path/to/source.py:foo -->
    def foo():
        return 0
    <!-- snippetysnip_end:/path/to/source.py:foo -->
    </code></p>


SnippetySnip does not care about the format of the comments in your particular language, it only looks for the snippetysnip-strings.

You can have many snippets in a source file, and a target file can reference multiple snippets from multiple sources.

Paths can be relative or absolute.

Something went wrong with that request. Please try again.