aboutsummaryrefslogtreecommitdiff
path: root/lua/startup/functions.lua
blob: 63c26dfb1dd3666975d849886ac3fcd63d5ac940 (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
34
35
36
37
38
39
40
---@tag startup_nvim.functions
---@brief [[
--- This are functions which you can use to build your own startup.nvim theme.
---@brief ]]
local functions = {}

local quotes = require("startup.quotes")

---Returns a random programming quote
---@return table: Lines of text for the quote
function functions.quote()
  math.randomseed(os.clock())
  local index = math.random() * #quotes
  return quotes[math.floor(index) + 1]
end

---Returns a string with the number of loaded Packer Plugins
---@return string: String with info about the number of loaded plugins
function functions.packer_plugins()
  if packer_plugins then
    return {
      string.format(
        "Total plugins (packer.nvim): %d",
        vim.tbl_count(packer_plugins)
      ),
    }
  else
    return ""
  end
end

---Returns the current date and time
---@return table: Table with a string for the date and one for the time
function functions.date_time()
  local clock = " " .. os.date("%H:%M")
  local date = " " .. os.date("%d-%m-%y")
  return { clock, date }
end

return functions