VIM语法插件:jQuery 1.4 -- Maintained by 小方 2011.5更新

本文介绍了一个专门用于jQuery语法高亮的VIM配置文件。通过这个配置文件,用户可以在VIM编辑器中获得针对jQuery关键字、选择器等元素的高亮显示,提升开发效率。文章详细列举了jQuery的核心功能类别及其对应的关键字。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

把下面的这些拷贝下来,保存成jquery.vim (纯文本),放到VIM所在文件夹"syntax/" 下面,支持GVim.

" Vim syntax file " Language: jQuery " Maintainer: Bruno Michel <brmichel@free.fr>, Paul Morris <lanshunfang#@#gmail.com> " Last Change: 2011-05-05 " Version: 0.5 " URL: http://jquery.com/ " For version 0.5, Paul Morris added all keyword under 1.4, " as well as several widgets in official jQuery UI Component (search: jSWUIComponent) " and customized utilities of StreamWIDE (jSWUIComponent, jSWUtils). " You can remove them if you are not pleased. " May the Lord be you fortress! Amen! if version < 600 syntax clear elseif exists("b:current_syntax") finish endif if !exists("main_syntax") let main_syntax = 'javascript' endif ru! syntax/javascript.vim unlet b:current_syntax syn match jQuery /jQuery/|/$/ syn match jFunc //./w/+(/ contains=@jFunctions syn cluster jFunctions contains=jCore,jAttributes,jTraversing,jManipulation,jCSS,jEvents,jAjax,jUtilities,jEffects,jUIComponent,jSWUIComponent,jSWUtils syn keyword jCore contained each size length selector context eq error get index pushStack toArray noConflict syn keyword jAttributes contained attr removeAttr addClass removeClass toggleClass html text val syn keyword jCSS contained css syn keyword jCSS contained offset offsetParent position scrollTop scrollLeft syn keyword jCSS contained height width innerHeight innerWidth outerHeight outerWidth syn keyword jTraversing contained eq first last filter has is map not slice syn keyword jTraversing contained children closest find next nextAll nextUntil offsetParent parent parents parentsUntil prev prevAll prevUntil siblings syn keyword jTraversing contained add andSelf contents end syn keyword jManipulation contained append appendTo preprend prependTo syn keyword jManipulation contained after before insertAfter insertBefore syn keyword jManipulation contained unwrap wrap wrapAll wrapInner syn keyword jManipulation contained replaceWith replaceAll syn keyword jManipulation contained detach empty remove syn keyword jManipulation contained clone syn keyword jEvents contained ready syn keyword jEvents contained bind one trigger triggerHandler unbind delegate undelegate syn keyword jEvents contained live die syn keyword jEvents contained hover toggle syn keyword jEvents contained blur change click dblclick error focus focusin focusout keydown keypress keyup load syn keyword jEvents contained mousedown mouseenter mouseleave mousemove mouseout mouseover mouseup resize scroll select submit unload syn keyword jEffects contained show hide toggle syn keyword jEffects contained slideDown slideUp slideToggle syn keyword jEffects contained fadeIn fadeOut fadeTo syn keyword jEffects contained animate stop delay syn keyword jAjax contained ajax load get getJSON getScript post syn keyword jAjax contained ajaxComplete ajaxError ajaxSend ajaxStart ajaxStop ajaxSuccess syn keyword jAjax contained ajaxSetup serialize serializeArray syn keyword jUtilities contained support browser boxModel syn keyword jUtilities contained extend grep makeArray map inArray merge noop proxy unique syn keyword jUtilities contained isArray isEmptyObject isFunction isPlainObject syn keyword jUtilities contained each trim parseJSON clearQueue dequeue data removeData queue param syn keyword jUIComponent contained button dialog datepicker tabs syn keyword jSWUIComponent contained swRangeDatePicker swDragndrop swDropdown swSlider checkBox syn keyword jSWUtils contained create update remove queueMeIn getAjaxResponse cacheLastestTrigger bindMeFirst maskMe swInArray validateMe syn region javaScriptStringD start=+"+ skip=+/////|//"+ end=+"/|$+ contains=javaScriptSpecial,@htmlPreproc,@jSelectors syn region javaScriptStringS start=+'+ skip=+/////|//'+ end=+'/|$+ contains=javaScriptSpecial,@htmlPreproc,@jSelectors syn cluster jSelectors contains=jId,jClass,jOperators,jBasicFilters,jContentFilters,jVisibility,jChildFilters,jForms,jFormFilters syn match jId contained /#[0-9A-Za-z_/-]/+/ syn match jClass contained //.[0-9A-Za-z_/-]/+/ syn match jOperators contained /*/|>/|>|/~/ syn match jBasicFilters contained /:/(first/|last/|not/|even/|odd/|eq/|gt/|lt/|header/|animated/)/ syn match jContentFilters contained /:/(contains/|empty/|has/|parent/)/ syn match jVisibility contained /:/(hidden/|visible/)/ syn match jChildFilters contained /:/(nth/|first/|last/|only/)-child/ syn match jForms contained /:/(input/|text/|password/|radio/|checkbox/|submit/|image/|reset/|button/|file/)/ syn match jFormFilters contained /:/(enabled/|disabled/|checked/|selected/)/ " Define the default highlighting. " For version 5.7 and earlier: only when not done already " For version 5.8 and later: only when an item doesn't have highlighting yet if version >= 508 || !exists("did_lisp_syntax_inits") if version < 508 let did_lisp_syntax_inits = 1 command -nargs=+ HiLink hi link <args> else command -nargs=+ HiLink hi def link <args> endif HiLink jQuery Constant HiLink jCore Identifier HiLink jAttributes Identifier HiLink jTraversing Identifier HiLink jManipulation Identifier HiLink jCSS Identifier HiLink jEvents Identifier HiLink jEffects Identifier HiLink jAjax Identifier HiLink jUtilities Identifier HiLink jUIComponent Identifier HiLink jSWUIComponent Identifier HiLink jSWUtils Identifier HiLink jId Identifier HiLink jClass Constant HiLink jOperators Special HiLink jBasicFilters Statement HiLink jContentFilters Statement HiLink jVisibility Statement HiLink jChildFilters Statement HiLink jForms Statement HiLink jFormFilters Statement delcommand HiLink endif let b:current_syntax = 'jquery'


评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值