From e0624ab63d5504dc42fbaed9f48158b86295d21f Mon Sep 17 00:00:00 2001 From: Robert Günzler Date: Thu, 19 Jan 2023 18:33:43 +0100 Subject: vim: format config with stylua MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Robert Günzler --- .vim/snippets/sh.lua | 39 +++++++++++++++++++++++++++++++++++++++ .vim/snippets/text.lua | 26 ++++++++++++++++++++++++++ 2 files changed, 65 insertions(+) create mode 100644 .vim/snippets/sh.lua create mode 100644 .vim/snippets/text.lua (limited to '.vim/snippets') diff --git a/.vim/snippets/sh.lua b/.vim/snippets/sh.lua new file mode 100644 index 0000000..e8ba23b --- /dev/null +++ b/.vim/snippets/sh.lua @@ -0,0 +1,39 @@ +---@diagnostic disable: undefined-global +return { + s( + { trig = 'getopts', desc = 'getopts skeleton' }, + fmt( + [=[ + while getopts h{} opt; do + case ${{opt}} in + h | ?) + printf "usage: %s [-h]\n" "$(basename "$0")" + printf "\n" + exit 2 + ;; + esac + done + shift $((OPTIND - 1)) + ]=], + { i(1) } + ) + ), + + s( + { trig = 'usage' }, + fmt( + [=[ + usage() {{ + printf "usage: %s{}" "$(basename "$0")\n" + printf "\n" + {} + printf "\n" + }} + ]=], + { + i(1, ' []'), + i(2, 'printf " -{}\n"'), + } + ) + ), +} diff --git a/.vim/snippets/text.lua b/.vim/snippets/text.lua new file mode 100644 index 0000000..9fca88f --- /dev/null +++ b/.vim/snippets/text.lua @@ -0,0 +1,26 @@ +---@diagnostic disable: undefined-global +return { + s('test', t('test inserted')), + -- licenses (full-text) + s( + { trig = 'license-mit', name = 'MIT license' }, + file_contents(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' }, + file_contents(vim.fn.stdpath('config') .. '/snippets/.licenses/gpl-3.0', {}) + ), + s( + { trig = 'license-agpl-3.0', name = 'AGPL-3.0 license' }, + file_contents(vim.fn.stdpath('config') .. '/snippets/.licenses/agpl-3.0', {}) + ), + s( + { trig = 'license-cc0-1.0', name = 'CC-Zero-1.0 license' }, + file_contents(vim.fn.stdpath('config') .. '/snippets/.licenses/cc0-1.0', {}) + ), +} -- cgit 1.4.1