Skip to content

Commit

Permalink
feat(doom): configurable key_format property (#396)
Browse files Browse the repository at this point in the history
  • Loading branch information
minusfive authored Oct 18, 2023
1 parent fd68b9d commit 590ac61
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
3 changes: 3 additions & 0 deletions doc/dashboard.txt
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,7 @@ when use `doom` theme the available options in `config` is
desc_hl = 'group',
key = 'shortcut key in dashboard buffer not keymap !!',
key_hl = 'group',
key_format = ' [%s]', -- `%s` will be substituted with value of `key`
action = '',
},
},
Expand Down Expand Up @@ -224,13 +225,15 @@ Doom ~
key = 'b',
keymap = 'SPC f f',
key_hl = 'Number',
key_format = ' %s', -- remove default surrounding `[]`
action = 'lua print(2)'
},
{
icon = ' ',
desc = 'Find Dotfiles',
key = 'f',
keymap = 'SPC f d',
key_format = ' %s', -- remove default surrounding `[]`
action = 'lua print(3)'
},
},
Expand Down
8 changes: 4 additions & 4 deletions lua/dashboard/theme/doom.lua
Original file line number Diff line number Diff line change
Expand Up @@ -94,10 +94,10 @@ local function generate_center(config)
if config.center[idx].keymap then
table.insert(virt_tbl, { config.center[idx].keymap, 'DashboardShortCut' })
end
table.insert(
virt_tbl,
{ ' [' .. config.center[idx].key .. ']', config.center[idx].key_hl or 'DashboardKey' }
)
table.insert(virt_tbl, {
string.format(config.center[idx].key_format or ' [%s]', config.center[idx].key),
config.center[idx].key_hl or 'DashboardKey',
})
api.nvim_buf_set_extmark(config.bufnr, ns, first_line + i - 1, 0, {
virt_text_pos = 'eol',
virt_text = virt_tbl,
Expand Down

0 comments on commit 590ac61

Please sign in to comment.