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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
|
U = {}
local colors = require("startup.config").colors
function U.spaces(amount)
return string.rep(" ", amount)
end
function U.default_header()
local header = {
" /$$ ",
" |__/ ",
" /$$$$$$$ /$$$$$$ /$$$$$$ /$$ /$$ /$$ /$$$$$$/$$$$ ",
"| $$__ $$ /$$__ $$ /$$__ $$| $$ /$$/| $$| $$_ $$_ $$",
"| $$ \\ $$| $$$$$$$$| $$ \\ $$ \\ $$/$$/ | $$| $$ \\ $$ \\ $$",
"| $$ | $$| $$_____/| $$ | $$ \\ $$$/ | $$| $$ | $$ | $$",
"| $$ | $$| $$$$$$$| $$$$$$/ \\ $/ | $$| $$ | $$ | $$",
"|__/ |__/ \\_______/ \\______/ \\_/ |__/|__/ |__/ |__/",
}
return header
end
function U.get_oldfiles(amount)
local oldfiles = {}
local oldfiles_raw = vim.fn.execute "oldfiles"
local oldfiles_amount = 0
for file in oldfiles_raw:gmatch "[^\n]+" do
if oldfiles_amount >= amount then
break
end
table.insert(oldfiles, (string.sub(file, 5, -1)))
oldfiles_amount = oldfiles_amount + 1
end
return oldfiles
end
function U.longest_line(lines)
local longest = 0
for _, line in ipairs(lines) do
if line:len() > longest then
longest = line:len()
end
end
return longest
end
function U.create_hls()
vim.cmd("hi StartupHeading guifg=" .. colors.heading_fg)
vim.cmd("hi StartupTools guifg=" .. colors.tools_fg)
end
function U.set_buf_options()
vim.api.nvim_buf_set_option(0, "bufhidden", "wipe")
vim.api.nvim_buf_set_option(0, "buftype", "nofile")
vim.api.nvim_buf_set_option(0, "filetype", "dashboard")
vim.api.nvim_buf_set_option(0, "swapfile", false)
vim.cmd [[setlocal nonu nornu]]
end
return U
|