aboutsummaryrefslogtreecommitdiff
path: root/lua
diff options
context:
space:
mode:
Diffstat (limited to 'lua')
-rw-r--r--lua/startup.lua8
-rw-r--r--lua/startup/config.lua2
-rw-r--r--lua/startup/utils.lua32
3 files changed, 38 insertions, 4 deletions
diff --git a/lua/startup.lua b/lua/startup.lua
index 4fdb4ac..d895433 100644
--- a/lua/startup.lua
+++ b/lua/startup.lua
@@ -135,10 +135,14 @@ function M.display()
end
function M.setup(update)
+ if vim.g.startup_nvim_loaded then
+ return
+ end
+ vim.g.startup_nvim_loaded = true
+
settings = vim.tbl_deep_extend("force", settings, update or {})
vim.cmd [[
- autocmd StdinReadPre * let s:std_in=1
- autocmd VimEnter * lua if vim.fn.argc() == 0 and vim.fn.exists('std_in') then require"startup".display() end
+ autocmd VimEnter * lua if vim.fn.argc() == 0 then require"startup".display() end
]]
end
diff --git a/lua/startup/config.lua b/lua/startup/config.lua
index b7afed4..add30f3 100644
--- a/lua/startup/config.lua
+++ b/lua/startup/config.lua
@@ -10,6 +10,8 @@ local settings = {
"| $$ | $$| $$$$$$$| $$$$$$/ \\ $/ | $$| $$ | $$ | $$",
"|__/ |__/ \\_______/ \\______/ \\_/ |__/|__/ |__/ |__/",
},
+ -- header = utils.get_oldfiles(10),
+ -- header = require("startup.utils").default_header(),
-- name which will be displayed and command
tools = {
[" Find File"] = { "Telescope find_files", "<leader>ff" },
diff --git a/lua/startup/utils.lua b/lua/startup/utils.lua
index 8498b1f..aba785c 100644
--- a/lua/startup/utils.lua
+++ b/lua/startup/utils.lua
@@ -5,6 +5,34 @@ 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
@@ -16,8 +44,8 @@ function U.longest_line(lines)
end
function U.create_hls()
- vim.cmd( "hi StartupHeading guifg=" .. colors.heading_fg)
- vim.cmd( "hi StartupTools guifg=" .. colors.tools_fg)
+ vim.cmd("hi StartupHeading guifg=" .. colors.heading_fg)
+ vim.cmd("hi StartupTools guifg=" .. colors.tools_fg)
end
function U.set_buf_options()