Created
February 15, 2015 07:08
-
-
Save haya14busa/cb78147229dfde98a5e6 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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