Skip to content

Commit

Permalink
feat(hyper): add option to use ordered shortcut
Browse files Browse the repository at this point in the history
  • Loading branch information
kuntau committed Jul 1, 2024
1 parent 69a4c93 commit 1783ac8
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
2 changes: 2 additions & 0 deletions lua/dashboard/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ local function default_options()
theme = 'hyper',
disable_move = false,
shortcut_type = 'letter',
shuffle_letter = false,
buffer_name = 'Dashboard',
change_to_vcs_root = false,
config = {
Expand Down Expand Up @@ -190,6 +191,7 @@ function db:load_theme(opts)
winid = self.winid,
confirm_key = opts.confirm_key or nil,
shortcut_type = opts.shortcut_type,
shuffle_letter = opts.shuffle_letter,
change_to_vcs_root = opts.change_to_vcs_root,
})

Expand Down
5 changes: 3 additions & 2 deletions lua/dashboard/theme/hyper.lua
Original file line number Diff line number Diff line change
Expand Up @@ -216,6 +216,7 @@ end
local function letter_hotkey(config)
-- Reserve j, k keys to move up and down.
local list = { 106, 107 }
local shuffle = config.shuffle_letter

for _, item in pairs(config.shortcut or {}) do
if item.key then
Expand All @@ -234,7 +235,7 @@ local function letter_hotkey(config)
end
end

shuffle_table(unused_keys)
if shuffle then shuffle_table(unused_keys) end

local unused_uppercase_keys = {}
-- A - Z
Expand All @@ -244,7 +245,7 @@ local function letter_hotkey(config)
end
end

shuffle_table(unused_uppercase_keys)
if shuffle then shuffle_table(unused_uppercase_keys) end

-- Push shuffled uppercase keys after the lowercase ones
for _, key in pairs(unused_uppercase_keys) do
Expand Down

0 comments on commit 1783ac8

Please sign in to comment.