From 7cf034217f615498d9ac46b57d2588773a51d172 Mon Sep 17 00:00:00 2001 From: wsdjeg Date: Mon, 1 May 2017 23:18:53 +0800 Subject: [PATCH] Hide in normal --- autoload/SpaceVim/api/vim/highlight.vim | 37 ++++++++++++++++++++----- autoload/SpaceVim/autocmds.vim | 5 ++-- 2 files changed, 33 insertions(+), 9 deletions(-) diff --git a/autoload/SpaceVim/api/vim/highlight.vim b/autoload/SpaceVim/api/vim/highlight.vim index 00cf16c51..9321d9850 100644 --- a/autoload/SpaceVim/api/vim/highlight.vim +++ b/autoload/SpaceVim/api/vim/highlight.vim @@ -36,26 +36,49 @@ function! s:self.hi(info) abort return endif let cmd = 'hi! ' . a:info.name - \ . ' ctermbg=' . a:info.ctermbg - \ . ' ctermfg=' . a:info.ctermfg - \ . ' guibg=' . a:info.guibg - \ . ' guifg=' . a:info.guifg + if !empty(a:info.ctermbg) + let cmd .= ' ctermbg=' . a:info.ctermbg + endif + if !empty(a:info.ctermfg) + let cmd .= ' ctermfg=' . a:info.ctermfg + endif + if !empty(a:info.guibg) + let cmd .= ' guibg=' . a:info.guibg + endif + if !empty(a:info.guifg) + let cmd .= ' guifg=' . a:info.guifg + endif let style = [] for sty in ['hold', 'italic', 'underline'] - if a:info[sty] ==# '1' + if get(a:info, sty, '') ==# '1' call add(style, sty) endif endfor - if !empty(style) let cmd .= ' gui=' . join(style, ',') . ' cterm=' . join(style, ',') endif - try exe cmd catch endtry +endfunction +function! s:self.hide_in_normal(name) abort + let group = self.group2dict(a:name) + if empty(group) + return + endif + if &termguicolors || has('gui_running') + let g:wsd = self.group2dict('Normal') + let bg = self.group2dict('Normal').guibg + let group.guifg = bg + let group.guibg = bg + else + let bg = self.group2dict('Normal').ctermbg + let group.ctermfg = bg + let group.ctermbg = bg + endif + call self.hi(group) endfunction function! SpaceVim#api#vim#highlight#get() abort diff --git a/autoload/SpaceVim/autocmds.vim b/autoload/SpaceVim/autocmds.vim index 941ad02d8..92a3085e8 100644 --- a/autoload/SpaceVim/autocmds.vim +++ b/autoload/SpaceVim/autocmds.vim @@ -104,11 +104,12 @@ endfunction function! s:fix_gruvbox() abort if &background ==# 'dark' hi VertSplit guibg=#282828 guifg=#181A1F - hi EndOfBuffer guibg=#282828 guifg=#282828 + "hi EndOfBuffer guibg=#282828 guifg=#282828 else hi VertSplit guibg=#fbf1c7 guifg=#e7e9e1 - hi EndOfBuffer guibg=#fbf1c7 guifg=#fbf1c7 + "hi EndOfBuffer guibg=#fbf1c7 guifg=#fbf1c7 endif + call SpaceVim#api#import('vim#highlight').hide_in_normal('EndOfBuffer') hi SpaceVimLeaderGuiderGroupName cterm=bold ctermfg=175 gui=bold guifg=#d3869b endfunction