summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--.vim/lua/colors.lua2
-rw-r--r--.vim/lua/plugins.lua85
2 files changed, 85 insertions, 2 deletions
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',            [[<cmd>ene <bar> startinsert<cr>]]),
+            them.button('r', '󰈸  live grep',      [[<cmd>lua require('misc').live_grep()<cr>]]),
+            them.button('f', '󰝰  find files',     [[<cmd>lua require('misc').find_files()<cr>]]),
+            them.button('m', '󰥔  mru',            [[<cmd>lua require('telescope.builtin').oldfiles()<cr>]]),
+            them.button('t', '󰗇  tasks',          [[<cmd>lua require('packer').loader('orgmode.nvim'); require('orgmode').action('agenda.todos')<cr>]]),
+            them.button('a', '󰃶  agenda',         [[<cmd>lua require('packer').loader('orgmode.nvim'); require('orgmode').action('agenda.agenda')<cr>]]),
+            them.button('u', '󰚰  update plugins', [[<cmd>lua require('packer').sync()<cr>]]),
+          }
+        },
+        {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 .. " <cr>")
+            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<cr>]]),
+          },
+        },
+      }
+      alpha.setup(them.opts)
+
       augroup {
-        startify = {{ 'FileType', 'startify', [[ IndentBlanklineDisable ]] }}
+        alpha_indent = {
+          { 'FileType', 'alpha', [[ IndentBlanklineDisable ]] },
+        }
       }
     end} -- }}}