File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11" Vim plugin file
22" Language: JS Lib syntax loader
33" Maintainer: othree <othree@gmail.com>
4- " Last Change: 2013/02/06
5- " Version: 0.1
4+ " Last Change: 2013/02/20
5+ " Version: 0.2
66" URL: https://github.com/othree/javascript-libraries-syntax.vim
77
88autocmd FileType javascript call LoadLibs (expand (' <sfile>:p:h' ))
99autocmd FileType coffee call LoadLibs (expand (' <sfile>:p:h' ))
1010autocmd FileType ls call LoadLibs (expand (' <sfile>:p:h' ))
1111
1212function ! LoadLibs (path )
13- exe (' source ' .a: path .' /syntax/jquery.vim' )
14- exe (' source ' .a: path .' /syntax/underscore.vim' )
15- exe (' source ' .a: path .' /syntax/backbone.vim' )
16- exe (' source ' .a: path .' /syntax/prelude.vim' )
17- exe (' source ' .a: path .' /syntax/postprocess.vim' )
13+ if exists (' b:javascript_libraries_syntax' )
14+ return
15+ endif
16+ let b: javascript_libraries_syntax = 1
17+
18+ let libs = [' jquery' , ' underscore' , ' backbone' , ' prelude' ]
19+ if ! exists (' g:used_javascript_libs' )
20+ let g: used_javascript_libs = join (libs, ' ,' )
21+ endif
22+
23+ let index = 0
24+ while index < len (libs)
25+ let lib = libs[index ]
26+ if g: used_javascript_libs = ~ lib
27+ exe (' source ' .a: path .' /syntax/' .lib.' .vim' )
28+ endif
29+ let index = index + 1
30+ endwhile
31+ exe (' source ' .a: path .' /syntax/postprocess.vim' )
1832endfunction
1933
You can’t perform that action at this time.
0 commit comments