@@ -77,14 +77,42 @@ return {
7777 opts = function ()
7878 local dashboard = require " alpha.themes.dashboard"
7979
80- local orig_button = dashboard .button -- customize button function
81- dashboard .button = function (...)
82- return vim .tbl_deep_extend (" force" , orig_button (... ), {
83- opts = { cursor = - 2 , width = 36 , hl = " DashboardCenter" , hl_shortcut = " DashboardShortcut" },
84- })
85- end
8680 dashboard .leader = " LDR"
8781
82+ --- @param sc string
83+ --- @param txt string
84+ --- @param keybind string ? optional
85+ --- @param keybind_opts table ? optional
86+ dashboard .button = function (sc , txt , keybind , keybind_opts )
87+ -- HACK: fixes leader customization, remove after fixed upstream
88+ -- https://github.com/goolord/alpha-nvim/pull/271
89+ local sc_ = sc :gsub (" %s" , " " ):gsub (dashboard .leader , " <leader>" )
90+
91+ return {
92+ type = " button" ,
93+ val = txt ,
94+ on_press = function ()
95+ local key = vim .api .nvim_replace_termcodes (keybind or sc_ .. " <Ignore>" , true , false , true )
96+ vim .api .nvim_feedkeys (key , " t" , false )
97+ end ,
98+ opts = {
99+ position = " center" ,
100+ shortcut = sc ,
101+ cursor = - 2 ,
102+ width = 36 ,
103+ align_shortcut = " right" ,
104+ hl = " DashboardCenter" ,
105+ hl_shortcut = " DashboardShortcut" ,
106+ keymap = keybind and {
107+ " n" ,
108+ sc_ ,
109+ keybind ,
110+ vim .F .if_nil (keybind_opts , { noremap = true , silent = true , nowait = true }),
111+ },
112+ },
113+ }
114+ end
115+
88116 dashboard .section .header .val = {
89117 " █████ ███████ ████████ ██████ ██████" ,
90118 " ██ ██ ██ ██ ██ ██ ██ ██" ,
0 commit comments