Skip to content

Commit 6e83451

Browse files
authored
feat(hyper): support multiple confirm_keys and exclude them from letter_list (#511)
* feat(hyper): support array of keys for confirm_key * feat(hyper): add confirm_key entries to used_keys array
1 parent 1955f4d commit 6e83451

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

lua/dashboard/theme/hyper.lua

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -239,6 +239,12 @@ local function letter_hotkey(config)
239239
end
240240
end
241241

242+
local confirm_keys = type(config.confirm_key) == 'table' and config.confirm_key
243+
or { config.confirm_key }
244+
for _, key in ipairs(confirm_keys) do
245+
table.insert(used_keys, key:byte())
246+
end
247+
242248
math.randomseed(os.time())
243249

244250
-- Create key table, fill it with unused characters.
@@ -538,7 +544,11 @@ local function theme_instance(config)
538544
load_packages(config)
539545
gen_center(plist, config)
540546
gen_footer(config)
541-
map_key(config, config.confirm_key or '<CR>')
547+
local confirm_keys = type(config.confirm_key) == 'table' and config.confirm_key
548+
or { config.confirm_key or '<CR>' }
549+
for _, key in ipairs(confirm_keys) do
550+
map_key(config, key)
551+
end
542552
require('dashboard.events').register_lsp_root(config.path)
543553
local size = math.floor(vim.o.lines / 2)
544554
- math.ceil(api.nvim_buf_line_count(config.bufnr) / 2)

0 commit comments

Comments
 (0)