A shellscripts-based snippet/template program
Version: 0.0.1 Author: Cong Hai Nguyen License: Please find the attached LICENSE file
Purpose: "Editor-independent, inheritable, and nestable snippets"
Features:
- Command-line based interface:
-> independnet of any editor - Snippet inheritance:
A snippet of one filetype inherits snippets of its parent's filetype. If it has the snippet of the same name then the child snippet overrides the parent one. - Text transformation of one snippet into another:
This program allow user just write one snippet and define a transformation command to adapt it on-the-fly into the snippet (usually from parent snippet into its child snippet) (for example from sh snippet into gnu makefile shell codes. Please see Usage for examples) - Snippet nesting:
In this system, snippets/templates are shellscripts -> they can call other snippets/templates. Hence snippet nesting.
shpec tst/sn_shpec.sh
sn --debug if.sh
sn if.sh
sn header.sh
sn if.makefile
sn new.sh
file name for a snippet variable: v. (or v if it is of the base filetype)
- sh shell
- for testing this program: lehmannro's assert.sh https://github.com/lehmannro/assert.sh version 1.1 (LGPLv3 license)
- ~/.sn/
base directory - ~/.sn/_parent
file holding information about the parent filetype. 2 lines: line 1: the parent filetype, line 2: the transformation command - ~/.sn/sn.sh: the main executable for generating the required snippet/template. User can run any snippet file directly without running this executable, but it won't be able to do inheriting and tranforming the snippet of the parent's file type.
- ~/.sn/_base: directory holding base snippet scripts (the last dir to search for snippet if the snippet is not found in the higher-level directory)
- ~/.sn/tests/:
script for testing - ~/.sn/sh/, ~/.sn/markdown/, ...: directory holding snippet scripts for printing out snippet string in specific mode such as sh-mode, markdown-mode, etc
Then the snippet file has to exist before user could call it -> rewriting similar snippets for different file types