summaryrefslogtreecommitdiffstats
path: root/lua/snippets/norg.lua
blob: d96a471217ac72c4a6fe73280b17f345492ea846 (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
require('core.snippets.shorthands')

local function file_name(args, parent, user_args)
  return vim.fn.expand("%:t:r")
end

return {
  -- header level 1, usually this has the same name as the file
  s("h1", {
    t("* "),
    c(1, {
      f(file_name, {}),
      i(1, "header")
    })
  }),

  -- link snippet
  s("link", {
    t("{"),
    c(1, {
      sn(nil, { t({":$/"}), i(1, "path to file"), t(":") }),
      i(1, "https://example.com")
    }),
    t("}["),
    i(2, "description"),
    t("]")
  })
}