From 30c34008f5b21e958bf605473b253c8b1b9e82c4 Mon Sep 17 00:00:00 2001 From: wsdjeg Date: Sat, 13 May 2017 22:31:51 +0800 Subject: [PATCH] Theme support in mapping guide --- autoload/SpaceVim/mapping/guide.vim | 6 +----- autoload/SpaceVim/mapping/guide/theme.vim | 17 +++++++++++++++++ .../SpaceVim/mapping/guide/theme/gruvbox.vim | 7 +++++++ 3 files changed, 25 insertions(+), 5 deletions(-) create mode 100644 autoload/SpaceVim/mapping/guide/theme.vim create mode 100644 autoload/SpaceVim/mapping/guide/theme/gruvbox.vim diff --git a/autoload/SpaceVim/mapping/guide.vim b/autoload/SpaceVim/mapping/guide.vim index 4a5294bb7..b97cf36fe 100644 --- a/autoload/SpaceVim/mapping/guide.vim +++ b/autoload/SpaceVim/mapping/guide.vim @@ -399,11 +399,7 @@ function! s:winopen() " {{{ endfunction " }}} function! s:updateStatusline() abort - hi! LeaderGuiderPrompt cterm=bold gui=bold guifg=#282828 guibg=#a89984 - hi! LeaderGuiderSep1 cterm=bold gui=bold guifg=#a89984 guibg=#504945 - hi! LeaderGuiderName cterm=bold gui=bold guifg=#a89984 guibg=#504945 - hi! LeaderGuiderSep2 cterm=bold gui=bold guifg=#504945 guibg=#3c3836 - hi! LeaderGuiderFill guifg=#a89984 guibg=#3c3836 + call SpaceVim#mapping#guide#theme#hi() let gname = get(s:guide_group, 'name', '') if !empty(gname) let gname = ' - ' . gname[1:] diff --git a/autoload/SpaceVim/mapping/guide/theme.vim b/autoload/SpaceVim/mapping/guide/theme.vim new file mode 100644 index 000000000..ca14218c7 --- /dev/null +++ b/autoload/SpaceVim/mapping/guide/theme.vim @@ -0,0 +1,17 @@ +function! SpaceVim#mapping#guide#theme#hi() abort + let name = get(g:, 'color_name', 'gruvbox') + try + let t = SpaceVim#mapping#guide#theme#{name}#template() + catch /^Vim\%((\a\+)\)\=:E117/ + let t = SpaceVim#mapping#guide#theme#gruvbox#templete() + endtry + call s:hi(t) +endfunction + +function! s:hi(t) abort + exe 'hi! LeaderGuiderPrompt cterm=bold gui=bold guifg=' . a:t[0][0] . ' guibg=' . a:t[0][1] + exe 'hi! LeaderGuiderSep1 cterm=bold gui=bold guifg=' . a:t[0][1] . ' guibg=' . a:t[1][1] + exe 'hi! LeaderGuiderName cterm=bold gui=bold guifg=' . a:t[1][0] . ' guibg=' . a:t[1][1] + exe 'hi! LeaderGuiderSep2 cterm=bold gui=bold guifg=' . a:t[1][1] . ' guibg=' . a:t[2][1] + exe 'hi! LeaderGuiderFill guifg=' . a:t[2][0] . ' guibg=' . a:t[2][1] +endfunction diff --git a/autoload/SpaceVim/mapping/guide/theme/gruvbox.vim b/autoload/SpaceVim/mapping/guide/theme/gruvbox.vim new file mode 100644 index 000000000..3808272d2 --- /dev/null +++ b/autoload/SpaceVim/mapping/guide/theme/gruvbox.vim @@ -0,0 +1,7 @@ +function! SpaceVim#mapping#guide#theme#gruvbox#template() abort + return [ + \ ['#282828', '#a89984'], + \ ['#a89984', '#504945'], + \ ['#a89984', '#3c3836'] + \ ] +endfunction