Skip to content

Commit 7f7bbdf

Browse files
committed
Use script variable to locate plugin path
1 parent dfa11bd commit 7f7bbdf

5 files changed

Lines changed: 22 additions & 12 deletions

File tree

after/syntax/coffee.vim

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
" Language:
33
" Maintainer: othree <othree@gmail.com>
44
" Last Change: 2013/02/24
5-
" Version: 0.3
5+
" Version: 0.4
66
" URL: https://github.com/othree/javascript-libraries-syntax.vim
77

8-
call jslibsyntax#load(expand('<sfile>:p:h').'/../..')
8+
call jslibsyntax#load()

after/syntax/javascript.vim

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
" Language:
33
" Maintainer: othree <othree@gmail.com>
44
" Last Change: 2013/02/24
5-
" Version: 0.3
5+
" Version: 0.4
66
" URL: https://github.com/othree/javascript-libraries-syntax.vim
77

8-
call jslibsyntax#load(expand('<sfile>:p:h').'/../..')
8+
call jslibsyntax#load()

after/syntax/ls.vim

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
" Language:
33
" Maintainer: othree <othree@gmail.com>
44
" Last Change: 2013/02/24
5-
" Version: 0.3
5+
" Version: 0.4
66
" URL: https://github.com/othree/javascript-libraries-syntax.vim
77

8-
call jslibsyntax#load(expand('<sfile>:p:h').'/../..')
8+
call jslibsyntax#load()

after/syntax/typescript.vim

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
" Language:
33
" Maintainer: othree <othree@gmail.com>
44
" Last Change: 2013/02/24
5-
" Version: 0.3
5+
" Version: 0.4
66
" URL: https://github.com/othree/javascript-libraries-syntax.vim
77

8-
call jslibsyntax#load(expand('<sfile>:p:h').'/../..')
8+
call jslibsyntax#load()

autoload/jslibsyntax.vim

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,23 @@
55
" Version: 0.3
66
" URL: https://github.com/othree/javascript-libraries-syntax.vim
77

8-
function! jslibsyntax#load(path)
8+
let s:libs = [
9+
\ 'jquery',
10+
\ 'underscore',
11+
\ 'backbone',
12+
\ 'prelude',
13+
\ 'angularjs',
14+
\ 'requirejs'
15+
\ ]
16+
17+
let s:path = expand('<sfile>:p:h')
18+
19+
function! jslibsyntax#load()
920
if exists('b:javascript_libraries_syntax')
1021
return
1122
endif
1223
let b:javascript_libraries_syntax = 1
1324

14-
let s:libs = ['jquery', 'underscore', 'backbone', 'prelude', 'angularjs', 'requirejs']
1525
if !exists('g:used_javascript_libs')
1626
let g:used_javascript_libs = join(s:libs, ',')
1727
endif
@@ -25,7 +35,7 @@ function! jslibsyntax#load(path)
2535
exec('let use = b:javascript_lib_use_'.lib)
2636
endif
2737
if use
28-
let fn = a:path.'/autoload/syntax/'.lib.'.'.&filetype.'.vim'
38+
let fn = s:path.'/syntax/'.lib.'.'.&filetype.'.vim'
2939
if filereadable(fn)
3040
exe('source '.fn)
3141
let loaded = loaded + 1
@@ -34,7 +44,7 @@ function! jslibsyntax#load(path)
3444
let index = index + 1
3545
endwhile
3646
if loaded > 0
37-
exe('source '.a:path.'/autoload/syntax/postprocess.vim')
47+
exe('source '.s:path.'/syntax/postprocess.vim')
3848
endif
3949
endfunction
4050

0 commit comments

Comments
 (0)