dotfiles

*nix config files
git clone git://git.pyratebeard.net/dotfiles.git
Log | Files | Refs | README

alpha.lua (2282B)


      1 return {
      2 	'goolord/alpha-nvim',
      3 	event = 'VimEnter',
      4 	opts = function()
      5 		local dashboard = require('alpha.themes.dashboard')
      6 		require("alpha.term")
      7 		dashboard.section.terminal.command = vim.fn.stdpath("config") .. "/nvim-logo -t"
      8 		dashboard.section.terminal.width = 70
      9 		dashboard.section.terminal.height = 10
     10 		dashboard.section.terminal.opts.redraw = true
     11 		dashboard.section.terminal.opts.window_config.zindex = 1
     12 		-- offset placment for screenshots
     13 		-- dashboard.section.terminal.opts.window_config.col = math.floor((vim.o.columns - 70) / 2 + 20)
     14 		-- vim.cmd [[autocmd! User AlphaClosed]]
     15 
     16 		dashboard.section.buttons.val = {
     17 			dashboard.button('i', '    new file', ':ene <BAR> startinsert<CR>'),
     18 			dashboard.button('o', '    old files', ':Telescope oldfiles<CR>'),
     19 			dashboard.button('f', '󰥨    find file', ':Telescope file_browser<CR>'),
     20 			dashboard.button('g', '󰱼    find text', ':Telescope live_grep_args<CR>'),
     21 			dashboard.button('h', '    browse git', ':Flog<CR>'),
     22 			dashboard.button('l', '󰒲    lazy', ':Lazy<CR>'),
     23 			dashboard.button('m', '󱌣    mason', ':Mason<CR>'),
     24 			dashboard.button('p', '󰄉    profile', ':Lazy profile<CR>'),
     25 			dashboard.button('q', '󰭿    quit', ':qa<CR>'),
     26 		}
     27 		for _, button in ipairs(dashboard.section.buttons.val) do
     28 			button.opts.hl = 'Normal'
     29 			button.opts.hl_shortcut = 'Function'
     30 		end
     31 		dashboard.section.footer.opts.hl = "Special"
     32 		dashboard.opts.layout = {
     33 			dashboard.section.terminal,
     34 			{ type = "padding", val = 4 },
     35 			dashboard.section.buttons,
     36 			dashboard.section.footer,
     37 		}
     38 		return dashboard
     39 	end,
     40 	config = function(_, dashboard)
     41 		-- close lazy and re-open when the dashboard is ready
     42 		if vim.o.filetype == 'lazy' then
     43 			vim.cmd.close()
     44 			vim.api.nvim_create_autocmd('User', {
     45 				pattern = 'AlphaReady',
     46 				callback = function()
     47 					require('lazy').show()
     48 				end,
     49 			})
     50 		end
     51 		require('alpha').setup(dashboard.opts)
     52 
     53 		vim.api.nvim_create_autocmd('User', {
     54 			pattern = 'LazyVimStarted',
     55 			callback = function()
     56 				local stats = require('lazy').stats()
     57 				local ms = (math.floor(stats.startuptime * 100 + 0.5) / 100)
     58 				dashboard.section.footer.val = '󱐋 ' .. stats.count .. ' plugins loaded in ' .. ms .. 'ms'
     59 				pcall(vim.cmd.AlphaRedraw)
     60 			end,
     61 		})
     62 	end,
     63 }