mirror of
https://github.com/SpaceVim/SpaceVim.git
synced 2025-02-03 00:20:05 +08:00
Add vim#highlight api
This commit is contained in:
parent
4a6f11146d
commit
13b9bd1e40
23
autoload/SpaceVim/api/vim/highlight.vim
Normal file
23
autoload/SpaceVim/api/vim/highlight.vim
Normal file
@ -0,0 +1,23 @@
|
||||
let s:self = {}
|
||||
|
||||
function! s:self.group2dict(name) abort
|
||||
let id = index(map(range(999), 'synIDattr(v:val, "name")'), a:name)
|
||||
if id == -1
|
||||
return {}
|
||||
endif
|
||||
let rst = {
|
||||
\ 'name' : synIDattr(id, 'name'),
|
||||
\ 'ctermbg' : synIDattr(id, 'bg'),
|
||||
\ 'ctermfg' : synIDattr(id, 'fg'),
|
||||
\ 'bold' : synIDattr(id, 'bold'),
|
||||
\ 'italic' : synIDattr(id, 'italic'),
|
||||
\ 'underline' : synIDattr(id, 'underline'),
|
||||
\ 'guibg' :synIDattr(id, 'bg#'),
|
||||
\ 'guifg' : synIDattr(id, 'fg#'),
|
||||
\ }
|
||||
return rst
|
||||
endfunction
|
||||
|
||||
function! SpaceVim#api#vim#highlight#get() abort
|
||||
return deepcopy(s:self)
|
||||
endfunction
|
Loading…
Reference in New Issue
Block a user