Skip to content

Commit 7621616

Browse files
committed
New structure for lazy loading
1 parent db744c7 commit 7621616

4 files changed

Lines changed: 30 additions & 9 deletions

File tree

after/syntax/coffee.vim

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
" Vim plugin file
2+
" Language:
3+
" Maintainer: othree <othree@gmail.com>
4+
" Last Change: 2013/02/24
5+
" Version: 0.3
6+
" URL: https://github.com/othree/javascript-libraries-syntax.vim
7+
8+
call jslibsyntax#load(expand('<sfile>:p:h').'/../..')

after/syntax/javascript.vim

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
" Vim plugin file
2+
" Language:
3+
" Maintainer: othree <othree@gmail.com>
4+
" Last Change: 2013/02/24
5+
" Version: 0.3
6+
" URL: https://github.com/othree/javascript-libraries-syntax.vim
7+
8+
call jslibsyntax#load(expand('<sfile>:p:h').'/../..')

after/syntax/ls.vim

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
" Vim plugin file
2+
" Language:
3+
" Maintainer: othree <othree@gmail.com>
4+
" Last Change: 2013/02/24
5+
" Version: 0.3
6+
" URL: https://github.com/othree/javascript-libraries-syntax.vim
7+
8+
call jslibsyntax#load(expand('<sfile>:p:h').'/../..')
Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,11 @@
11
" Vim plugin file
22
" Language: JS Lib syntax loader
33
" Maintainer: othree <othree@gmail.com>
4-
" Last Change: 2013/02/20
5-
" Version: 0.2
4+
" Last Change: 2013/02/24
5+
" Version: 0.3
66
" URL: https://github.com/othree/javascript-libraries-syntax.vim
77

8-
autocmd FileType javascript call LoadLibs(expand('<sfile>:p:h'))
9-
autocmd FileType coffee call LoadLibs(expand('<sfile>:p:h'))
10-
autocmd FileType ls call LoadLibs(expand('<sfile>:p:h'))
11-
12-
function! LoadLibs(path)
8+
function! jslibsyntax#load(path)
139
if exists('b:javascript_libraries_syntax')
1410
return
1511
endif
@@ -25,7 +21,8 @@ function! LoadLibs(path)
2521
while index < len(libs)
2622
let lib = libs[index]
2723
if g:used_javascript_libs =~ lib
28-
let fn = a:path.'/../autoload/syntax/'.lib.'.vim'
24+
let fn = a:path.'/autoload/syntax/'.lib.'.vim'
25+
echom fn
2926
if filereadable(fn)
3027
exe('source '.fn)
3128
let loaded = loaded + 1
@@ -34,7 +31,7 @@ function! LoadLibs(path)
3431
let index = index + 1
3532
endwhile
3633
if loaded > 0
37-
exe('source '.a:path.'/../autoload/syntax/postprocess.vim')
34+
exe('source '.a:path.'/autoload/syntax/postprocess.vim')
3835
endif
3936
endfunction
4037

0 commit comments

Comments
 (0)