Initial commit

This commit is contained in:
Joel Goguen 2021-02-19 19:45:42 -08:00
commit 51435306c2
No known key found for this signature in database
GPG Key ID: B689DDE463B6CB27
19 changed files with 620 additions and 0 deletions

1
.gitignore vendored Normal file
View File

@ -0,0 +1 @@
tags

21
LICENSE Normal file
View File

@ -0,0 +1,21 @@
The MIT License
Copyright (C) 2021 by Joel Goguen
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.

111
README.md Normal file
View File

@ -0,0 +1,111 @@
# tmpl.vim
`tmpl.vim` provides autoloading new file templates for vim and Neovim. Templates
are kept in any `templates` directory on the `runtimepath`, allowing you to
easily add your own templates separately from this plugin. By setting
`g:tmplvim_default_environment`, different templates for the same file type may
be loaded in different environments (e.g. work versus personal).
Template names are constructed as `environment.type`. The environment may be set
using `g:tmplvim_default_environment`, which defaults to `default`. For file
names with an extension the file extension is taken as the template type, or for
files with no extension the lower-case name of the file is used as the template
type.
## Installation
It is recommended to use a plugin manager to install `tmpl.vim`.
### With [vim-plug](https://github.com/junegunn/vim-plug)
```vim
Plug 'jgoguen/tmpl.vim'
```
### With [dein.vim](https://github.com/Shougo/dein.vim)
```vim
call dein#add('jgoguen/tmpl.vim')
```
### With [minpac](https://github.com/k-takata/minpac)
```vim
call minpac#add('jgoguen/tmpl.vim')
```
### With vim 8 plugins
Clone the repository to `pack/plugins/start`:
For vim 8:
```sh
mkdir -p ~/.vim/pack/plugins/start
git clone https://github.com/jgoguen/tmpl.vim ~/.vim/pack/plugins/start/tmpl.vim
```
For Neovim:
```sh
mkdir -p "${XDG_DATA_HOME:-${HOME}/.local/share}/nvim/site/pack/plugins/start"
git clone https://github.com/jgoguen/tmpl.vim "${XDG_DATA_HOME:-${HOME}/.local/share}/nvim/site/pack/plugins/start"
```
## Configuration
To set the template environment, set `g:tmplvim_default_environment`. To
override the template environment on a per-buffer basis, set
`b:tmplvim_default_environment` for the specific buffers. If this is not given,
the default value is `default`.
To set the replacement value for the `<# AUTHOR #>` tag, set `g:tmplvim_author`.
If this is not given, the default value is the `${USER}` environment variable.
To set the replacement value for arbitrary template tags, use the dictionary
`g:tmplvim_template_vars`. Set the tag name as the dictionary key and the value
as the tag replacement value.
## Template tags
Templates may contain tags which will be automatically expanded when the
template is loaded into the buffer. There are two types of tags:
1. Template variables
2. Template includes
Template includes are processed first, then variables once includes have been
inserted into the buffer. Nested includes are not currently supported.
### Template variables
Template variable tags are upper-case letters surrounded by `<#` and `#>`. The
value of a template variable comes from `g:tmplvim_template_vars`, except for
some specific reserved tag names:
1. `DATE`: Always replaced with the value of `strftime('%Y-%m-%d')` (e.g.
`2020-03-04`)
2. `YEAR`: Always replaced with the value of `strftime('%Y')` (e.g. `2020`)
3. `TIME`: Always replaced with the value of `strftime('%H:%M:%S')` (e.g.
`13:03:34`)
4. `AUTHOR`: Always replaced with the value of `g:tmplvim_author`, or the value
of `$USER` if that is not set.
5. `DIRNAME`: Always replaced with the name of the directory the file is in.
6. `BASENAME`: Always replaced with the name of the file without extensions.
7. `UPPERBASENAME`: Always replaced with the name of the file without extensions
in upper-case.
### Template includes
Template include tags are letters, numbers, or periods surrounded by `<$` and
`$>`. The tag name is expected to be the name of another template, which may
include template variables but may not include other template includes. For
example, the include tag `<$ LICENSE.MIT $>` will be replaced with the contents
of the template file named `LICENSE.MIT`.
To accommodate including files in source code templates, an include with the
same extension as the current buffer will be searched for and preferred if
found. For example, the include tag `<$ LICENSE.MIT $>` in `setup.py` would use
the template named `LICENSE.MIT.py` if it exists, or `LICENSE.MIT` if not.
## Usage
When a new file is opened, the corresponding template is automatically loaded.

152
autoload/tmpl.vim Normal file
View File

@ -0,0 +1,152 @@
" vim: set syntax=vim filetype=vim noexpandtab ts=2 sts=2 sw=2 autoindent:
" vim: set foldmarker=[[[,]]] foldmethod=marker foldlevel=0:
let s:tmplVarTag = '<# *\([A-Z]\+\) *#>'
let s:tmplIncludeTag = '<\$ *\([A-Za-z0-9\.]\+\) *\$>'
let s:specialChars = '^[]\:*$'
function! tmpl#LoadTemplateFile(...) abort
let template_environment = ''
let template_format = ''
if a:0 >= 2
" Both format and environment are given
let template_format = a:1
let template_environment = a:2
elseif a:0 == 1
" Got format but not environment
let template_format = a:1
endif
if template_environment ==? ''
let template_environment = get(b:, 'tmplvim_default_environment', get(g:, 'tmplvim_default_environment', 'default'))
endif
if template_format ==? ''
" Either a file extension or a file basename is needed to create the
" template path.
" - script.sh -> default.sh
" - Makefile -> default.makefile
" - project.py -> default.py
let file_extension = tolower(expand('%:e'))
if len(file_extension) == 0
let file_name = tolower(expand('%:t'))
if len(file_name) == 0
throw 'Cannot load template, need file extension or name'
else
let template_format = file_name
endif
else
let template_format = file_extension
endif
endif
let template_name = printf('%s.%s', template_environment, template_format)
let templates = <SID>templates_for_glob(template_name)
if empty(templates)
return 0
endif
execute printf('silent! 0r%s', templates[0])
call <SID>expand_include_vars()
call <SID>expand_tmpl_vars()
set nomodified
endfunction
function! tmpl#TemplateCommandCompletion(arglead, cmdline, cursorpos) abort
" Why use a dictionary? So we don't repeat values! Given there can be multiple
" environments it's likely there will be repeat types, and since there's
" multiple environments, well, there's repeat environments.
let resultset = {}
let templates = <SID>templates_for_glob('*')
let num_args = len(split(a:cmdline, ' '))
for tmpl_file in templates
if num_args == 1
" Format first
let resultset[fnamemodify(tmpl_file, ':e')] = 1
elseif num_args == 2
" Environment second
let resultset[fnamemodify(tmpl_file, ':t:r')] = 1
endif
endfor
return keys(resultset)
endfunction
function! s:templates_for_glob(glob) abort
let templates = filter(split(globpath(&runtimepath, printf('templates/%s', a:glob)), "\n"), 'filereadable(v:val)')
if empty(templates)
return []
endif
return templates
endfunction
function! s:expand_tmpl_vars() abort
let old_winstate = winsaveview()
let old_query = getreg('/')
let [matchline, matchcol] = searchpos(s:tmplVarTag)
let template_vars = get(g:, 'tmplvim_template_vars', {'KEY': 'MYKEY'})
while matchline != 0
let matches = matchlist(getline(matchline), printf('^%s', s:tmplVarTag), matchcol-1)
if len(matches) > 0
let key = matches[1]
let value = ''
if key ==# 'DATE'
let value = strftime('%Y-%m-%d')
elseif key ==# 'YEAR'
let value = strftime('%Y')
elseif key ==# 'TIME'
let value = strftime('%H:%M:%S')
elseif key ==# 'AUTHOR'
let value = get(g:, 'tmplvim_author', expand($USER))
elseif key ==# 'DIRNAME'
let value = expand('%:p:h:t')
elseif key ==# 'BASENAME'
let value = expand('%:t:r')
elseif key ==# 'UPPERBASENAME'
let value = toupper(expand('%:t:r'))
elseif index(keys(template_vars), key) != -1
let value = template_vars[matches[1]]
endif
execute printf('silent %ds/^.\{%d\}\zs%s/%s/g', matchline, (matchcol-1), escape(matches[0], s:specialChars), expand(value, s:specialChars))
endif
let [matchline, matchcol] = searchpos(s:tmplVarTag)
endwhile
call setreg('/', old_query)
call winrestview(old_winstate)
endfunction
function! s:expand_include_vars()
let old_winstate = winsaveview()
let old_query = getreg('/')
let format = expand('%:e')
let [matchline, matchcol] = searchpos(s:tmplIncludeTag)
while matchline != 0
let matches = matchlist(getline(matchline), printf('^%s', s:tmplIncludeTag), matchcol-1)
if len(matches) > 0
let templates = <SID>templates_for_glob(matches[1])
if !empty(templates)
let tmpl_file = templates[0]
if filereadable(printf('%s.%s', tmpl_file, format))
let tmpl_file = printf('%s.%s', tmpl_file, format)
endif
execute printf('silent! %ds/^.\{%d\}\zs%s//', matchline, (matchcol-1), escape(matches[0], s:specialChars))
execute printf('silent! %dr%s', matchline-1, tmpl_file)
endif
endif
let [matchline, matchcol] = searchpos(s:tmplIncludeTag)
endwhile
call setreg('/', old_query)
call winrestview(old_winstate)
endfunction

131
doc/tmpl.vim.txt Normal file
View File

@ -0,0 +1,131 @@
*tmpl.vim*
tmpl.vim - vim file templates
=================================================================================
CONTENTS *tmpl.vim-contents*
1. Introduction................................|tmpl.vim-introduction|
1.1. Examples................................|tmpl.vim-examples|
2. Global Options..............................|tmpl.vim-options|
3. Commands....................................|tmpl.vim-commands|
4. Template Tags...............................|tmpl.vim-tags|
4.1. Variables...............................|tmpl.vim-tags-variables|
4.2. Includes................................|tmpl.vim-tags-include|
=================================================================================
1. Introduction *tmpl.vim-introduction*
tmpl.vim provides automated loading of templates for new files. You can load
templates for a specific environment, including on a per-buffer basis, for
various file types. Template files are kept in the |'runtimepath'|, allowing you
to easily add your own templates separately from this plugin (and other plugins
can contribute plugins).
Templates are loaded from a directory named `templates` on the |'runtimepath'|.
The name of the template to load is constructed:
1. The template environment is found (if none is given the default comes from
|g:tmplvim_default_environment|, or `default` if that is undefined). The
template environment may be overridden in each buffer by setting
|b:tmplvim_default_environment|.
2. The file extension is converted to lower-case and added to the template name.
3. If no file extension is found, the name of the file is converted to
lower-case and added to the template name as an extension.
---------------------------------------------------------------------------------
1.1 Examples *tmpl.vim-examples*
1. For a buffer with no name, no template file will be loaded automatically.
2. A buffer for `module.PY` will load the template `default.py`.
3. A buffer for `setup.sh` will load the template `default.sh`.
4. A buffer for `TARGETS` will load the template `default.targets`.
5. A buffer for `Makefile` with |g:tmplvim_default_environment| set to
`workplace` will load the template `workplace.makefile`.
6. A buffer for `setup.py` with |b:tmplvim_default_environment| set to
`myproject` will load the template `myproject.py`.
=================================================================================
2. Global Options *tmpl.vim-options*
g:tmplvim_default_environment *g:tmplvim_default_environment*
*b:tmplvim_default_environment*
Type: |String|
Default: `'default'`
Set the default template base name. This can be overridden on a per-buffer
basis by setting `b:tmplvim_default_environment`.
g:tmplvim_template_vars *g:tmplvim_template_vars*
Type: |Dictionary|
Default: `{}`
Map template variables to the preferred value. Template variables are special
tags in a template file which are expanded when the template is inserted into
a buffer. The tag `<#TAG_NAME#>` requires `TAG_NAME` to be present in
`g:tmplvim_template_vars` and will be replaced with the value of the
|Dictionary| entry. Any tags without a corresponding entry will be ignored.
g:tmplvim_author *g:tmplvim_author*
Type: |String|
Default: `$USER`
The value to replace the template variable tag (see |tmplvim-tags-variables|)
`AUTHOR` with. If not given, the value of the `$USER` environment variable
will be the default value.
=================================================================================
3. Commands *tmpl.vim-commands*
LoadTemplateFile `name` *LoadTemplateFile*
Load a template file into the current buffer. If `name` is given use that,
otherwise the value of |g:tmplvim_default_environment| will be used.
=================================================================================
4. Template Tags *tmpl.vim-tags*
Templates may contain tags which will be automatically expanded when the
template is loaded into the buffer. There are two types of tags:
1. Template variables (|tmpl.vim-tags-variables|)
2. Template includes (|tmpl.vim-tags-include|)
Template includes are processed first, then variables once includes have been
inserted into the buffer. Nested includes are not currently supported.
---------------------------------------------------------------------------------
4.1. Template variables *tmpl.vim-tags-variables*
Template variable tags are upper-case letters surrounded by `<#` and `#>`. The
value of a template variable comes from |g:tmplvim_template_vars|, except for
some specific reserved tag names:
1. `DATE`: Always replaced with the value of `strftime('%Y-%m-%d')` (e.g.
`2020-03-04`, see |strftime()|)
2. `YEAR`: Always replaced with the value of `strftime('%Y')` (e.g. `2020`, see
|strftime()|)
3. `TIME`: Always replaced with the value of `strftime('%H:%M:%S')` (e.g.
`13:03:34`, see |strftime()|)
4. `AUTHOR`: Always replaced with the value of |g:tmplvim_author|, or the value
of `$USER` if that is not set.
5. `DIRNAME`: Always replaced with the name of the directory the file is in.
6. `BASENAME`: Always replaced with the name of the file without extensions.
7. `UPPERBASENAME`: Always replaced with the name of the file without extensions
in upper-case.
---------------------------------------------------------------------------------
4.2. Template includes *tmpl.vim-tags-include*
Template include tags are letters, numbers, or periods surrounded by `<$` and
`$>`. The tag name is expected to be the name of another template, which may
include template variables but may not include other template includes. For
example, the include tag `<$ LICENSE.MIT $>` will be replaced with the contents
of the template file named `LICENSE.MIT`.
To accommodate including files in source code templates, an include with the
same extension as the current buffer will be searched for and preferred if
found. For example, the include tag `<$ LICENSE.MIT $>` in `setup.py` would use
the template named `LICENSE.MIT.py` if it exists, or `LICENSE.MIT` if not.

6
plugin/tmpl.vim Normal file
View File

@ -0,0 +1,6 @@
" vim: set syntax=vim filetype=vim noexpandtab ts=2 sts=2 sw=2 autoindent:
" vim: set foldmarker=[[[,]]] foldmethod=marker foldlevel=0:
autocmd BufNewFile * silent call tmpl#LoadTemplateFile()
command! -complete=customlist,tmpl#TemplateCommandCompletion -nargs=+ LoadTemplateFile call tmpl#LoadTemplateFile(<f-args>)

24
templates/LICENSE.BSD3 Normal file
View File

@ -0,0 +1,24 @@
Copyright (c) <# YEAR #>, <# AUTHOR #>
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
* Neither the name of the <organization> nor the
names of its contributors may be used to endorse or promote products
derived from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> BE LIABLE FOR ANY
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

24
templates/LICENSE.BSD3.sh Normal file
View File

@ -0,0 +1,24 @@
# Copyright (c) <# YEAR #>, <# AUTHOR #>
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
# * Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# * Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
# * Neither the name of the <organization> nor the
# names of its contributors may be used to endorse or promote products
# derived from this software without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
# DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> BE LIABLE FOR ANY
# DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
# ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

21
templates/LICENSE.MIT Normal file
View File

@ -0,0 +1,21 @@
The MIT License
Copyright (C) <# YEAR #> by <# AUTHOR #>
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.

21
templates/LICENSE.MIT.c Normal file
View File

@ -0,0 +1,21 @@
// The MIT License
//
// Copyright (C) <# YEAR #> by <# AUTHOR #>
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.

21
templates/LICENSE.MIT.h Normal file
View File

@ -0,0 +1,21 @@
// The MIT License
//
// Copyright (C) <# YEAR #> by <# AUTHOR #>
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.

21
templates/LICENSE.MIT.sh Normal file
View File

@ -0,0 +1,21 @@
# The MIT License
#
# Copyright (C) <# YEAR #> by <# AUTHOR #>
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in
# all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
# THE SOFTWARE.

8
templates/default.c Normal file
View File

@ -0,0 +1,8 @@
// vim: set filetype=c syntax=c autoindent noexpandtab sts=2 ts=2 sw=2:
// vim: foldmethod=marker foldmarker=[[[,]]]:
<$ LICENSE.MIT $>
#include <stdio.h>
#include <stdlib.h>
#include "<# BASENAME #>.h"

4
templates/default.go Normal file
View File

@ -0,0 +1,4 @@
// vim: set filetype=go syntax=go noexpandtab ts=2 sts=2 sw=2 foldmethod=marker:
// vim: set foldmarker=[[[,]]]:
// Package <# DIRNAME #> is
package <# DIRNAME #>

12
templates/default.h Normal file
View File

@ -0,0 +1,12 @@
// vim: set filetype=c syntax=c autoindent noexpandtab sts=2 ts=2 sw=2:
// vim: foldmethod=marker foldmarker=[[[,]]]:
<$ LICENSE.MIT $>
#ifndef __<# UPPERBASENAME #>_H__
#define __<# UPPERBASENAME #>_H__
#include <stdio.h>
#include <stdlib.h>
#endif

16
templates/default.html Normal file
View File

@ -0,0 +1,16 @@
<!DOCTYPE html>
<html>
<head>
<title>TITLE</title>
<meta name="viewport"
content="width=device-width, initial-scale=1, user-scalable=yes"
charset="utf-8" />
<!--
<link rel="stylesheet" type="text/css" href="" />
<script type="text/javascript" src=""></script>
-->
</head>
<body>
</body>
</html>

2
templates/default.py Normal file
View File

@ -0,0 +1,2 @@
#!/usr/bin/env python3
# vim: set expandtab sw=4 ts=4 sts=4 foldmethod=indent filetype=python syntax=python:

5
templates/default.sh Normal file
View File

@ -0,0 +1,5 @@
#!/bin/sh
# vim: set filetype=sh noexpandtab ts=2 sts=2 sw=2 foldmethod=marker:
# vim: set foldmarker=[[[,]]]:
set -e

19
templates/default.tex Normal file
View File

@ -0,0 +1,19 @@
% vim: set autoindent sts=4 ts=4 sw=4 noexpandtab foldmethod=syntax
\documentclass{article}
\usepackage{url}
\usepackage{graphicx}
\usepackage{hyperref}
\usepackage{amsmath}
\title{TITLE}
\author{<# AUTHOR #>}
\begin{document}
\maketitle
\section{SECTION}
\end{document}