Skip to content

Commit

Permalink
- Updated vital.
Browse files Browse the repository at this point in the history
  • Loading branch information
Shougo committed Oct 13, 2013
1 parent 7c22b2e commit ffba058
Show file tree
Hide file tree
Showing 6 changed files with 22 additions and 17 deletions.
27 changes: 20 additions & 7 deletions autoload/vital/_897c317.vim → autoload/vital/_5de2c28.vim
Original file line number Diff line number Diff line change
Expand Up @@ -145,14 +145,9 @@ function! s:_build_module(sid)
if has_key(s:loaded, a:sid)
return copy(s:loaded[a:sid])
endif
let prefix = '<SNR>' . a:sid . '_'
let funcs = s:_redir('function')
let filter_pat = '^\s*function ' . prefix
let map_pat = prefix . '\zs\w\+'
let functions = map(filter(split(funcs, "\n"),
\ 'stridx(v:val, prefix) > 0 && v:val =~# filter_pat'),
\ 'matchstr(v:val, map_pat)')
let functions = s:_get_functions(a:sid)

let prefix = '<SNR>' . a:sid . '_'
let module = {}
for func in functions
let module[func] = function(prefix . func)
Expand All @@ -175,6 +170,24 @@ function! s:_build_module(sid)
return copy(module)
endfunction

if exists('+regexpengine')
function! s:_get_functions(sid)
let funcs = s:_redir(printf("function /\\%%#=2^\<SNR>%d_", a:sid))
let map_pat = '<SNR>' . a:sid . '_\zs\w\+'
return map(split(funcs, "\n"), 'matchstr(v:val, map_pat)')
endfunction
else
function! s:_get_functions(sid)
let prefix = '<SNR>' . a:sid . '_'
let funcs = s:_redir('function')
let filter_pat = '^\s*function ' . prefix
let map_pat = prefix . '\zs\w\+'
return map(filter(split(funcs, "\n"),
\ 'stridx(v:val, prefix) > 0 && v:val =~# filter_pat'),
\ 'matchstr(v:val, map_pat)')
endfunction
endif

function! s:_redir(cmd)
let [save_verbose, save_verbosefile] = [&verbose, &verbosefile]
set verbose=0 verbosefile=
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -227,15 +227,7 @@ endfunction

" similar to Haskell's Prelude.foldr
function! s:foldr(f, init, xs)
let memo = a:init
for i in reverse(range(0, len(a:xs) - 1))
let x = a:xs[i]
let expr = substitute(a:f, 'v:val', string(x), 'g')
let expr = substitute(expr, 'v:memo', string(memo), 'g')
unlet memo
let memo = eval(expr)
endfor
return memo
return s:foldl(a:f, a:init, reverse(copy(a:xs)))
endfunction

" similar to Haskell's Prelude.fold11
Expand Down
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion autoload/vital/vimshell.vital
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
897c317
5de2c28

Vim.BufferManager
Data.List

0 comments on commit ffba058

Please sign in to comment.