Skip to content

Instantly share code, notes, and snippets.

@haya14busa
Created February 15, 2015 07:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save haya14busa/cb78147229dfde98a5e6 to your computer and use it in GitHub Desktop.
Save haya14busa/cb78147229dfde98a5e6 to your computer and use it in GitHub Desktop.
let s:V = vital#of('vital')
let s:S = s:V.import('Vim.ScriptLocal')
let s:GETSFUNCNAME = '___GET_S___' . localtime()
let s:_get_s_func = [
\ printf('function! s:%s() abort', s:GETSFUNCNAME),
\ ' return s:',
\ 'endfunction',
\ ]
function! s:svars(path) abort
let sid = s:S.sid(a:path)
let fullpath = expand(s:S.scriptnames()[sid])
let lines = readfile(fullpath)
try
call writefile(s:_get_s_func, fullpath)
execute 'source' fullpath
let s = s:S.sid2sfuncs(sid)[s:GETSFUNCNAME]()
execute 'delfunction' printf("\<SNR>%d_%s", sid, s:GETSFUNCNAME)
return s
finally
call writefile(lines, fullpath)
endtry
endfunction
echo s:svars('autoload/vital/__latest__/Prelude.vim')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment