Skip to content

Commit 25c29b8

Browse files
committed
Make it less functional
vimscript is boring
1 parent 5f114c3 commit 25c29b8

File tree

1 file changed

+6
-19
lines changed

1 file changed

+6
-19
lines changed

plugin/acid.vim

Lines changed: 6 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -30,32 +30,19 @@ function! AcidShorthand(callback, shorthand)
3030
exec a:callback s:ret
3131
endfunction
3232

33-
function! s:not_in(path, pattern)
34-
return a:path !~ a:pattern
35-
endfunction
36-
37-
function! s:all_true(pred)
38-
for i in a:pred
39-
if !i
40-
return 0
41-
endif
42-
endfor
43-
endfunction
44-
45-
function! s:path_to_pattern(paths)
46-
return map(a:paths, '".*" . v:val . ".*"')
47-
endfunction
48-
4933
function! s:require()
50-
let path = expand("%")
51-
5234
if exists("g:acid_alt_test_paths")
5335
let test_paths = add(g:acid_alt_test_paths, "test")
5436
else
5537
let test_paths = ["test"]
5638
endif
5739

58-
if exists(':AcidRequire') && s:all_true(map(s:path_to_pattern(test_paths), function('s:not_in', [path])))
40+
if exists(':AcidRequire')
41+
for test_path in test_paths
42+
if expand("%") !~ ".*".test_path.".*"
43+
return
44+
endfor
45+
5946
AcidRequire
6047
endif
6148
endfunction

0 commit comments

Comments
 (0)