├── ftdetect └── jquery.vim ├── README └── syntax └── jquery.vim /ftdetect/jquery.vim: -------------------------------------------------------------------------------- 1 | autocmd BufRead,BufNewFile jquery.*.js set ft=javascript syntax=jquery 2 | -------------------------------------------------------------------------------- /README: -------------------------------------------------------------------------------- 1 | Vim syntax file to add some colorations for jQuery keywords 2 | and css selectors. 3 | 4 | This is a mirror of http://www.vim.org/scripts/script.php?script_id=2416 5 | 6 | -------- 7 | 8 | This mirror was set up by Scott Bronson: http://github.com/bronson 9 | Message me if it's out of date. 10 | 11 | When committing, make sure the author date matches the upstream release date. 12 | For 0.4 released on 2010-02-02: 13 | 14 | $ GIT_AUTHOR_DATE=2010-02-02T00:00:00 git commit 15 | $ GIT_COMMITTER_DATE=2010-02-02T00:00:00 git tag -a 0.4 16 | -------------------------------------------------------------------------------- /syntax/jquery.vim: -------------------------------------------------------------------------------- 1 | " Vim syntax file 2 | " Language: jQuery 3 | " Maintainer: Bruno Michel 4 | " Last Change: May 28th, 2011 5 | " Version: 0.5.2 6 | " URL: http://api.jquery.com/ 7 | 8 | if version < 600 9 | syntax clear 10 | elseif exists("b:current_syntax") 11 | finish 12 | endif 13 | 14 | if !exists("main_syntax") 15 | let main_syntax = 'javascript' 16 | endif 17 | 18 | ru! syntax/javascript.vim 19 | unlet b:current_syntax 20 | 21 | syn match jQuery /jQuery\|\$/ 22 | 23 | 24 | syn match jFunc /\.\w\+(\@=/ contains=@jFunctions 25 | 26 | syn cluster jFunctions contains=jAjax,jAttributes,jCore,jCSS,jData,jDeferred,jDimensions,jEffects,jEvents,jManipulation,jMiscellaneous,jOffset,jProperties,jTraversing,jUtilities 27 | syn keyword jAjax contained ajaxComplete ajaxError ajaxSend ajaxStart ajaxStop ajaxSuccess 28 | syn keyword jAjax contained param serialize serializeArray 29 | syn keyword jAjax contained ajax ajaxPrefilter ajaxSetup ajaxSettings ajaxTransport 30 | syn keyword jAjax contained get getJSON getScript load post 31 | syn keyword jAttributes contained addClass attr hasClass prop removeAttr removeClass removeProp toggleClass val 32 | syn keyword jCore contained holdReady noConflict sub when 33 | syn keyword jCSS contained css cssHooks 34 | syn keyword jData contained clearQueue data dequeue hasData queue removeData 35 | syn keyword jDeferred contained Deferred always done fail isRejected isResolved pipe promise reject rejectWith resolved resolveWith then 36 | syn keyword jDimensions contained height innerHeight innerWidth outerHeight outerWidth width 37 | syn keyword jEffects contained hide show toggle 38 | syn keyword jEffects contained animate delay stop 39 | syn keyword jEffects contained fadeIn fadeOut fadeTo fadeToggle 40 | syn keyword jEffects contained slideDown slideToggle slideUp 41 | syn keyword jEvents contained error resize scroll 42 | syn keyword jEvents contained ready unload 43 | syn keyword jEvents contained bind delegate die live one proxy trigger triggerHandler unbind undelegate 44 | syn keyword jEvents contained Event currentTarget isDefaultPrevented isImmediatePropagationStopped isPropagationStopped namespace pageX pageY preventDefault relatedTarget result stopImmediatePropagation stopPropagation target timeStamp which 45 | syn keyword jEvents contained blur change focus select submit 46 | syn keyword jEvents contained focusin focusout keydown keypress keyup 47 | syn keyword jEvents contained click dblclick hover mousedown mouseenter mouseleave mousemove mouseout mouseover mouseup 48 | syn keyword jManipulation contained clone 49 | syn keyword jManipulation contained unwrap wrap wrapAll wrapInner 50 | syn keyword jManipulation contained append appendTo html preprend prependTo text 51 | syn keyword jManipulation contained after before insertAfter insertBefore 52 | syn keyword jManipulation contained detach empty remove 53 | syn keyword jManipulation contained replaceAll replaceWith 54 | syn keyword jMiscellaneous contained index size toArray 55 | syn keyword jOffset contained offset offsetParent position scrollTop scrollLeft 56 | syn keyword jProperties contained browser context fx.interval fx.off length selector support 57 | syn keyword jTraversing contained eq filter first has is last map not slice 58 | syn keyword jTraversing contained add andSelf contents end 59 | syn keyword jTraversing contained children closest find next nextAll nextUntil parent parents parentsUntil prev prevAll prevUntil siblings 60 | syn keyword jUtilities contained each extend globalEval grep inArray isArray isEmptyObject isFunction isPlainObject isWindow isXMLDoc makeArray merge noop now parseJSON parseXML trim type unique 61 | 62 | 63 | syn region javaScriptStringD start=+"+ skip=+\\\\\|\\"+ end=+"\|$+ contains=javaScriptSpecial,@htmlPreproc,@jSelectors 64 | syn region javaScriptStringS start=+'+ skip=+\\\\\|\\'+ end=+'\|$+ contains=javaScriptSpecial,@htmlPreproc,@jSelectors 65 | 66 | syn cluster jSelectors contains=jId,jClass,jOperators,jBasicFilters,jContentFilters,jVisibility,jChildFilters,jForms,jFormFilters 67 | syn match jId contained /#[0-9A-Za-z_\-]\+/ 68 | syn match jClass contained /\.[0-9A-Za-z_\-]\+/ 69 | syn match jOperators contained /*\|>\|+\|-\|\~/ 70 | syn match jBasicFilters contained /:\(animated\|eq\|even\|first\|focus\|gt\|header\|last\|lt\|not\|odd\)/ 71 | syn match jChildFilters contained /:\(first\|last\|nth\|only\)-child/ 72 | syn match jContentFilters contained /:\(contains\|empty\|has\|parent\)/ 73 | syn match jForms contained /:\(button\|checkbox\|checked\|disabled\|enabled\|file\|image\|input\|password\|radio\|reset\|selected\|submit\|text\)/ 74 | syn match jVisibility contained /:\(hidden\|visible\)/ 75 | 76 | 77 | " Define the default highlighting. 78 | " For version 5.7 and earlier: only when not done already 79 | " For version 5.8 and later: only when an item doesn't have highlighting yet 80 | if version >= 508 || !exists("did_lisp_syntax_inits") 81 | if version < 508 82 | let did_lisp_syntax_inits = 1 83 | command -nargs=+ HiLink hi link 84 | else 85 | command -nargs=+ HiLink hi def link 86 | endif 87 | 88 | HiLink jQuery Constant 89 | 90 | HiLink jAjax Function 91 | HiLink jAttributes Function 92 | HiLink jCore Function 93 | HiLink jCSS Function 94 | HiLink jData Function 95 | HiLink jDeferred Function 96 | HiLink jDimensions Function 97 | HiLink jEffects Function 98 | HiLink jEvents Function 99 | HiLink jManipulation Function 100 | HiLink jMiscellaneous Function 101 | HiLink jOffset Function 102 | HiLink jProperties Function 103 | HiLink jTraversing Function 104 | HiLink jUtilities Function 105 | 106 | HiLink jId Identifier 107 | HiLink jClass Constant 108 | HiLink jOperators Special 109 | HiLink jBasicFilters Statement 110 | HiLink jContentFilters Statement 111 | HiLink jVisibility Statement 112 | HiLink jChildFilters Statement 113 | HiLink jForms Statement 114 | HiLink jFormFilters Statement 115 | 116 | delcommand HiLink 117 | endif 118 | 119 | 120 | let b:current_syntax = 'jquery' 121 | --------------------------------------------------------------------------------