mirror of
https://github.com/osyo-manga/vim-brightest.git
synced 2025-11-17 16:03:41 -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#Buffer#import() abort
|
||||
return map({'get_text_line_from_lnum': '', 'setbufline': '', 'pos_less_equal': '', 'execute': '', 'get_line_from_region': '', 'new_temp': '', 'delete': '', 'get_block_from_region': '', 'new': '', 'paste': '', '_vital_depends': '', 'setbufline_if_python': '', 'get_text_from_latest_yank': '', 'get': '', 'get_text_from_region': '', 'as_wise_key': '', 'yank': '', 'get_line_from_pos': '', 'current': '', 'get_region_from_textobj': '', 'get_text_from_pattern': '', 'get_char_from_region': '', 'paste_for_text': '', 'open': '', '_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#Buffer#import() abort', printf("return map({'get_text_line_from_lnum': '', 'setbufline': '', 'pos_less_equal': '', 'execute': '', 'get_line_from_region': '', 'new_temp': '', 'delete': '', 'get_block_from_region': '', 'new': '', 'paste': '', '_vital_depends': '', 'setbufline_if_python': '', 'get_text_from_latest_yank': '', 'get': '', 'get_text_from_region': '', 'as_wise_key': '', 'yank': '', 'get_line_from_pos': '', 'current': '', 'get_region_from_textobj': '', 'get_text_from_pattern': '', 'get_char_from_region': '', 'paste_for_text': '', 'open': '', '_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
|
||||
@@ -311,6 +326,16 @@ function! s:new(...)
|
||||
endfunction
|
||||
|
||||
|
||||
function! s:new_temp(...)
|
||||
let name = get(a:, 1, "")
|
||||
execute "new" name
|
||||
let buffer = s:current()
|
||||
setlocal bufhidden=hide buftype=nofile noswapfile nobuflisted
|
||||
quit
|
||||
return buffer
|
||||
endfunction
|
||||
|
||||
|
||||
function! s:open(cmd)
|
||||
let buffer = s:new()
|
||||
call buffer.open(a:cmd)
|
||||
|
||||
@@ -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#Buffer#Object#import() abort
|
||||
return map({'make': ''}, '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#Buffer#Object#import() abort', printf("return map({'make': ''}, \"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
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
|
||||
@@ -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#Search#import() abort
|
||||
return map({'region': '', '_vital_depends': '', 'pos_ignore_syntaxes': '', 'pattern_by_range': '', 'pattern_in_region': '', 'pattern_in_region_char': '', 'pattern_in_region_block': '', 'pattern_in_region_line': '', 'region_pair': '', 'pattern_in_range': '', 'count': '', 'text_by_pattern': '', '_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#Search#import() abort', printf("return map({'region': '', '_vital_depends': '', 'pos_ignore_syntaxes': '', 'pattern_by_range': '', 'pattern_in_region': '', 'pattern_in_region_char': '', 'pattern_in_region_block': '', 'pattern_in_region_line': '', 'region_pair': '', 'pattern_in_range': '', 'count': '', 'text_by_pattern': '', '_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
|
||||
@@ -39,11 +54,29 @@ function! s:pattern_in_region_char(first, last, pattern)
|
||||
else
|
||||
return printf('\%%%dl\%%(%s\M\)\%%>%dc', a:first[0], a:pattern, a:first[1]-1)
|
||||
\ . "\\|" . printf('\%%>%dl\%%(%s\M\)\%%<%dl', a:first[0], a:pattern, a:last[0])
|
||||
\ . >"\\|" . printf('\%%%dl\%%(%s\M\)\%%<%dc', a:last[0], a:pattern, a:last[1]+1)
|
||||
\ . "\\|" . printf('\%%%dl\%%(%s\M\)\%%<%dc', a:last[0], a:pattern, a:last[1]+1)
|
||||
endif
|
||||
endfunction
|
||||
|
||||
|
||||
" function! s:pattern_in_region_char(first, last, pattern)
|
||||
" if a:first == a:last
|
||||
" return printf('\%%%dl\%%%dv', a:first[0], a:first[1])
|
||||
" elseif a:first[0] == a:last[0]
|
||||
" return printf('\%%%dl\%%>%dv\%%(%s\M\)\%%<%dv', a:first[0], a:first[1]-1, a:pattern, a:last[1]+1)
|
||||
" elseif a:last[0] - a:first[0] == 1
|
||||
" return printf('\%%%dl\%%(%s\M\)\%%>%dv', a:first[0], a:pattern, a:first[1]-1)
|
||||
" \ . "\\|" . printf('\%%%dl\%%(%s\M\)\%%<%dv', a:last[0], a:pattern, a:last[1]+1)
|
||||
" else
|
||||
" return printf('\%%%dl\%%(%s\M\)\%%>%dv', a:first[0], a:pattern, a:first[1]-1)
|
||||
" \ . "\\|" . printf('\%%>%dl\%%(%s\M\)\%%<%dl', a:first[0], a:pattern, a:last[0])
|
||||
" \ . "\\|" . printf('\%%%dl\%%(%s\M\)\%%<%dv', a:last[0], a:pattern, a:last[1]+1)
|
||||
" endif
|
||||
" endfunction
|
||||
|
||||
|
||||
|
||||
|
||||
function! s:pattern_in_region_line(first, last, pattern)
|
||||
return printf('\%%>%dl\%%(%s\M\)\%%<%dl', a:first[0]-1, a:pattern, a:last[0]+1)
|
||||
endfunction
|
||||
|
||||
@@ -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#Window#import() abort
|
||||
return map({'as_windo': '', '_vital_depends': '', 'windo': '', '_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#Window#import() abort', printf("return map({'as_windo': '', '_vital_depends': '', 'windo': '', '_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
|
||||
|
||||
Reference in New Issue
Block a user