diff --git a/lua/options.lua b/lua/options.lua index 57880df..c0ed8d3 100644 --- a/lua/options.lua +++ b/lua/options.lua @@ -14,7 +14,7 @@ vim.opt.mouse = 'a' -- allow the mouse to be used in Nvim vim.opt.tabstop = 2 -- number of visual spaces per TAB vim.opt.softtabstop = 2 -- number of spaces in tab when editing vim.opt.shiftwidth = 2 -- insert 4 spaces on a tab -vim.opt.expandtab = true -- tabs are spaces, mainly because of python +vim.opt.expandtab = true -- tabs are spaces, mainly because of python and because it is consistent -- UI config vim.opt.number = true -- show absolute number diff --git a/lua/plugins.lua b/lua/plugins.lua index 347285e..ec8ea42 100644 --- a/lua/plugins.lua +++ b/lua/plugins.lua @@ -270,4 +270,119 @@ require("lazy").setup({ { "itchyny/calendar.vim" }, + + -- treesitter asciidoc support + { "cpkio/nvim-treesitter-asciidoc" }, + + + { + + 'goolord/alpha-nvim', + dependencies = { + 'nvim-tree/nvim-web-devicons', + }, + config = function() + local alpha = require 'alpha' + local dashboard = require 'alpha.themes.dashboard' + + _Gopts = { + position = 'center', + hl = 'Type', + wrap = 'overflow', + } + + -- DASHBOARD HEADER + + local function getGreeting() + local tableTime = os.date '*t' + local datetime = os.date ' %Y-%m-%d-%A  %H:%M:%S ' + local hour = tableTime.hour + local greetingsTable = { + [1] = ' Sleep well', + [2] = ' Good morning', + [3] = ' Good afternoon', + [4] = ' Good evening', + [5] = '󰖔 Good night', + } + local greetingIndex = 0 + if hour == 23 or hour < 7 then + greetingIndex = 1 + elseif hour < 12 then + greetingIndex = 2 + elseif hour >= 12 and hour < 18 then + greetingIndex = 3 + elseif hour >= 18 and hour < 21 then + greetingIndex = 4 + elseif hour >= 21 then + greetingIndex = 5 + end + return datetime .. ' ' .. greetingsTable[greetingIndex] + end + + local logo = [[ + +  + ████ ██████ █████ ██ + ███████████ █████  + █████████ ███████████████████ ███ ███████████ + █████████ ███ █████████████ █████ ██████████████ + █████████ ██████████ █████████ █████ █████ ████ █████ + ███████████ ███ ███ █████████ █████ █████ ████ █████ + ██████ █████████████████████ ████ █████ █████ ████ ██████ + + ]] + + local greeting = getGreeting() + local marginBottom = 0 + + -- Split logo into lines + local logoWidth = 0 + for line in logo:gmatch '[^\n]+' do + logoWidth = math.max(logoWidth, #line / 2) + end + logoWidth = 75 -- code above does not work with utf8 strings in lua 5.1 + + -- Calculate padding for centering the greeting + local greetingWidth = #greeting - 3 + local padding = math.floor((logoWidth - greetingWidth) / 2) + + -- Generate spaces for padding + local paddedGreeting = string.rep(' ', padding) .. greeting + + -- Add margin lines below the padded greeting + local margin = string.rep('\n', marginBottom * 5) + + -- Concatenate logo, padded greeting, and margin + local adjustedLogo = logo .. '\n' .. paddedGreeting .. margin + dashboard.section.header.val = vim.split(adjustedLogo, '\n') + + dashboard.section.buttons.val = { + dashboard.button('n', ' New file', ':ene startinsert '), + dashboard.button('u', '󱐥 Update plugins', 'Lazy update'), + dashboard.button('s', ' Settings', 'WorkspacesOpen config-nvim'), + dashboard.button('w', ' Workspaces', 'WorkspacesOpen'), + dashboard.button('q', '󰤆 Quit', 'qa'), + } + + -- dashboard.section.footer.val = greeting + + vim.api.nvim_create_autocmd('User', { + pattern = 'LazyVimStarted', + desc = 'Add Alpha dashboard footer', + once = true, + callback = function() + local stats = require('lazy').stats() + local ms = math.floor(stats.startuptime * 100 + 0.5) / 100 + dashboard.section.footer.val = { ' ', ' ', ' ', ' Loaded ' .. stats.count .. ' plugins  in ' .. ms .. ' ms ' } + dashboard.section.header.opts.hl = 'DashboardFooter' + pcall(vim.cmd.AlphaRedraw) + end, + }) + + dashboard.opts.opts.noautocmd = true + alpha.setup(dashboard.opts) + end, + }, + + })