utils 0.0.0
Sign up to get free protection for your applications and to get access to all the features.
- data/Rakefile +68 -0
- data/VERSION +1 -0
- data/bin/chroot-exec +12 -0
- data/bin/chroot-libs +18 -0
- data/bin/classify +37 -0
- data/bin/discover +137 -0
- data/bin/edit +74 -0
- data/bin/errf +32 -0
- data/bin/git-empty +8 -0
- data/bin/myex +90 -0
- data/bin/number_files +26 -0
- data/bin/same_files +37 -0
- data/bin/search +205 -0
- data/bin/sedit +3 -0
- data/bin/sshscreen +68 -0
- data/bin/term +21 -0
- data/bin/unquarantine_apps +8 -0
- data/bin/untest +17 -0
- data/bin/utils-install-config +10 -0
- data/bin/vacuum_firefox_sqlite +22 -0
- data/bin/xmp +74 -0
- data/lib/utils.rb +8 -0
- data/lib/utils/config.rb +23 -0
- data/lib/utils/config/gdb/asm +179 -0
- data/lib/utils/config/gdb/ruby +528 -0
- data/lib/utils/config/gdbinit +8 -0
- data/lib/utils/config/irbrc +455 -0
- data/lib/utils/config/rdebugrc +2 -0
- data/lib/utils/config/screenrc +143 -0
- data/lib/utils/config/vim/autoload/Align.vim +1029 -0
- data/lib/utils/config/vim/autoload/AlignMaps.vim +330 -0
- data/lib/utils/config/vim/autoload/rails.vim +4744 -0
- data/lib/utils/config/vim/autoload/rubycomplete.vim +801 -0
- data/lib/utils/config/vim/autoload/sqlcomplete.vim +741 -0
- data/lib/utils/config/vim/autoload/vimball.vim +750 -0
- data/lib/utils/config/vim/colors/flori.vim +113 -0
- data/lib/utils/config/vim/compiler/eruby.vim +40 -0
- data/lib/utils/config/vim/compiler/ruby.vim +67 -0
- data/lib/utils/config/vim/compiler/rubyunit.vim +34 -0
- data/lib/utils/config/vim/ftdetect/ragel.vim +2 -0
- data/lib/utils/config/vim/ftdetect/ruby.vim +17 -0
- data/lib/utils/config/vim/ftplugin/eruby.vim +100 -0
- data/lib/utils/config/vim/ftplugin/ruby.vim +260 -0
- data/lib/utils/config/vim/ftplugin/xml.vim +941 -0
- data/lib/utils/config/vim/indent/IndentAnything_html.vim +35 -0
- data/lib/utils/config/vim/indent/eruby.vim +77 -0
- data/lib/utils/config/vim/indent/javascript.vim +116 -0
- data/lib/utils/config/vim/indent/ruby.vim +377 -0
- data/lib/utils/config/vim/plugin/AlignMapsPlugin.vim +242 -0
- data/lib/utils/config/vim/plugin/AlignPlugin.vim +41 -0
- data/lib/utils/config/vim/plugin/Decho.vim +592 -0
- data/lib/utils/config/vim/plugin/IndentAnything.vim +675 -0
- data/lib/utils/config/vim/plugin/bufexplorer.vim +1144 -0
- data/lib/utils/config/vim/plugin/cecutil.vim +482 -0
- data/lib/utils/config/vim/plugin/fugitive.vim +1703 -0
- data/lib/utils/config/vim/plugin/lusty-explorer.vim +1509 -0
- data/lib/utils/config/vim/plugin/rails.vim +340 -0
- data/lib/utils/config/vim/plugin/rubyextra.vim +193 -0
- data/lib/utils/config/vim/plugin/surround.vim +628 -0
- data/lib/utils/config/vim/plugin/taglist.vim +4546 -0
- data/lib/utils/config/vim/plugin/test/IndentAnything/test.js +131 -0
- data/lib/utils/config/vim/plugin/vimballPlugin.vim +40 -0
- data/lib/utils/config/vim/syntax/Decho.vim +101 -0
- data/lib/utils/config/vim/syntax/eruby.vim +73 -0
- data/lib/utils/config/vim/syntax/javascript.vim +246 -0
- data/lib/utils/config/vim/syntax/ragel.vim +165 -0
- data/lib/utils/config/vim/syntax/ruby.vim +367 -0
- data/lib/utils/config/vimrc +461 -0
- data/lib/utils/file.rb +49 -0
- data/lib/utils/find.rb +54 -0
- data/lib/utils/md5.rb +23 -0
- data/lib/utils/patterns.rb +34 -0
- data/lib/utils/version.rb +8 -0
- data/utils.gemspec +33 -0
- metadata +183 -0
@@ -0,0 +1,131 @@
|
|
1
|
+
//
|
2
|
+
// Sample Javascript test code
|
3
|
+
//
|
4
|
+
if ( x )
|
5
|
+
x;
|
6
|
+
x = { f + // foo
|
7
|
+
q
|
8
|
+
go
|
9
|
+
}
|
10
|
+
r +
|
11
|
+
bar + call( foo +
|
12
|
+
bar
|
13
|
+
// foo
|
14
|
+
then
|
15
|
+
bar
|
16
|
+
)
|
17
|
+
ntnth // TODO: this line should be at col 0
|
18
|
+
|
19
|
+
foo = {
|
20
|
+
at : the,
|
21
|
+
bar : tender
|
22
|
+
}
|
23
|
+
|
24
|
+
|
25
|
+
r
|
26
|
+
if (foo)
|
27
|
+
// then
|
28
|
+
// do something
|
29
|
+
bar;
|
30
|
+
yo;
|
31
|
+
if (foo)
|
32
|
+
{
|
33
|
+
//
|
34
|
+
// then do something
|
35
|
+
bar;
|
36
|
+
}
|
37
|
+
if (bar)
|
38
|
+
/*
|
39
|
+
* Comment on something. Comment on something. Comment on something.
|
40
|
+
* Comment on something. Comment on something.
|
41
|
+
*
|
42
|
+
*/
|
43
|
+
yo;
|
44
|
+
foo
|
45
|
+
|
46
|
+
{
|
47
|
+
line = getline() /* comment after code but spanning multiple lines seems to
|
48
|
+
* work pretty well.
|
49
|
+
*/
|
50
|
+
foo
|
51
|
+
}
|
52
|
+
|
53
|
+
window.prototype.foo = {
|
54
|
+
a : hole,
|
55
|
+
dink : wad
|
56
|
+
}
|
57
|
+
|
58
|
+
document.getElementById(
|
59
|
+
string);
|
60
|
+
|
61
|
+
/*
|
62
|
+
* :
|
63
|
+
*/
|
64
|
+
if (go()) // do it
|
65
|
+
foo;
|
66
|
+
while (false) /* never do it */
|
67
|
+
;
|
68
|
+
|
69
|
+
|
70
|
+
/***
|
71
|
+
*
|
72
|
+
* blah
|
73
|
+
*/
|
74
|
+
|
75
|
+
|
76
|
+
switch (x) {
|
77
|
+
case 'x':
|
78
|
+
window.alert(x);
|
79
|
+
break;
|
80
|
+
default:
|
81
|
+
break;
|
82
|
+
}
|
83
|
+
|
84
|
+
foo +
|
85
|
+
//and + bar(
|
86
|
+
//another
|
87
|
+
)
|
88
|
+
r +
|
89
|
+
bar + call( foo +
|
90
|
+
bar
|
91
|
+
// foo
|
92
|
+
then
|
93
|
+
bar
|
94
|
+
)
|
95
|
+
foo
|
96
|
+
|
97
|
+
|
98
|
+
|
99
|
+
{
|
100
|
+
fuction foo() {
|
101
|
+
/* comment */
|
102
|
+
foo();
|
103
|
+
}
|
104
|
+
}
|
105
|
+
|
106
|
+
|
107
|
+
/*****************************************************************************
|
108
|
+
*
|
109
|
+
* Known broken-ness:
|
110
|
+
*
|
111
|
+
*/
|
112
|
+
|
113
|
+
if (yo) /*
|
114
|
+
* dude
|
115
|
+
*
|
116
|
+
*/
|
117
|
+
blah // this should be one level in
|
118
|
+
|
119
|
+
//
|
120
|
+
|
121
|
+
//
|
122
|
+
|
123
|
+
if (
|
124
|
+
something) /*
|
125
|
+
*/
|
126
|
+
//
|
127
|
+
// broken here. This should be one level back. But I'll argue (for now) that
|
128
|
+
// the previous comment (which causes this) is bad style.
|
129
|
+
//
|
130
|
+
|
131
|
+
|
@@ -0,0 +1,40 @@
|
|
1
|
+
" vimballPlugin : construct a file containing both paths and files
|
2
|
+
" Author: Charles E. Campbell, Jr.
|
3
|
+
" Copyright: (c) 2004-2010 by Charles E. Campbell, Jr.
|
4
|
+
" The VIM LICENSE applies to Vimball.vim, and Vimball.txt
|
5
|
+
" (see |copyright|) except use "Vimball" instead of "Vim".
|
6
|
+
" No warranty, express or implied.
|
7
|
+
" *** *** Use At-Your-Own-Risk! *** ***
|
8
|
+
"
|
9
|
+
" (Rom 2:1 WEB) Therefore you are without excuse, O man, whoever you are who
|
10
|
+
" judge. For in that which you judge another, you condemn yourself. For
|
11
|
+
" you who judge practice the same things.
|
12
|
+
" GetLatestVimScripts: 1502 1 :AutoInstall: vimball.vim
|
13
|
+
|
14
|
+
" ---------------------------------------------------------------------
|
15
|
+
" Load Once: {{{1
|
16
|
+
if &cp || exists("g:loaded_vimballPlugin")
|
17
|
+
finish
|
18
|
+
endif
|
19
|
+
let g:loaded_vimballPlugin = "v33"
|
20
|
+
let s:keepcpo = &cpo
|
21
|
+
set cpo&vim
|
22
|
+
|
23
|
+
" ------------------------------------------------------------------------------
|
24
|
+
" Public Interface: {{{1
|
25
|
+
com! -ra -complete=file -na=+ -bang MkVimball call vimball#MkVimball(<line1>,<line2>,<bang>0,<f-args>)
|
26
|
+
com! -na=? -complete=dir UseVimball call vimball#Vimball(1,<f-args>)
|
27
|
+
com! -na=0 VimballList call vimball#Vimball(0)
|
28
|
+
com! -na=* -complete=dir RmVimball call vimball#SaveSettings()|call vimball#RmVimball(<f-args>)|call vimball#RestoreSettings()
|
29
|
+
au BufEnter *.vba,*.vba.gz,*.vba.bz2,*.vba.zip,*.vba.xz setlocal bt=nofile fmr=[[[,]]] fdm=marker|if &ff != 'unix'|setlocal ma ff=unix noma|endif|call vimball#ShowMesg(0,"Source this file to extract it! (:so %)")
|
30
|
+
au SourceCmd *.vba.gz,*.vba.bz2,*.vba.zip,*.vba.xz if expand("%")!=expand("<afile>") | exe "1sp" fnameescape(expand("<afile>"))|endif|call vimball#Decompress(expand("<amatch>"))|so %|if expand("%")!=expand("<afile>")|close|endif
|
31
|
+
au SourceCmd *.vba if expand("%")!=expand("<afile>") | exe "1sp" fnameescape(expand("<afile>"))|call vimball#Vimball(1)|close|else|call vimball#Vimball(1)|endif
|
32
|
+
au BufEnter *.vmb,*.vmb.gz,*.vmb.bz2,*.vmb.zip,*.vmb.xz setlocal bt=nofile fmr=[[[,]]] fdm=marker|if &ff != 'unix'|setlocal ma ff=unix noma|endif|call vimball#ShowMesg(0,"Source this file to extract it! (:so %)")
|
33
|
+
au SourceCmd *.vmb.gz,*.vmb.bz2,*.vmb.zip,*.vmb.xz if expand("%")!=expand("<afile>") | exe "1sp" fnameescape(expand("<afile>"))|endif|call vimball#Decompress(expand("<amatch>"))|so %|if expand("%")!=expand("<afile>")|close|endif
|
34
|
+
au SourceCmd *.vmb if expand("%")!=expand("<afile>") | exe "1sp" fnameescape(expand("<afile>"))|call vimball#Vimball(1)|close|else|call vimball#Vimball(1)|endif
|
35
|
+
|
36
|
+
" =====================================================================
|
37
|
+
" Restoration And Modelines: {{{1
|
38
|
+
" vim: fdm=marker
|
39
|
+
let &cpo= s:keepcpo
|
40
|
+
unlet s:keepcpo
|
@@ -0,0 +1,101 @@
|
|
1
|
+
" DrChip's debugger syntax file
|
2
|
+
" Language : DrChip's Dfunc/Decho/Dret output
|
3
|
+
" Maintainer : Charles E. Campbell, Jr.
|
4
|
+
" Last change: Aug 12, 2008
|
5
|
+
" Version : 5
|
6
|
+
|
7
|
+
" Remove any old syntax stuff hanging around
|
8
|
+
syn clear
|
9
|
+
|
10
|
+
" DechoTab support
|
11
|
+
syn match dechoTabTitleSep "^---------$"
|
12
|
+
syn match dechoTabTitle "^Decho Tab$"
|
13
|
+
|
14
|
+
" Delimiters, strings, numbers
|
15
|
+
syn match dechoDelimiter "[{}]$"
|
16
|
+
syn match dechoDelimiter ","
|
17
|
+
syn region dechoAngleBrkt oneline matchgroup=Green start="\w<"lc=1 matchgroup=Green end=">" contains=dechoNotify,dechoAngleBrktInc,dechoString
|
18
|
+
syn region dechoAngleBrktInc contained oneline start="<" end=">" contains=dechoNotify,dechoAngleBrktInc,dechoString
|
19
|
+
syn region dechoString oneline matchgroup=Blue start='"' matchgroup=Blue end='"' contains=dechoNotify
|
20
|
+
syn match dechoNumber "\<-\=[0-9]\+\>"
|
21
|
+
syn match dechoNumber "\<-\=[0-9]\+\ze:"
|
22
|
+
syn match dechoNumber "\<=-\=[0-9a-fA-F]\+\>"
|
23
|
+
syn match dechoNumber "\<[0-9a-fA-F]\+x$"
|
24
|
+
syn match dechoNumber "\<[0-9a-fA-F]\+x[^a-zA-Z=]"me=e-1
|
25
|
+
|
26
|
+
" Let me see errors/warnings/severe messages easily
|
27
|
+
syn keyword dechoNotify fatal error severe
|
28
|
+
syn match dechoNotify "!!!\|???"
|
29
|
+
syn keyword dechoWarning warning
|
30
|
+
|
31
|
+
" Bars, Function names, Return
|
32
|
+
syn match dechoFunction contained "\%([sS]:\)\=\h[a-zA-Z0-9_#]*"
|
33
|
+
syn match dechoBar "^|\+"
|
34
|
+
syn match dechoStartFunc "^|*\%([sS]:\)\=\h[a-zA-Z0-9_#]*(" contains=dechoBar,dechoFunction,dechoDelimStart
|
35
|
+
syn match dechoStopFunc "^|\+return \%([sS]:\)\=\h[a-zA-Z0-9_#]*" contains=dechoBar,dechoFunction
|
36
|
+
syn match dechoComment "^[ \t]*#.*$"
|
37
|
+
syn match dechoMatrix "^|[-+ 0-9.e]\+|$" contains=dechoMatrixBar
|
38
|
+
syn match dechoMatrixBar contained "|"
|
39
|
+
|
40
|
+
" Problems
|
41
|
+
syn keyword dechoProblem PROBLEM[:] COMBAK[:] WARNING[:] SEVERE[:] NOTE[:] DIFFER[S:]
|
42
|
+
|
43
|
+
if !exists("did_drchip_decho_syntax")
|
44
|
+
let did_drchip_decho_syntax= 1
|
45
|
+
|
46
|
+
" Links
|
47
|
+
hi link dechoAngleBrktInc dechoAngleBrkt
|
48
|
+
|
49
|
+
" If the "Warning" highlighting group hasn't been defined,
|
50
|
+
" then this script will define it.
|
51
|
+
let s:id_hlname= hlID("Warning")
|
52
|
+
let s:fg_hlname= synIDattr(synIDtrans(s:id_hlname),"fg")
|
53
|
+
if s:id_hlname == 0 || s:fg_hlname == 0 || s:fg_hlname == -1
|
54
|
+
hi Warning term=NONE cterm=NONE gui=NONE ctermfg=black ctermbg=yellow guifg=black guibg=yellow
|
55
|
+
endif
|
56
|
+
unlet s:id_hlname s:fg_hlname
|
57
|
+
|
58
|
+
hi link dechoAngleBrkt String
|
59
|
+
hi link dechoComment Comment
|
60
|
+
hi link dechoDelimiter Delimiter
|
61
|
+
hi link dechoFunction Statement
|
62
|
+
hi link dechoMatrixBar Delimiter
|
63
|
+
hi link dechoNotify Error
|
64
|
+
hi link dechoNumber Number
|
65
|
+
hi link dechoProblem Error
|
66
|
+
hi link dechoString String
|
67
|
+
hi link dechoWarning Warning
|
68
|
+
hi link dechoTabTitle PreProc
|
69
|
+
hi link dechoTabTitleSep Delimiter
|
70
|
+
|
71
|
+
" HLTest: tests if a highlighting group has been set up {{{2
|
72
|
+
fun! s:HLTest(hlname)
|
73
|
+
let id_hlname= hlID(a:hlname)
|
74
|
+
if id_hlname == 0
|
75
|
+
return 0
|
76
|
+
endif
|
77
|
+
let id_trans = synIDtrans(id_hlname)
|
78
|
+
if id_trans == 0
|
79
|
+
return 0
|
80
|
+
endif
|
81
|
+
let fg_hlname= synIDattr(id_trans,"fg")
|
82
|
+
let bg_hlname= synIDattr(id_trans,"bg")
|
83
|
+
if fg_hlname == -1 && bg_hlname == -1
|
84
|
+
return 0
|
85
|
+
endif
|
86
|
+
if fg_hlname == "" && bg_hlname == ""
|
87
|
+
return 0
|
88
|
+
endif
|
89
|
+
return 1
|
90
|
+
endfun
|
91
|
+
|
92
|
+
" define DechoBarHL as needed
|
93
|
+
if s:HLTest("Magenta")
|
94
|
+
hi link DechoBarHL Magenta
|
95
|
+
else
|
96
|
+
hi DechoBarHL start=[m[35m stop=[m[32m ctermfg=magenta guifg=magenta term=none cterm=none gui=none
|
97
|
+
endif
|
98
|
+
delf s:HLTest
|
99
|
+
hi link dechoBar DechoBarHL
|
100
|
+
endif
|
101
|
+
" vim: ts=6
|
@@ -0,0 +1,73 @@
|
|
1
|
+
" Vim syntax file
|
2
|
+
" Language: eRuby
|
3
|
+
" Maintainer: Tim Pope <vimNOSPAM@tpope.info>
|
4
|
+
" URL: http://vim-ruby.rubyforge.org
|
5
|
+
" Anon CVS: See above site
|
6
|
+
" Release Coordinator: Doug Kearns <dougkearns@gmail.com>
|
7
|
+
|
8
|
+
if exists("b:current_syntax")
|
9
|
+
finish
|
10
|
+
endif
|
11
|
+
|
12
|
+
if !exists("main_syntax")
|
13
|
+
let main_syntax = 'eruby'
|
14
|
+
endif
|
15
|
+
|
16
|
+
if !exists("g:eruby_default_subtype")
|
17
|
+
let g:eruby_default_subtype = "html"
|
18
|
+
endif
|
19
|
+
|
20
|
+
if !exists("b:eruby_subtype") && main_syntax == 'eruby'
|
21
|
+
let s:lines = getline(1)."\n".getline(2)."\n".getline(3)."\n".getline(4)."\n".getline(5)."\n".getline("$")
|
22
|
+
let b:eruby_subtype = matchstr(s:lines,'eruby_subtype=\zs\w\+')
|
23
|
+
if b:eruby_subtype == ''
|
24
|
+
let b:eruby_subtype = matchstr(substitute(expand("%:t"),'\c\%(\.erb\|\.eruby\)\+$','',''),'\.\zs\w\+$')
|
25
|
+
endif
|
26
|
+
if b:eruby_subtype == 'rhtml'
|
27
|
+
let b:eruby_subtype = 'html'
|
28
|
+
elseif b:eruby_subtype == 'rb'
|
29
|
+
let b:eruby_subtype = 'ruby'
|
30
|
+
elseif b:eruby_subtype == 'yml'
|
31
|
+
let b:eruby_subtype = 'yaml'
|
32
|
+
elseif b:eruby_subtype == 'js'
|
33
|
+
let b:eruby_subtype = 'javascript'
|
34
|
+
elseif b:eruby_subtype == 'txt'
|
35
|
+
" Conventional; not a real file type
|
36
|
+
let b:eruby_subtype = 'text'
|
37
|
+
elseif b:eruby_subtype == ''
|
38
|
+
let b:eruby_subtype = g:eruby_default_subtype
|
39
|
+
endif
|
40
|
+
endif
|
41
|
+
|
42
|
+
if !exists("b:eruby_nest_level")
|
43
|
+
let b:eruby_nest_level = strlen(substitute(substitute(substitute(expand("%:t"),'@','','g'),'\c\.\%(erb\|rhtml\)\>','@','g'),'[^@]','','g'))
|
44
|
+
endif
|
45
|
+
if !b:eruby_nest_level
|
46
|
+
let b:eruby_nest_level = 1
|
47
|
+
endif
|
48
|
+
|
49
|
+
if exists("b:eruby_subtype") && b:eruby_subtype != ''
|
50
|
+
exe "runtime! syntax/".b:eruby_subtype.".vim"
|
51
|
+
unlet! b:current_syntax
|
52
|
+
endif
|
53
|
+
syn include @rubyTop syntax/ruby.vim
|
54
|
+
|
55
|
+
syn cluster erubyRegions contains=erubyOneLiner,erubyBlock,erubyExpression,erubyComment
|
56
|
+
|
57
|
+
exe 'syn region erubyOneLiner matchgroup=erubyDelimiter start="^%\{1,'.b:eruby_nest_level.'\}%\@!" end="$" contains=@rubyTop containedin=ALLBUT,@erubyRegions keepend oneline'
|
58
|
+
exe 'syn region erubyBlock matchgroup=erubyDelimiter start="<%\{1,'.b:eruby_nest_level.'\}%\@!-\=" end="[=-]\=%\@<!%\{1,'.b:eruby_nest_level.'\}>" contains=@rubyTop containedin=ALLBUT,@erubyRegions keepend'
|
59
|
+
exe 'syn region erubyExpression matchgroup=erubyDelimiter start="<%\{1,'.b:eruby_nest_level.'\}=\{1,4}" end="[=-]\=%\@<!%\{1,'.b:eruby_nest_level.'\}>" contains=@rubyTop containedin=ALLBUT,@erubyRegions keepend'
|
60
|
+
exe 'syn region erubyComment matchgroup=erubyDelimiter start="<%\{1,'.b:eruby_nest_level.'\}#" end="%\@<!%\{1,'.b:eruby_nest_level.'\}>" contains=rubyTodo,@Spell containedin=ALLBUT,@erubyRegions keepend'
|
61
|
+
|
62
|
+
" Define the default highlighting.
|
63
|
+
|
64
|
+
hi def link erubyDelimiter Delimiter
|
65
|
+
hi def link erubyComment Comment
|
66
|
+
|
67
|
+
let b:current_syntax = 'eruby'
|
68
|
+
|
69
|
+
if main_syntax == 'eruby'
|
70
|
+
unlet main_syntax
|
71
|
+
endif
|
72
|
+
|
73
|
+
" vim: nowrap sw=2 sts=2 ts=8:
|
@@ -0,0 +1,246 @@
|
|
1
|
+
" Vim syntax file
|
2
|
+
" Language: JavaScript
|
3
|
+
" Maintainer: Yi Zhao (ZHAOYI) <zzlinux AT hotmail DOT com>
|
4
|
+
" Last Change: June 4, 2009
|
5
|
+
" Version: 0.7.7
|
6
|
+
" Changes: Add "undefined" as a type keyword
|
7
|
+
"
|
8
|
+
" TODO:
|
9
|
+
" - Add the HTML syntax inside the JSDoc
|
10
|
+
|
11
|
+
if !exists("main_syntax")
|
12
|
+
if version < 600
|
13
|
+
syntax clear
|
14
|
+
elseif exists("b:current_syntax")
|
15
|
+
finish
|
16
|
+
endif
|
17
|
+
let main_syntax = 'javascript'
|
18
|
+
endif
|
19
|
+
|
20
|
+
"" Drop fold if it set but VIM doesn't support it.
|
21
|
+
let b:javascript_fold='true'
|
22
|
+
if version < 600 " Don't support the old version
|
23
|
+
unlet! b:javascript_fold
|
24
|
+
endif
|
25
|
+
|
26
|
+
"" dollar sigh is permittd anywhere in an identifier
|
27
|
+
setlocal iskeyword+=$
|
28
|
+
|
29
|
+
syntax sync fromstart
|
30
|
+
|
31
|
+
"" JavaScript comments
|
32
|
+
syntax keyword javaScriptCommentTodo TODO FIXME XXX TBD contained
|
33
|
+
syntax region javaScriptLineComment start=+\/\/+ end=+$+ keepend contains=javaScriptCommentTodo,@Spell
|
34
|
+
syntax region javaScriptLineComment start=+^\s*\/\/+ skip=+\n\s*\/\/+ end=+$+ keepend contains=javaScriptCommentTodo,@Spell fold
|
35
|
+
syntax region javaScriptCvsTag start="\$\cid:" end="\$" oneline contained
|
36
|
+
syntax region javaScriptComment start="/\*" end="\*/" contains=javaScriptCommentTodo,javaScriptCvsTag,@Spell fold
|
37
|
+
|
38
|
+
"" JSDoc support start
|
39
|
+
if !exists("javascript_ignore_javaScriptdoc")
|
40
|
+
syntax case ignore
|
41
|
+
|
42
|
+
"" syntax coloring for javadoc comments (HTML)
|
43
|
+
"syntax include @javaHtml <sfile>:p:h/html.vim
|
44
|
+
"unlet b:current_syntax
|
45
|
+
|
46
|
+
syntax region javaScriptDocComment matchgroup=javaScriptComment start="/\*\*\s*$" end="\*/" contains=javaScriptDocTags,javaScriptCommentTodo,javaScriptCvsTag,@javaScriptHtml,@Spell fold
|
47
|
+
syntax match javaScriptDocTags contained "@\(param\|argument\|requires\|exception\|throws\|type\|class\|extends\|see\|link\|member\|module\|method\|title\|namespace\|optional\|default\|base\|file\)\>" nextgroup=javaScriptDocParam,javaScriptDocSeeTag skipwhite
|
48
|
+
syntax match javaScriptDocTags contained "@\(beta\|deprecated\|description\|fileoverview\|author\|license\|version\|returns\=\|constructor\|private\|protected\|final\|ignore\|addon\|exec\)\>"
|
49
|
+
syntax match javaScriptDocParam contained "\%(#\|\w\|\.\|:\|\/\)\+"
|
50
|
+
syntax region javaScriptDocSeeTag contained matchgroup=javaScriptDocSeeTag start="{" end="}" contains=javaScriptDocTags
|
51
|
+
|
52
|
+
syntax case match
|
53
|
+
endif "" JSDoc end
|
54
|
+
|
55
|
+
syntax case match
|
56
|
+
|
57
|
+
"" Syntax in the JavaScript code
|
58
|
+
syntax match javaScriptSpecial "\\\d\d\d\|\\x\x\{2\}\|\\u\x\{4\}\|\\."
|
59
|
+
syntax region javaScriptStringD start=+"+ skip=+\\\\\|\\$"+ end=+"+ contains=javaScriptSpecial,@htmlPreproc
|
60
|
+
syntax region javaScriptStringS start=+'+ skip=+\\\\\|\\$'+ end=+'+ contains=javaScriptSpecial,@htmlPreproc
|
61
|
+
syntax region javaScriptRegexpString start=+/\(\*\|/\)\@!+ skip=+\\\\\|\\/+ end=+/[gim]\{,3}+ contains=javaScriptSpecial,@htmlPreproc oneline
|
62
|
+
syntax match javaScriptNumber /\<-\=\d\+L\=\>\|\<0[xX]\x\+\>/
|
63
|
+
syntax match javaScriptFloat /\<-\=\%(\d\+\.\d\+\|\d\+\.\|\.\d\+\)\%([eE][+-]\=\d\+\)\=\>/
|
64
|
+
syntax match javaScriptLabel /\(?\s*\)\@<!\<\w\+\(\s*:\)\@=/
|
65
|
+
|
66
|
+
"" JavaScript Prototype
|
67
|
+
syntax keyword javaScriptPrototype prototype
|
68
|
+
|
69
|
+
"" Programm Keywords
|
70
|
+
syntax keyword javaScriptSource import export
|
71
|
+
syntax keyword javaScriptType const this undefined var void yield
|
72
|
+
syntax keyword javaScriptOperator delete new in instanceof let typeof
|
73
|
+
syntax keyword javaScriptBoolean true false
|
74
|
+
syntax keyword javaScriptNull null
|
75
|
+
|
76
|
+
"" Statement Keywords
|
77
|
+
syntax keyword javaScriptConditional if else
|
78
|
+
syntax keyword javaScriptRepeat do while for
|
79
|
+
syntax keyword javaScriptBranch break continue switch case default return
|
80
|
+
syntax keyword javaScriptStatement try catch throw with finally
|
81
|
+
|
82
|
+
syntax keyword javaScriptGlobalObjects Array Boolean Date Function Infinity JavaArray JavaClass JavaObject JavaPackage Math Number NaN Object Packages RegExp String Undefined java netscape sun
|
83
|
+
|
84
|
+
syntax keyword javaScriptExceptions Error EvalError RangeError ReferenceError SyntaxError TypeError URIError
|
85
|
+
|
86
|
+
syntax keyword javaScriptFutureKeys abstract enum int short boolean export interface static byte extends long super char final native synchronized class float package throws const goto private transient debugger implements protected volatile double import public
|
87
|
+
|
88
|
+
"" DOM/HTML/CSS specified things
|
89
|
+
|
90
|
+
" DOM2 Objects
|
91
|
+
syntax keyword javaScriptGlobalObjects DOMImplementation DocumentFragment Document Node NodeList NamedNodeMap CharacterData Attr Element Text Comment CDATASection DocumentType Notation Entity EntityReference ProcessingInstruction
|
92
|
+
syntax keyword javaScriptExceptions DOMException
|
93
|
+
|
94
|
+
" DOM2 CONSTANT
|
95
|
+
syntax keyword javaScriptDomErrNo INDEX_SIZE_ERR DOMSTRING_SIZE_ERR HIERARCHY_REQUEST_ERR WRONG_DOCUMENT_ERR INVALID_CHARACTER_ERR NO_DATA_ALLOWED_ERR NO_MODIFICATION_ALLOWED_ERR NOT_FOUND_ERR NOT_SUPPORTED_ERR INUSE_ATTRIBUTE_ERR INVALID_STATE_ERR SYNTAX_ERR INVALID_MODIFICATION_ERR NAMESPACE_ERR INVALID_ACCESS_ERR
|
96
|
+
syntax keyword javaScriptDomNodeConsts ELEMENT_NODE ATTRIBUTE_NODE TEXT_NODE CDATA_SECTION_NODE ENTITY_REFERENCE_NODE ENTITY_NODE PROCESSING_INSTRUCTION_NODE COMMENT_NODE DOCUMENT_NODE DOCUMENT_TYPE_NODE DOCUMENT_FRAGMENT_NODE NOTATION_NODE
|
97
|
+
|
98
|
+
" HTML events and internal variables
|
99
|
+
syntax case ignore
|
100
|
+
syntax keyword javaScriptHtmlEvents onblur onclick oncontextmenu ondblclick onfocus onkeydown onkeypress onkeyup onmousedown onmousemove onmouseout onmouseover onmouseup onresize
|
101
|
+
syntax case match
|
102
|
+
|
103
|
+
" Follow stuff should be highligh within a special context
|
104
|
+
" While it can't be handled with context depended with Regex based highlight
|
105
|
+
" So, turn it off by default
|
106
|
+
if exists("javascript_enable_domhtmlcss")
|
107
|
+
|
108
|
+
" DOM2 things
|
109
|
+
syntax match javaScriptDomElemAttrs contained /\%(nodeName\|nodeValue\|nodeType\|parentNode\|childNodes\|firstChild\|lastChild\|previousSibling\|nextSibling\|attributes\|ownerDocument\|namespaceURI\|prefix\|localName\|tagName\)\>/
|
110
|
+
syntax match javaScriptDomElemFuncs contained /\%(insertBefore\|replaceChild\|removeChild\|appendChild\|hasChildNodes\|cloneNode\|normalize\|isSupported\|hasAttributes\|getAttribute\|setAttribute\|removeAttribute\|getAttributeNode\|setAttributeNode\|removeAttributeNode\|getElementsByTagName\|getAttributeNS\|setAttributeNS\|removeAttributeNS\|getAttributeNodeNS\|setAttributeNodeNS\|getElementsByTagNameNS\|hasAttribute\|hasAttributeNS\)\>/ nextgroup=javaScriptParen skipwhite
|
111
|
+
" HTML things
|
112
|
+
syntax match javaScriptHtmlElemAttrs contained /\%(className\|clientHeight\|clientLeft\|clientTop\|clientWidth\|dir\|id\|innerHTML\|lang\|length\|offsetHeight\|offsetLeft\|offsetParent\|offsetTop\|offsetWidth\|scrollHeight\|scrollLeft\|scrollTop\|scrollWidth\|style\|tabIndex\|title\)\>/
|
113
|
+
syntax match javaScriptHtmlElemFuncs contained /\%(blur\|click\|focus\|scrollIntoView\|addEventListener\|dispatchEvent\|removeEventListener\|item\)\>/ nextgroup=javaScriptParen skipwhite
|
114
|
+
|
115
|
+
" CSS Styles in JavaScript
|
116
|
+
syntax keyword javaScriptCssStyles contained color font fontFamily fontSize fontSizeAdjust fontStretch fontStyle fontVariant fontWeight letterSpacing lineBreak lineHeight quotes rubyAlign rubyOverhang rubyPosition
|
117
|
+
syntax keyword javaScriptCssStyles contained textAlign textAlignLast textAutospace textDecoration textIndent textJustify textJustifyTrim textKashidaSpace textOverflowW6 textShadow textTransform textUnderlinePosition
|
118
|
+
syntax keyword javaScriptCssStyles contained unicodeBidi whiteSpace wordBreak wordSpacing wordWrap writingMode
|
119
|
+
syntax keyword javaScriptCssStyles contained bottom height left position right top width zIndex
|
120
|
+
syntax keyword javaScriptCssStyles contained border borderBottom borderLeft borderRight borderTop borderBottomColor borderLeftColor borderTopColor borderBottomStyle borderLeftStyle borderRightStyle borderTopStyle borderBottomWidth borderLeftWidth borderRightWidth borderTopWidth borderColor borderStyle borderWidth borderCollapse borderSpacing captionSide emptyCells tableLayout
|
121
|
+
syntax keyword javaScriptCssStyles contained margin marginBottom marginLeft marginRight marginTop outline outlineColor outlineStyle outlineWidth padding paddingBottom paddingLeft paddingRight paddingTop
|
122
|
+
syntax keyword javaScriptCssStyles contained listStyle listStyleImage listStylePosition listStyleType
|
123
|
+
syntax keyword javaScriptCssStyles contained background backgroundAttachment backgroundColor backgroundImage gackgroundPosition backgroundPositionX backgroundPositionY backgroundRepeat
|
124
|
+
syntax keyword javaScriptCssStyles contained clear clip clipBottom clipLeft clipRight clipTop content counterIncrement counterReset cssFloat cursor direction display filter layoutGrid layoutGridChar layoutGridLine layoutGridMode layoutGridType
|
125
|
+
syntax keyword javaScriptCssStyles contained marks maxHeight maxWidth minHeight minWidth opacity MozOpacity overflow overflowX overflowY verticalAlign visibility zoom cssText
|
126
|
+
syntax keyword javaScriptCssStyles contained scrollbar3dLightColor scrollbarArrowColor scrollbarBaseColor scrollbarDarkShadowColor scrollbarFaceColor scrollbarHighlightColor scrollbarShadowColor scrollbarTrackColor
|
127
|
+
|
128
|
+
" Highlight ways
|
129
|
+
syntax match javaScriptDotNotation "\." nextgroup=javaScriptPrototype,javaScriptDomElemAttrs,javaScriptDomElemFuncs,javaScriptHtmlElemAttrs,javaScriptHtmlElemFuncs
|
130
|
+
syntax match javaScriptDotNotation "\.style\." nextgroup=javaScriptCssStyles
|
131
|
+
|
132
|
+
endif "DOM/HTML/CSS
|
133
|
+
|
134
|
+
"" end DOM/HTML/CSS specified things
|
135
|
+
|
136
|
+
|
137
|
+
"" Code blocks
|
138
|
+
syntax cluster javaScriptAll contains=javaScriptComment,javaScriptLineComment,javaScriptDocComment,javaScriptStringD,javaScriptStringS,javaScriptRegexpString,javaScriptNumber,javaScriptFloat,javaScriptLabel,javaScriptSource,javaScriptType,javaScriptOperator,javaScriptBoolean,javaScriptNull,javaScriptFunction,javaScriptConditional,javaScriptRepeat,javaScriptBranch,javaScriptStatement,javaScriptGlobalObjects,javaScriptExceptions,javaScriptFutureKeys,javaScriptDomErrNo,javaScriptDomNodeConsts,javaScriptHtmlEvents,javaScriptDotNotation
|
139
|
+
syntax region javaScriptBracket matchgroup=javaScriptBracket transparent start="\[" end="\]" contains=@javaScriptAll,javaScriptParensErrB,javaScriptParensErrC,javaScriptBracket,javaScriptParen,javaScriptBlock,@htmlPreproc
|
140
|
+
syntax region javaScriptParen matchgroup=javaScriptParen transparent start="(" end=")" contains=@javaScriptAll,javaScriptParensErrA,javaScriptParensErrC,javaScriptParen,javaScriptBracket,javaScriptBlock,@htmlPreproc
|
141
|
+
syntax region javaScriptBlock matchgroup=javaScriptBlock transparent start="{" end="}" contains=@javaScriptAll,javaScriptParensErrA,javaScriptParensErrB,javaScriptParen,javaScriptBracket,javaScriptBlock,@htmlPreproc
|
142
|
+
|
143
|
+
"" catch errors caused by wrong parenthesis
|
144
|
+
syntax match javaScriptParensError ")\|}\|\]"
|
145
|
+
syntax match javaScriptParensErrA contained "\]"
|
146
|
+
syntax match javaScriptParensErrB contained ")"
|
147
|
+
syntax match javaScriptParensErrC contained "}"
|
148
|
+
|
149
|
+
if main_syntax == "javascript"
|
150
|
+
syntax sync clear
|
151
|
+
syntax sync ccomment javaScriptComment minlines=200
|
152
|
+
syntax sync match javaScriptHighlight grouphere javaScriptBlock /{/
|
153
|
+
endif
|
154
|
+
|
155
|
+
"" Fold control
|
156
|
+
if exists("b:javascript_fold")
|
157
|
+
syntax match javaScriptFunction /\<function\>/ nextgroup=javaScriptFuncName skipwhite
|
158
|
+
syntax match javaScriptOpAssign /=\@<!=/ nextgroup=javaScriptFuncBlock skipwhite skipempty
|
159
|
+
syntax region javaScriptFuncName contained matchgroup=javaScriptFuncName start=/\%(\$\|\w\)*\s*(/ end=/)/ contains=javaScriptLineComment,javaScriptComment nextgroup=javaScriptFuncBlock skipwhite skipempty
|
160
|
+
syntax region javaScriptFuncBlock contained matchgroup=javaScriptFuncBlock start="{" end="}" contains=@javaScriptAll,javaScriptParensErrA,javaScriptParensErrB,javaScriptParen,javaScriptBracket,javaScriptBlock fold
|
161
|
+
|
162
|
+
if &l:filetype=='javascript' && !&diff
|
163
|
+
" Fold setting
|
164
|
+
" Redefine the foldtext (to show a JS function outline) and foldlevel
|
165
|
+
" only if the entire buffer is JavaScript, but not if JavaScript syntax
|
166
|
+
" is embedded in another syntax (e.g. HTML).
|
167
|
+
setlocal foldmethod=syntax
|
168
|
+
setlocal foldlevel=4
|
169
|
+
endif
|
170
|
+
else
|
171
|
+
syntax keyword javaScriptFunction function
|
172
|
+
setlocal foldmethod<
|
173
|
+
setlocal foldlevel<
|
174
|
+
endif
|
175
|
+
|
176
|
+
" Define the default highlighting.
|
177
|
+
" For version 5.7 and earlier: only when not done already
|
178
|
+
" For version 5.8 and later: only when an item doesn't have highlighting yet
|
179
|
+
if version >= 508 || !exists("did_javascript_syn_inits")
|
180
|
+
if version < 508
|
181
|
+
let did_javascript_syn_inits = 1
|
182
|
+
command -nargs=+ HiLink hi link <args>
|
183
|
+
else
|
184
|
+
command -nargs=+ HiLink hi def link <args>
|
185
|
+
endif
|
186
|
+
HiLink javaScriptComment Comment
|
187
|
+
HiLink javaScriptLineComment Comment
|
188
|
+
HiLink javaScriptDocComment Comment
|
189
|
+
HiLink javaScriptCommentTodo Todo
|
190
|
+
HiLink javaScriptCvsTag Function
|
191
|
+
HiLink javaScriptDocTags Special
|
192
|
+
HiLink javaScriptDocSeeTag Function
|
193
|
+
HiLink javaScriptDocParam Function
|
194
|
+
HiLink javaScriptStringS String
|
195
|
+
HiLink javaScriptStringD String
|
196
|
+
HiLink javaScriptRegexpString String
|
197
|
+
HiLink javaScriptCharacter Character
|
198
|
+
HiLink javaScriptPrototype Type
|
199
|
+
HiLink javaScriptConditional Conditional
|
200
|
+
HiLink javaScriptBranch Conditional
|
201
|
+
HiLink javaScriptRepeat Repeat
|
202
|
+
HiLink javaScriptStatement Statement
|
203
|
+
HiLink javaScriptFunction Function
|
204
|
+
HiLink javaScriptError Error
|
205
|
+
HiLink javaScriptParensError Error
|
206
|
+
HiLink javaScriptParensErrA Error
|
207
|
+
HiLink javaScriptParensErrB Error
|
208
|
+
HiLink javaScriptParensErrC Error
|
209
|
+
HiLink javaScriptOperator Operator
|
210
|
+
HiLink javaScriptType Type
|
211
|
+
HiLink javaScriptNull Type
|
212
|
+
HiLink javaScriptNumber Number
|
213
|
+
HiLink javaScriptFloat Number
|
214
|
+
HiLink javaScriptBoolean Boolean
|
215
|
+
HiLink javaScriptLabel Label
|
216
|
+
HiLink javaScriptSpecial Special
|
217
|
+
HiLink javaScriptSource Special
|
218
|
+
HiLink javaScriptGlobalObjects Special
|
219
|
+
HiLink javaScriptExceptions Special
|
220
|
+
|
221
|
+
HiLink javaScriptDomErrNo Constant
|
222
|
+
HiLink javaScriptDomNodeConsts Constant
|
223
|
+
HiLink javaScriptDomElemAttrs Label
|
224
|
+
HiLink javaScriptDomElemFuncs PreProc
|
225
|
+
|
226
|
+
HiLink javaScriptHtmlEvents Special
|
227
|
+
HiLink javaScriptHtmlElemAttrs Label
|
228
|
+
HiLink javaScriptHtmlElemFuncs PreProc
|
229
|
+
|
230
|
+
HiLink javaScriptCssStyles Label
|
231
|
+
|
232
|
+
delcommand HiLink
|
233
|
+
endif
|
234
|
+
|
235
|
+
" Define the htmlJavaScript for HTML syntax html.vim
|
236
|
+
"syntax clear htmlJavaScript
|
237
|
+
"syntax clear javaScriptExpression
|
238
|
+
syntax cluster htmlJavaScript contains=@javaScriptAll,javaScriptBracket,javaScriptParen,javaScriptBlock,javaScriptParenError
|
239
|
+
syntax cluster javaScriptExpression contains=@javaScriptAll,javaScriptBracket,javaScriptParen,javaScriptBlock,javaScriptParenError,@htmlPreproc
|
240
|
+
|
241
|
+
let b:current_syntax = "javascript"
|
242
|
+
if main_syntax == 'javascript'
|
243
|
+
unlet main_syntax
|
244
|
+
endif
|
245
|
+
|
246
|
+
" vim: ts=4
|