Another copy of my dotfiles. Because I don't completely trust GitHub.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

127 lines
3.6 KiB

  1. return function()
  2. local if_nil = vim.F.if_nil
  3. local default_terminal = {
  4. type = "terminal",
  5. command = nil,
  6. width = 69,
  7. height = 8,
  8. opts = {
  9. redraw = true,
  10. window_config = {},
  11. },
  12. }
  13. local default_header = {
  14. type = "text",
  15. val = {
  16. [[ :::!~!!!!!:. ]],
  17. [[ .xUHWH!! !!?M88WHX:. ]],
  18. [[ .X*#M@$!! !X!M$$$$$$WWx:. ]],
  19. [[ :!!!!!!?H! :!$!$$$$$$$$$$8X: ]],
  20. [[ !!~ ~:~!! :~!$!#$$$$$$$$$$8X: ]],
  21. [[ :!~::!H!< ~.U$X!?R$$$$$$$$MM! ]],
  22. [[ ~!~!!!!~~ .:XW$$$U!!?$$$$$$RMM! ]],
  23. [[ !:~~~ .:!M"T#$$$$WX??#MRRMMM! ]],
  24. [[ ~?WuxiW*` `"#$$$$8!!!!??!!! ]],
  25. [[ :X- M$$$$ `"T#$T~!8$WUXU~ ]],
  26. [[ :%` ~#$$$m: ~!~ ?$$$$$$ ]],
  27. [[ :!`.- ~T$$$$8xx. .xWW- ~""##*" ]],
  28. [[..... -~~:<` ! ~?T#$$@@W@*?$$ /` ]],
  29. [[W$@@M!!! .!~~ !! .:XUW$W!~ `"~: : ]],
  30. [[#"~~`.:x%`!! !H: !WM$$$$Ti.: .!WUn+!` ]],
  31. [[:::~:!!`:X~ .: ?H.!u "$$$B$$$!W:U!T$$M~ ]],
  32. [[.~~ :X@!.-~ ?@WTWo("*$$$W$TH$! ` ]],
  33. [[Wi.~!X$?!-~ : ?$$$B$Wu("**$RM! ]],
  34. [[$R@i.~~ ! : ~$$$$$B$$en:`` ]],
  35. [[?MXT@Wx.~ : ~"##*$$$$M~ ]],
  36. },
  37. opts = {
  38. position = "center",
  39. hl = "Type",
  40. -- wrap = "overflow";
  41. },
  42. }
  43. local footer = {
  44. type = "text",
  45. val = "",
  46. opts = {
  47. position = "center",
  48. hl = "Number",
  49. },
  50. }
  51. local leader = "SPC"
  52. --- @param sc string
  53. --- @param txt string
  54. --- @param keybind string? optional
  55. --- @param keybind_opts table? optional
  56. local function button(sc, txt, keybind, keybind_opts)
  57. local sc_ = sc:gsub("%s", ""):gsub(leader, "<leader>")
  58. local opts = {
  59. position = "center",
  60. shortcut = sc,
  61. cursor = 3,
  62. width = 50,
  63. align_shortcut = "right",
  64. hl_shortcut = "Keyword",
  65. }
  66. if keybind then
  67. keybind_opts = if_nil(keybind_opts, { noremap = true, silent = true, nowait = true })
  68. opts.keymap = { "n", sc_, keybind, keybind_opts }
  69. end
  70. local function on_press()
  71. local key = vim.api.nvim_replace_termcodes(keybind or sc_ .. "<Ignore>", true, false, true)
  72. vim.api.nvim_feedkeys(key, "t", false)
  73. end
  74. return {
  75. type = "button",
  76. val = txt,
  77. on_press = on_press,
  78. opts = opts,
  79. }
  80. end
  81. local buttons = {
  82. type = "group",
  83. val = {
  84. button("e", " New file", "<cmd>ene <CR>"),
  85. button("SPC f f", "󰈞 Find file"),
  86. button("SPC f h", "󰊄 Recently opened files"),
  87. button("SPC f r", " Frecency/MRU"),
  88. button("SPC f g", "󰈬 Find word"),
  89. button("SPC f m", " Jump to bookmarks"),
  90. button("SPC s l", " Open last session"),
  91. },
  92. opts = {
  93. spacing = 1,
  94. },
  95. }
  96. local section = {
  97. terminal = default_terminal,
  98. header = default_header,
  99. buttons = buttons,
  100. footer = footer,
  101. }
  102. local config = {
  103. layout = {
  104. { type = "padding", val = 2 },
  105. section.header,
  106. { type = "padding", val = 2 },
  107. section.buttons,
  108. section.footer,
  109. },
  110. opts = {
  111. margin = 5,
  112. },
  113. }
  114. require('alpha').setup(config)
  115. end