mirror of
https://github.com/osyo-manga/vim-brightest.git
synced 2025-11-18 08:23:42 -05:00
Fix vital.
This commit is contained in:
@@ -1,3 +1,18 @@
|
||||
" ___vital___
|
||||
" NOTE: lines between '" ___vital___' is generated by :Vitalize.
|
||||
" Do not mofidify the code nor insert new lines before '" ___vital___'
|
||||
if v:version > 703 || v:version == 703 && has('patch1170')
|
||||
function! vital#_brightest#Coaster#Highlight#import() abort
|
||||
return map({'highlight': '', 'clear': '', 'delete': '', 'add': '', 'as_windo': '', '_vital_depends': '', 'get_hl_id': '', 'to_list': '', 'clear_all': '', 'delete_all': '', 'to_list_by': '', 'update': '', 'enable': '', 'delete_by': '', 'hl_list': '', 'make': '', 'enable_list': '', 'update_all': '', 'disable': '', 'disable_all': '', 'is_enabled': '', 'enable_all': '', 'is_added': '', '_vital_loaded': ''}, 'function("s:" . v:key)')
|
||||
endfunction
|
||||
else
|
||||
function! s:_SID() abort
|
||||
return matchstr(expand('<sfile>'), '<SNR>\zs\d\+\ze__SID$')
|
||||
endfunction
|
||||
execute join(['function! vital#_brightest#Coaster#Highlight#import() abort', printf("return map({'highlight': '', 'clear': '', 'delete': '', 'add': '', 'as_windo': '', '_vital_depends': '', 'get_hl_id': '', 'to_list': '', 'clear_all': '', 'delete_all': '', 'to_list_by': '', 'update': '', 'enable': '', 'delete_by': '', 'hl_list': '', 'make': '', 'enable_list': '', 'update_all': '', 'disable': '', 'disable_all': '', 'is_enabled': '', 'enable_all': '', 'is_added': '', '_vital_loaded': ''}, \"function('<SNR>%s_' . v:key)\")", s:_SID()), 'endfunction'], "\n")
|
||||
delfunction s:_SID
|
||||
endif
|
||||
" ___vital___
|
||||
scriptencoding utf-8
|
||||
let s:save_cpo = &cpo
|
||||
set cpo&vim
|
||||
@@ -23,12 +38,17 @@ endfunction
|
||||
let s:base = {
|
||||
\ "variables" : {
|
||||
\ "hl_list" : {},
|
||||
\ "id_list" : {}
|
||||
\ "id_list" : {},
|
||||
\ "id_count" : 0
|
||||
\ }
|
||||
\}
|
||||
|
||||
|
||||
function! s:base.add(name, group, pattern, ...)
|
||||
if a:name == ""
|
||||
let self.variables.id_count += 1
|
||||
return self.add(self.variables.id_count, a:group, a:pattern, get(a:, 1, 10))
|
||||
endif
|
||||
call self.delete(a:name)
|
||||
let priority = get(a:, 1, 10)
|
||||
let self.variables.hl_list[a:name] = {
|
||||
@@ -37,6 +57,7 @@ function! s:base.add(name, group, pattern, ...)
|
||||
\ "priority" : priority,
|
||||
\ "name" : a:name,
|
||||
\ }
|
||||
return self.variables.hl_list[a:name]
|
||||
endfunction
|
||||
|
||||
|
||||
@@ -165,8 +186,9 @@ endfunction
|
||||
|
||||
function! s:base.highlight(name, group, pattern, ...)
|
||||
let priority = get(a:, 1, 10)
|
||||
call self.add(a:name, a:group, a:pattern, priority)
|
||||
call self.enable(a:name)
|
||||
let result = self.add(a:name, a:group, a:pattern, priority)
|
||||
call self.enable(result.name)
|
||||
return result
|
||||
endfunction
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user