summary refs log tree commit diff
path: root/.vim/snippets/all.lua
blob: 6dfe0092a80b50bde28594590ab7004590a28683 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
---@diagnostic disable: undefined-global

return {
  -- mini symbols
  s('check', t([[]])),
  s('cross', t([[]])),
  s('...', t([[]])),

  s(
    'memail',
    c(1, {
      t([[robert@gnzler.de]]),
      t([[robert@gnzler.io]]),
    })
  ),
  s('mename', t([[Robert Günzler]])),
  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, {})
  ),

  s(
    'license',
    d(1, function()
      local choices = {}
      for _, path in
        ipairs(
          vim.fn.glob(vim.fn.stdpath('config') .. '/snippets/license_*.txt', false, true, false)
        )
      do
        choices[#choices + 1] = f(function(_, _, uargs)
          return vim.fn.readfile(uargs)
        end, {}, { user_args = { path } })
      end
      return sn(nil, { c(1, choices, { name = 'FOSS licenses' }) })
    end, nil)
  ),

  s(
    'todo',
    d(1, function()
      return sn(nil, fmt(string.format(vim.bo.commentstring, ' TODO: {} '), { i(1) }))
    end, nil)
  ),
}