From 8865fcbb23f289d17102c7f593e1ef90c630884d Mon Sep 17 00:00:00 2001 From: Tim Pope Date: Wed, 5 Dec 2012 13:16:10 -0500 Subject: [PATCH] Leverage classpath#split from ns completion --- plugin/foreplay.vim | 22 ++++++++++------------ 1 file changed, 10 insertions(+), 12 deletions(-) diff --git a/plugin/foreplay.vim b/plugin/foreplay.vim index ae39745..1c2188d 100644 --- a/plugin/foreplay.vim +++ b/plugin/foreplay.vim @@ -46,19 +46,17 @@ endfunction function! foreplay#ns_complete(A, L, P) abort let matches = [] - for pattern in split(&path, ',') - for dir in split(glob(pattern, 1), "\n") - if dir =~# '\.jar$' && executable('zipinfo') - let files = split(system('zipinfo -1 '.shellescape(dir).' "*.clj"'), "\n") - if v:shell_error - let files = [] - endif - else - let files = split(glob(dir."/**/*.clj", 1), "\n") - call map(files, 'v:val[strlen(dir)+1 : -1]') + for dir in classpath#split(classpath#from_vim(&path)) + if dir =~# '\.jar$' && executable('zipinfo') + let files = split(system('zipinfo -1 '.shellescape(dir).' "*.clj"'), "\n") + if v:shell_error + let files = [] endif - let matches += files - endfor + else + let files = split(glob(dir."/**/*.clj", 1), "\n") + call map(files, 'v:val[strlen(dir)+1 : -1]') + endif + let matches += files endfor return filter(map(matches, 's:tons(v:val)'), 'a:A ==# "" || a:A ==# v:val[0 : strlen(a:A)-1]') endfunction