1
0
mirror of https://github.com/SpaceVim/SpaceVim.git synced 2025-01-24 05:30:07 +08:00

Merge pull request #723 from SpaceVim/highlight

Fix #713
This commit is contained in:
Wang Shidong 2017-07-12 20:58:39 +08:00 committed by GitHub
commit d94963ab76
2 changed files with 38 additions and 29 deletions

View File

@ -3,7 +3,16 @@ let s:self = {}
function! s:self.group2dict(name) abort
let id = index(map(range(1999), "synIDattr(v:val, 'name')"), a:name)
if id == -1
return {}
return {
\ 'name' : '',
\ 'ctermbg' : '',
\ 'ctermfg' : '',
\ 'bold' : '',
\ 'italic' : '',
\ 'underline' : '',
\ 'guibg' : '',
\ 'guifg' : '',
\ }
endif
let rst = {
\ 'name' : synIDattr(id, 'name'),
@ -32,35 +41,35 @@ function! s:self.unite(base, target, part) abort
endfunction
function! s:self.hi(info) abort
if empty(a:info)
if empty(a:info) || get(a:info, 'name', '') ==# ''
return
endif
let cmd = 'hi! ' . a:info.name
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 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
let cmd = 'hi! ' . a:info.name
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 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

View File

@ -13,7 +13,7 @@ function! SpaceVim#layers#lang#python#plugins() abort
if has('nvim')
call add(plugins, ['zchee/deoplete-jedi', { 'on_ft' : 'python'}])
else
call add(plugins, ['davidhalter/jedi-vim', { 'on_ft' : 'python'}])
call add(plugins, ['davidhalter/jedi-vim', { 'on_ft' : 'python', 'if' : has('python') || has('python3')}])
endif
call add(plugins, ['Vimjas/vim-python-pep8-indent', { 'on_ft' : 'python'}])
return plugins