From 128828b8e993a457a35afd1c71bf0b5fbd1a8a25 Mon Sep 17 00:00:00 2001 From: Robert Günzler Date: Tue, 2 Nov 2021 17:48:26 +0100 Subject: vim: startify -> alpha --- .vim/lua/colors.lua | 2 ++ .vim/lua/plugins.lua | 85 ++++++++++++++++++++++++++++++++++++++++++++++++++-- 2 files changed, 85 insertions(+), 2 deletions(-) (limited to '.vim') diff --git a/.vim/lua/colors.lua b/.vim/lua/colors.lua index a80fc9c..0f3b47b 100644 --- a/.vim/lua/colors.lua +++ b/.vim/lua/colors.lua @@ -303,6 +303,8 @@ return lush(function() StartifyFooter { fg = hsl(p.dim.white) }, -- }}} + AlphaFortune { Comment }, + -- Plugin configs END }}} -- Config specific diff --git a/.vim/lua/plugins.lua b/.vim/lua/plugins.lua index 157cb59..e532c0a 100644 --- a/.vim/lua/plugins.lua +++ b/.vim/lua/plugins.lua @@ -564,10 +564,91 @@ return require('packer').startup({function() } end} -- }}} - use {'mhinz/vim-startify', -- {{{ + use {'goolord/alpha-nvim', -- {{{ config = function() + local alpha = require('alpha') + local them = require('alpha.themes.startify') + local hr = function() + local margin = 3; return string.rep(' ', margin) .. string.rep('─', vim.o.columns-(2*margin)) + end + them.opts.layout = { + {type = 'padding', val = 1}, + them.section.header, + {type = 'padding', val = 1}, + { + type = 'text', + val = function() + local j = require('plenary.job'):new({ + command = 'fortune', + args = {vim.fn.expand('$HOME/devel/projects/zig/fortune/fortunes')}, + enable_recording = true, + }) + local lines = j:sync() + local new = {} + for i = 1, #lines do + if not (vim.trim(lines[i]) == '') then + new[#new+1] = string.rep(' ', 3) .. lines[i] + end + end + return new + end, + opts = { + hl = 'AlphaFortune', + } + }, + {type = 'padding', val = 1}, + {type = 'text', val = hr, opts = {hl = 'Comment'}}, + {type = 'padding', val = 1}, + { + type = 'group', + val = { + them.button('e', '󰈔 new', [[ene startinsert]]), + them.button('r', '󰈸 live grep', [[lua require('misc').live_grep()]]), + them.button('f', '󰝰 find files', [[lua require('misc').find_files()]]), + them.button('m', '󰥔 mru', [[lua require('telescope.builtin').oldfiles()]]), + them.button('t', '󰗇 tasks', [[lua require('packer').loader('orgmode.nvim'); require('orgmode').action('agenda.todos')]]), + them.button('a', '󰃶 agenda', [[lua require('packer').loader('orgmode.nvim'); require('orgmode').action('agenda.agenda')]]), + them.button('u', '󰚰 update plugins', [[lua require('packer').sync()]]), + } + }, + {type = 'padding', val = 1}, + {type = 'text', val = function() return ' ❱ ' .. vim.loop.cwd() end, opts = {hl = 'Title'}}, + {type = 'padding', val = 1}, + { + type = 'group', + val = function() + local cwd = vim.loop.cwd() + local oldfiles = {} + for _, v in pairs(vim.v.oldfiles) do + if #oldfiles == 10 then break end + if vim.startswith(v, cwd) then + oldfiles[#oldfiles+1] = v + end + end + local val = {} + for i, fn in pairs(oldfiles) do + local shortfn = vim.fn.fnamemodify(fn, ':.') + val[#val+1] = them.button(tostring(i-1), shortfn, ":e " .. fn .. " ") + end + return val + end, + }, + {type = 'padding', val = 1}, + {type = 'text', val = hr, opts = {hl = 'Comment'}}, + {type = 'padding', val = 1}, + { + type = 'group', + val = { + them.button('q', 'quit', [[:quit]]), + }, + }, + } + alpha.setup(them.opts) + augroup { - startify = {{ 'FileType', 'startify', [[ IndentBlanklineDisable ]] }} + alpha_indent = { + { 'FileType', 'alpha', [[ IndentBlanklineDisable ]] }, + } } end} -- }}} -- cgit 1.4.1