1
0
mirror of https://github.com/SpaceVim/SpaceVim.git synced 2025-01-23 12:50:04 +08:00

perf(guide): add guide offset, len = 8

This commit is contained in:
wsdjeg 2023-07-01 21:55:58 +08:00
parent 3a6e3d9c88
commit 1014b85f50

View File

@ -316,11 +316,12 @@ function! s:create_string(layout) abort " {{{
let col = 0 let col = 0
let smap = sort(filter(keys(s:lmap), 'v:val !=# "name"'), function('s:compare_key')) let smap = sort(filter(keys(s:lmap), 'v:val !=# "name"'), function('s:compare_key'))
for k in smap for k in smap
let offset = repeat(' ', 8 - strlen(k))
let desc = type(s:lmap[k]) == type({}) ? s:lmap[k].name : s:lmap[k][1] let desc = type(s:lmap[k]) == type({}) ? s:lmap[k].name : s:lmap[k][1]
if g:spacevim_leader_guide_theme == 'whichkey' if g:spacevim_leader_guide_theme == 'whichkey'
let displaystring = k .' -> '.desc let displaystring = offset . k .' -> '.desc
else else
let displaystring = '['. k .'] '.desc let displaystring = offset . '['. k .'] '.desc
endif endif
let crow = get(rows, row, []) let crow = get(rows, row, [])
if empty(crow) if empty(crow)