aboutsummaryrefslogtreecommitdiff
path: root/lua/startup/themes/startify.lua
blob: 7e743e9d11267dd6a301b3874a4e7e0355248d8b (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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
local user_bookmarks = vim.g.startup_bookmarks

local bookmark_texts = { "Bookmarks", "" }
local user_bookmark_mappings = {}

if not user_bookmarks then
  user_bookmarks = {}
  bookmark_texts = {}
end

for key, file in pairs(user_bookmarks) do
  bookmark_texts[#bookmark_texts + 1] = key .. " " .. file
end

for key, file in pairs(user_bookmarks) do
  user_bookmark_mappings[key] = "<cmd>e " .. file .. "<CR>"
end
local cow = {
  "        \\   ^__^",
  "         \\  (oo)\\_______",
  "            (__)\\       )\\/\\",
  "                ||----w |",
  "                ||     ||",
}

local quote = require("startup.functions").quote()
while true do
  if require("startup.utils").longest_line(quote) <= vim.o.columns - 15 then
    break
  end
  quote = require("startup.functions").quote()
end
local length = require("startup.utils").longest_line(quote) + 4

local complete = {}

table.insert(quote, 1, "")
quote[#quote + 1] = ""

table.insert(complete, "▛" .. string.rep("▀", length - 2) .. "▜")
local function spaces(amount)
  return string.rep(" ", amount)
end
for _, line in ipairs(quote) do
  table.insert(
    complete,
    "▌" .. " " .. line .. spaces(length - 3 - #line) .. "▐"
  )
end
table.insert(complete, "▙" .. string.rep("▄", length - 2) .. "▟")

for _, line in ipairs(cow) do
  complete[#complete + 1] = line
end

-- NOTE: lua dump(vim.fn.expand("#<1")) to get newest oldfile

local settings = {
  header = {
    type = "text",
    oldfiles_directory = false,
    align = "left",
    fold_section = false,
    title = "Header",
    margin = 5,
    content = complete,
    highlight = "Statement",
    default_color = "",
    oldfiles_amount = 0,
  },
  body = {
    type = "oldfiles",
    oldfiles_directory = false,
    align = "left",
    fold_section = false,
    title = "Oldfiles",
    margin = 5,
    content = "",
    highlight = "String",
    default_color = "",
    oldfiles_amount = 5,
  },
  body_2 = {
    type = "oldfiles",
    oldfiles_directory = true,
    align = "left",
    fold_section = false,
    title = "",
    margin = 5,
    content = "",
    highlight = "String",
    oldfiles_amount = 5,
  },
  bookmarks = {
    type = "text",
    align = "left",
    margin = 5,
    content = bookmark_texts,
    highlight = "String",
  },
  options = {
    after = function()
      require("startup").create_mappings(user_bookmark_mappings)
      require("startup.utils").oldfiles_mappings()
    end,
    mapping_keys = false,
    cursor_column = 0.25,
    empty_line_between_mappings = false,
    disable_statuslines = true,
    paddings = { 1, 1, 1, 1 },
  },
  mappings = {
    execute_command = "<CR>",
    open_file = "o",
    open_file_split = "<c-o>",
    open_section = "<TAB>",
    open_help = "?",
  },
  colors = {
    background = "#1f2227",
    folded_section = "#56b6c2",
  },
  parts = { "header", "body", "body_2", "bookmarks" },
}

return settings