From 6cf2d6bda43d923d11d29f141d634833443c2b85 Mon Sep 17 00:00:00 2001 From: max397574 Date: Wed, 6 Oct 2021 17:30:42 +0200 Subject: =?UTF-8?q?feat(utils):=20=E2=9C=A8started=20adding=20oldfiles?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lua/startup/utils.lua | 32 ++++++++++++++++++++++++++++++-- 1 file changed, 30 insertions(+), 2 deletions(-) (limited to 'lua/startup/utils.lua') 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() -- cgit v1.2.3