From 508b0785bce79deccb1ffc284d830c89e27599f1 Mon Sep 17 00:00:00 2001 From: shadmansaleh Date: Thu, 30 Mar 2023 04:32:45 +0000 Subject: [PATCH] chore: autogen (vimdocs+formating) --- doc/lualine.txt | 15 +++++++++++++++ lua/lualine/components/datetime.lua | 30 ++++++++++++++--------------- 2 files changed, 30 insertions(+), 15 deletions(-) diff --git a/doc/lualine.txt b/doc/lualine.txt index a040787..fa7b37a 100644 --- a/doc/lualine.txt +++ b/doc/lualine.txt @@ -658,6 +658,21 @@ Component specific options These are options that are available on < + *lualine-datetime-component-options* + +> + sections = { + lualine_a = { + { + 'datetime', + -- options: default, us, uk, iso, or your own format string ("%H:%M", etc..) + style = 'default' + } + } + } +< + + *lualine-tabs-component-options* > diff --git a/lua/lualine/components/datetime.lua b/lua/lualine/components/datetime.lua index 381783b..d1c702e 100644 --- a/lua/lualine/components/datetime.lua +++ b/lua/lualine/components/datetime.lua @@ -4,28 +4,28 @@ local lualine_require = require('lualine_require') local M = lualine_require.require('lualine.component'):extend() local default_options = { - -- default, us, uk, iso, or format (ex. "%d/%m/%Y ...") - style = 'default', + -- default, us, uk, iso, or format (ex. "%d/%m/%Y ...") + style = 'default', } function M:init(options) - M.super.init(self, options) - self.options = vim.tbl_deep_extend('keep', self.options or {}, default_options) + M.super.init(self, options) + self.options = vim.tbl_deep_extend('keep', self.options or {}, default_options) end function M:update_status() - local fmt = self.options.style - if self.options.style == 'default' then - fmt = '%A, %B %d | %H:%M' - elseif self.options.style == 'us' then - fmt = '%m/%d/%Y' - elseif self.options.style == 'uk' then - fmt = '%d/%m/%Y' - elseif self.options.style == 'iso' then - fmt = '%Y-%m-%d' - end + local fmt = self.options.style + if self.options.style == 'default' then + fmt = '%A, %B %d | %H:%M' + elseif self.options.style == 'us' then + fmt = '%m/%d/%Y' + elseif self.options.style == 'uk' then + fmt = '%d/%m/%Y' + elseif self.options.style == 'iso' then + fmt = '%Y-%m-%d' + end - return os.date(fmt) + return os.date(fmt) end return M