Show time in status line
This commit is contained in:
@@ -1,26 +1,25 @@
|
|||||||
local lualine = require("lualine")
|
local lualine = require("lualine")
|
||||||
|
|
||||||
-- Section "a"
|
|
||||||
local mode = {
|
local mode = {
|
||||||
"mode",
|
"mode",
|
||||||
}
|
}
|
||||||
|
|
||||||
-- Section "b"
|
|
||||||
local branch = {
|
local branch = {
|
||||||
"branch",
|
"branch",
|
||||||
icons_enabled = true,
|
icons_enabled = true,
|
||||||
icon = "",
|
icon = "",
|
||||||
}
|
}
|
||||||
|
|
||||||
local diagnostics = {
|
local diagnostics = {
|
||||||
"diagnostics",
|
"diagnostics",
|
||||||
always_visible = true,
|
always_visible = true,
|
||||||
sections = { "error", "warn" },
|
sections = { "error", "warn" },
|
||||||
}
|
}
|
||||||
|
|
||||||
-- Section "c"
|
|
||||||
local filename = {
|
local filename = {
|
||||||
"filename",
|
"filename",
|
||||||
}
|
}
|
||||||
|
|
||||||
local fileformat = {
|
local fileformat = {
|
||||||
"fileformat",
|
"fileformat",
|
||||||
symbols = {
|
symbols = {
|
||||||
@@ -30,19 +29,39 @@ local fileformat = {
|
|||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
-- Section "x"
|
|
||||||
local location = {
|
local location = {
|
||||||
"location",
|
"location",
|
||||||
}
|
}
|
||||||
|
|
||||||
-- Section "y"
|
|
||||||
local encoding = {
|
local encoding = {
|
||||||
"encoding",
|
"encoding",
|
||||||
}
|
}
|
||||||
|
|
||||||
local filetype = {
|
local filetype = {
|
||||||
"filetype",
|
"filetype",
|
||||||
}
|
}
|
||||||
|
|
||||||
|
local timer = vim.loop.new_timer()
|
||||||
|
timer:start(
|
||||||
|
0,
|
||||||
|
1000,
|
||||||
|
vim.schedule_wrap(function()
|
||||||
|
vim.g.lualine_time_module = os.date("%H:%M", os.time())
|
||||||
|
end)
|
||||||
|
)
|
||||||
|
local time = {
|
||||||
|
function()
|
||||||
|
return vim.g.lualine_time_module
|
||||||
|
end,
|
||||||
|
cond = function()
|
||||||
|
if vim.g.lualine_time_module then
|
||||||
|
return true
|
||||||
|
end
|
||||||
|
|
||||||
|
return false
|
||||||
|
end,
|
||||||
|
}
|
||||||
|
|
||||||
lualine.setup({
|
lualine.setup({
|
||||||
options = {
|
options = {
|
||||||
disabled_filetypes = { "NvimTree" },
|
disabled_filetypes = { "NvimTree" },
|
||||||
@@ -53,7 +72,7 @@ lualine.setup({
|
|||||||
lualine_a = { mode },
|
lualine_a = { mode },
|
||||||
lualine_b = { branch },
|
lualine_b = { branch },
|
||||||
lualine_c = { diagnostics, filename, fileformat },
|
lualine_c = { diagnostics, filename, fileformat },
|
||||||
lualine_x = { location, encoding, filetype },
|
lualine_x = { location, encoding, filetype, time },
|
||||||
lualine_y = {},
|
lualine_y = {},
|
||||||
lualine_z = {},
|
lualine_z = {},
|
||||||
},
|
},
|
||||||
|
|||||||
Reference in New Issue
Block a user