aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSwissalpS <Luke@SwissalpS.ws>2020-06-20 19:31:54 +0200
committerSwissalpS <Luke@SwissalpS.ws>2020-06-20 19:31:54 +0200
commit85871ce1e046916feedff87897f43d687477ab86 (patch)
tree8c81c315c9cb0b6a5bcf4176ca6484c1a92cfd3a
parente533f0fa3ac9db5d7c4c684f00ae2d31b0f73ed7 (diff)
downloadlite-xl-plugins-85871ce1e046916feedff87897f43d687477ab86.tar.gz
lite-xl-plugins-85871ce1e046916feedff87897f43d687477ab86.zip
added date- and time-stamps insertion
change the formats to what you like
-rw-r--r--plugins/datetimestamps.lua33
1 files changed, 33 insertions, 0 deletions
diff --git a/plugins/datetimestamps.lua b/plugins/datetimestamps.lua
new file mode 100644
index 0000000..749268a
--- /dev/null
+++ b/plugins/datetimestamps.lua
@@ -0,0 +1,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
+})
+