aboutsummaryrefslogtreecommitdiff
path: root/plugins/datetimestamps.lua
blob: 749268acbc37a50e9abae67b10cc4493d6b8c15b (plain)
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
local core = require "core"
local command = require "core.command"

local function datestamp()

  local sOut = os.date('%Y%m%d')

  core.active_view.doc:text_input(sOut)

end

local function datetimestamp()

  local sOut = os.date('%Y%m%d_%H%M%S')

  core.active_view.doc:text_input(sOut)

end

local function timestamp()

  local sOut = os.date('%H%M%S')

  core.active_view.doc:text_input(sOut)

end

command.add("core.docview", {
  ["datetimestamps:datestamp"] = datestamp,
  ["datetimestamps:timestamp"] = timestamp,
  ["datetimestamps:datetimestamp"] = datetimestamp
})