spacevim/bundle/vim-over/autoload/vital/_over/Unlocker/Holder.vim
JIe 2bb7059579
Some checks failed
Detach Plugins / check (FlyGrep.vim) (push) Has been cancelled
Detach Plugins / check (GitHub.vim) (push) Has been cancelled
Detach Plugins / check (JavaUnit.vim) (push) Has been cancelled
Detach Plugins / check (SourceCounter.vim) (push) Has been cancelled
Detach Plugins / check (cpicker.nvim) (push) Has been cancelled
Detach Plugins / check (dein-ui.vim) (push) Has been cancelled
Detach Plugins / check (git.vim) (push) Has been cancelled
Detach Plugins / check (iedit.vim) (push) Has been cancelled
Detach Plugins / check (scrollbar.vim) (push) Has been cancelled
Detach Plugins / check (vim-chat) (push) Has been cancelled
Detach Plugins / check (vim-cheat) (push) Has been cancelled
Detach Plugins / check (vim-todo) (push) Has been cancelled
Detach Plugins / check (xmake.vim) (push) Has been cancelled
test / Linux (nvim, nightly) (push) Has been cancelled
test / Linux (nvim, v0.3.8) (push) Has been cancelled
test / Linux (nvim, v0.4.0) (push) Has been cancelled
test / Linux (nvim, v0.4.2) (push) Has been cancelled
test / Linux (nvim, v0.4.3) (push) Has been cancelled
test / Linux (nvim, v0.4.4) (push) Has been cancelled
test / Linux (nvim, v0.5.0) (push) Has been cancelled
test / Linux (nvim, v0.5.1) (push) Has been cancelled
test / Linux (nvim, v0.6.0) (push) Has been cancelled
test / Linux (nvim, v0.6.1) (push) Has been cancelled
test / Linux (nvim, v0.7.0) (push) Has been cancelled
test / Linux (nvim, v0.7.2) (push) Has been cancelled
test / Linux (nvim, v0.8.0) (push) Has been cancelled
test / Linux (nvim, v0.8.1) (push) Has been cancelled
test / Linux (nvim, v0.8.2) (push) Has been cancelled
test / Linux (nvim, v0.8.3) (push) Has been cancelled
test / Linux (nvim, v0.9.0) (push) Has been cancelled
test / Linux (nvim, v0.9.1) (push) Has been cancelled
test / Linux (true, vim, v7.4.052) (push) Has been cancelled
test / Linux (true, vim, v7.4.1689) (push) Has been cancelled
test / Linux (true, vim, v7.4.629) (push) Has been cancelled
test / Linux (true, vim, v8.0.0027) (push) Has been cancelled
test / Linux (true, vim, v8.0.0183) (push) Has been cancelled
test / Linux (vim, nightly) (push) Has been cancelled
test / Linux (vim, v8.0.0184) (push) Has been cancelled
test / Linux (vim, v8.0.1453) (push) Has been cancelled
test / Linux (vim, v8.1.2269) (push) Has been cancelled
test / Linux (vim, v8.2.2434) (push) Has been cancelled
test / Linux (vim, v8.2.3995) (push) Has been cancelled
test / Windows (nvim, nightly) (push) Has been cancelled
test / Windows (nvim, v0.3.8) (push) Has been cancelled
test / Windows (nvim, v0.4.2) (push) Has been cancelled
test / Windows (nvim, v0.4.3) (push) Has been cancelled
test / Windows (nvim, v0.4.4) (push) Has been cancelled
test / Windows (nvim, v0.5.0) (push) Has been cancelled
test / Windows (nvim, v0.5.1) (push) Has been cancelled
test / Windows (nvim, v0.6.0) (push) Has been cancelled
test / Windows (nvim, v0.6.1) (push) Has been cancelled
test / Windows (nvim, v0.7.0) (push) Has been cancelled
test / Windows (nvim, v0.7.2) (push) Has been cancelled
test / Windows (nvim, v0.8.0) (push) Has been cancelled
test / Windows (nvim, v0.8.1) (push) Has been cancelled
test / Windows (nvim, v0.8.2) (push) Has been cancelled
test / Windows (nvim, v0.8.3) (push) Has been cancelled
test / Windows (nvim, v0.9.0) (push) Has been cancelled
test / Windows (nvim, v0.9.1) (push) Has been cancelled
test / Windows (vim, nightly) (push) Has been cancelled
test / Windows (vim, v7.4.1185) (push) Has been cancelled
test / Windows (vim, v7.4.1689) (push) Has been cancelled
test / Windows (vim, v8.0.0027) (push) Has been cancelled
test / Windows (vim, v8.0.1453) (push) Has been cancelled
test / Windows (vim, v8.1.2269) (push) Has been cancelled
test / Windows (vim, v8.2.2434) (push) Has been cancelled
test / Windows (vim, v8.2.3995) (push) Has been cancelled
docker / docker (push) Has been cancelled
mirror / check (coding) (push) Has been cancelled
mirror / check (gitee) (push) Has been cancelled
mirror / check (gitlab) (push) Has been cancelled
init
2024-08-21 14:17:26 +08:00

109 lines
2.7 KiB
VimL

" ___vital___
" NOTE: lines between '" ___vital___' is generated by :Vitalize.
" Do not mofidify the code nor insert new lines before '" ___vital___'
function! s:_SID() abort
return matchstr(expand('<sfile>'), '<SNR>\zs\d\+\ze__SID$')
endfunction
execute join(['function! vital#_over#Unlocker#Holder#import() abort', printf("return map({'_vital_depends': '', 'as_get_deepcopy': '', 'exists': '', 'as_set_extend': '', 'get': '', 'make': '', '_vital_loaded': ''}, \"vital#_over#function('<SNR>%s_' . v:key)\")", s:_SID()), 'endfunction'], "\n")
delfunction s:_SID
" ___vital___
scriptencoding utf-8
let s:save_cpo = &cpo
set cpo&vim
function! s:_glob(expr, dir)
let cwd = getcwd()
try
execute "lcd" fnameescape(a:dir)
return filter(split(glob(a:expr), '\n'), "!isdirectory(v:val)")
finally
execute "lcd" fnameescape(cwd)
endtry
endfunction
let s:holder_files = s:_glob("Holder/**", expand("<sfile>:h"))
function! s:_to_modulename(file)
let result = substitute(a:file, '^Holder[\/]', '', 'g')
let result = fnamemodify(result, ':r')
let result = substitute(result, '[\/]', ".", "g")
return result
endfunction
let s:holder_module_names = map(copy(s:holder_files), "s:_to_modulename(v:val)")
let s:holder_module = {}
function! s:_vital_loaded(V)
let s:V = a:V
for name in s:holder_module_names
let s:holder_module[name] = a:V.import("Unlocker.Holder." . name)
endfor
endfunction
function! s:_vital_depends()
return map(copy(s:holder_module_names), "'Unlocker.Holder.' . v:val")
endfunction
function! s:as_get_deepcopy(holder)
if has_key(a:holder, "__holder_as_get_deepcopy_get")
return a:holder
endif
let result = copy(a:holder)
let result.__holder_as_get_deepcopy_get = result.get
function! result.get()
return deepcopy(self.__holder_as_get_deepcopy_get())
endfunction
return result
endfunction
function! s:as_set_extend(holder)
if has_key(a:holder, "__holder_as_set_extend_set")
return a:holder
endif
let result = copy(a:holder)
let result.__holder_as_set_extend_set = result.set
function! result.set(value)
let result = deepcopy(extend(self.get(), a:value))
call self.__holder_as_set_extend_set(result)
endfunction
return result
endfunction
function! s:get(name)
return get(s:holder_module, a:name, {})
endfunction
function! s:exists(name)
return has_key(s:holder_module, a:name)
endfunction
function! s:make(name, ...)
let module = s:get(a:name)
if empty(module)
return {}
endif
return call(module.make, a:000, module)
endfunction
" for s:name in s:holder_module_names
" execute
" \ "function! s:" . tolower(substitute(s:name, '\.', '_', 'g')) . "(...)\n"
" \ " return call(s:" . s:name . ".make, a:000, s:" . s:name . ")\n"
" \ "endfunction\n"
" endfor
let &cpo = s:save_cpo
unlet s:save_cpo