diff options
| author | Robert Günzler <r@gnzler.io> | 2022-10-14 21:03:06 +0200 |
|---|---|---|
| committer | Robert Günzler <r@gnzler.io> | 2022-10-14 21:03:06 +0200 |
| commit | dc43c1abb900b8d0041df075b8f8fd6057e0c941 (patch) | |
| tree | 28aed51794b4aa5bae3a23251036fc8793648412 /.vim/snippets/all.lua | |
| parent | 8f755cfad3c2fd092e111671c8a36e5835553131 (diff) | |
vim: add license snippets
Diffstat (limited to '.vim/snippets/all.lua')
| -rw-r--r-- | .vim/snippets/all.lua | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/.vim/snippets/all.lua b/.vim/snippets/all.lua index a8157cc..673160f 100644 --- a/.vim/snippets/all.lua +++ b/.vim/snippets/all.lua @@ -18,8 +18,17 @@ local todo_comment = function(key) return comment(nodes) end +local from_file = function(path, vargs) + return d(1, function(_, _, _, ...) + local lines = {} + for line in io.lines(path) do table.insert(lines, line) end + return sn(nil, fmt(table.concat(lines, "\n"), ...)) + end, {}, { user_args = {vargs}}) +end + return { s('me', user_email), + s('date', exec([[date --rfc-email]])), s('today', f(function() return os.date('%Y-%m-%d') end, {})), s('now' , f(function() return os.date('%Y-%m-%dT%H:%M:%SZ') end, {})), @@ -50,4 +59,19 @@ return { } } ), + + -- licenses (full-text) + s({trig='license-mit', name='MIT license'}, from_file( + vim.fn.stdpath('config') .. '/snippets/.licenses/mit', + { + year = f(function() return os.date('%Y') end, {}), + copyright = sn(1, user_email), + }) + ), + s({trig='license-gpl-3.0', name='GPL-3.0 license'}, from_file( + vim.fn.stdpath('config') .. '/snippets/.licenses/gpl-3.0', {})), + s({trig='license-agpl-3.0', name='AGPL-3.0 license'}, from_file( + vim.fn.stdpath('config') .. '/snippets/.licenses/agpl-3.0', {})), + s({trig='license-cc0-1.0', name='CC-Zero-1.0 license'}, from_file( + vim.fn.stdpath('config') .. '/snippets/.licenses/cc0-1.0', {})), } |