Skip to content

Commit

Permalink
refactor!: remove alpha_button function since alpha provides it's own
Browse files Browse the repository at this point in the history
  • Loading branch information
mehalter committed Aug 15, 2023
1 parent be8c860 commit 484de60
Showing 1 changed file with 0 additions and 30 deletions.
30 changes: 0 additions & 30 deletions lua/astrocore/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -139,36 +139,6 @@ function M.toggle_term_cmd(opts)
terms[opts.cmd][num]:toggle()
end

--- Create a button entity to use with the alpha dashboard
---@param sc string The keybinding string to convert to a button
---@param txt string The explanation text of what the keybinding does
---@return table # A button entity table for an alpha configuration
function M.alpha_button(sc, txt)
-- replace <Leader> in shortcut text with LDR for nicer printing
local sc_ = sc:gsub("%s", ""):gsub("LDR", "<Leader>")
-- if the leader is set, replace the text with the actual leader key for nicer printing
if vim.g.mapleader then sc = sc:gsub("LDR", vim.g.mapleader == " " and "SPC" or vim.g.mapleader) end
-- return the button entity to display the correct text and send the correct keybinding on press
return {
type = "button",
val = txt,
on_press = function()
local key = vim.api.nvim_replace_termcodes(sc_, true, false, true)
vim.api.nvim_feedkeys(key, "normal", false)
end,
opts = {
position = "center",
text = txt,
shortcut = sc,
cursor = -2,
width = 36,
align_shortcut = "right",
hl = "DashboardCenter",
hl_shortcut = "DashboardShortcut",
},
}
end

--- Get a plugin spec from lazy
---@param plugin string The plugin to search for
---@return LazyPlugin? available # The found plugin spec from Lazy
Expand Down

0 comments on commit 484de60

Please sign in to comment.