From 3f10c11306e483074f78d6d43b192fb3bb690d64 Mon Sep 17 00:00:00 2001 From: SwissalpS Date: Tue, 23 Jun 2020 17:38:08 +0200 Subject: make formats define-able with config --- plugins/datetimestamps.lua | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/plugins/datetimestamps.lua b/plugins/datetimestamps.lua index ecb91c2..e755848 100644 --- a/plugins/datetimestamps.lua +++ b/plugins/datetimestamps.lua @@ -1,9 +1,14 @@ local core = require "core" +local config = require "core.config" local command = require "core.command" +config.datetimestamps_format_datestamp = "%Y%m%d" +config.datetimestamps_format_datetimestamp = "%Y%m%d_%H%M%S" +config.datetimestamps_format_timestamp = "%H%M%S" + local function datestamp() - local sOut = os.date('%Y%m%d') + local sOut = os.date(config.datetimestamps_format_datestamp) core.active_view.doc:text_input(sOut) @@ -11,7 +16,7 @@ end local function datetimestamp() - local sOut = os.date('%Y%m%d_%H%M%S') + local sOut = os.date(config.datetimestamps_format_datetimestamp) core.active_view.doc:text_input(sOut) @@ -19,7 +24,7 @@ end local function timestamp() - local sOut = os.date('%H%M%S') + local sOut = os.date(config.datetimestamps_format_timestamp) core.active_view.doc:text_input(sOut) -- cgit v1.2.3