diff options
Diffstat (limited to '.vim/snippets')
| -rw-r--r-- | .vim/snippets/all.lua | 41 |
1 files changed, 7 insertions, 34 deletions
diff --git a/.vim/snippets/all.lua b/.vim/snippets/all.lua index b4fa8c3..f218086 100644 --- a/.vim/snippets/all.lua +++ b/.vim/snippets/all.lua @@ -1,34 +1,11 @@ ---@diagnostic disable: undefined-global -local todo_comment = function(key) - local nodes = {} - if type(key) == 'string' then - table.insert(nodes, t(key)) - elseif type(key) == 'table' then - table.insert( - nodes, - c( - 1, - vim.tbl_map(function(e) - return t(e) - end, key) - ) - ) - end - local wrapped = autowrap(t('('), t(')'), { - c(#nodes, { - t(''), -- bare - sn(1, user_email), - f(function() - return os.date('%Y-%m-%d') - end, {}), -- time - }), - }) - for _, n in ipairs(wrapped) do - table.insert(nodes, n) - end - table.insert(nodes, t(': ')) - return comment(nodes) +local todo_comment = function(keys) + local choices = vim.tbl_map(function(e) + return t(e) + end, keys) + table.insert(choices, i(0)) + return comment({ c(1, choices), t(': ') }) end return { @@ -48,11 +25,7 @@ return { ), -- todo comments - s('todo', todo_comment('TODO')), - s('note', todo_comment('NOTE')), - s('hack', todo_comment('HACK')), - s('warn', todo_comment({ 'WARN', 'XXX' })), - s('fix', todo_comment({ 'FIX', 'FIXME', 'ISSUE', 'BUG' })), + s('todo', todo_comment({ 'TODO', 'NOTE', 'FIXME' })), s( { trig = '#!', name = 'Shell script skeleton' }, |