syntax.txt 206 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127312831293130313131323133313431353136313731383139314031413142314331443145314631473148314931503151315231533154315531563157315831593160316131623163316431653166316731683169317031713172317331743175317631773178317931803181318231833184318531863187318831893190319131923193319431953196319731983199320032013202320332043205320632073208320932103211321232133214321532163217321832193220322132223223322432253226322732283229323032313232323332343235323632373238323932403241324232433244324532463247324832493250325132523253325432553256325732583259326032613262326332643265326632673268326932703271327232733274327532763277327832793280328132823283328432853286328732883289329032913292329332943295329632973298329933003301330233033304330533063307330833093310331133123313331433153316331733183319332033213322332333243325332633273328332933303331333233333334333533363337333833393340334133423343334433453346334733483349335033513352335333543355335633573358335933603361336233633364336533663367336833693370337133723373337433753376337733783379338033813382338333843385338633873388338933903391339233933394339533963397339833993400340134023403340434053406340734083409341034113412341334143415341634173418341934203421342234233424342534263427342834293430343134323433343434353436343734383439344034413442344334443445344634473448344934503451345234533454345534563457345834593460346134623463346434653466346734683469347034713472347334743475347634773478347934803481348234833484348534863487348834893490349134923493349434953496349734983499350035013502350335043505350635073508350935103511351235133514351535163517351835193520352135223523352435253526352735283529353035313532353335343535353635373538353935403541354235433544354535463547354835493550355135523553355435553556355735583559356035613562356335643565356635673568356935703571357235733574357535763577357835793580358135823583358435853586358735883589359035913592359335943595359635973598359936003601360236033604360536063607360836093610361136123613361436153616361736183619362036213622362336243625362636273628362936303631363236333634363536363637363836393640364136423643364436453646364736483649365036513652365336543655365636573658365936603661366236633664366536663667366836693670367136723673367436753676367736783679368036813682368336843685368636873688368936903691369236933694369536963697369836993700370137023703370437053706370737083709371037113712371337143715371637173718371937203721372237233724372537263727372837293730373137323733373437353736373737383739374037413742374337443745374637473748374937503751375237533754375537563757375837593760376137623763376437653766376737683769377037713772377337743775377637773778377937803781378237833784378537863787378837893790379137923793379437953796379737983799380038013802380338043805380638073808380938103811381238133814381538163817381838193820382138223823382438253826382738283829383038313832383338343835383638373838383938403841384238433844384538463847384838493850385138523853385438553856385738583859386038613862386338643865386638673868386938703871387238733874387538763877387838793880388138823883388438853886388738883889389038913892389338943895389638973898389939003901390239033904390539063907390839093910391139123913391439153916391739183919392039213922392339243925392639273928392939303931393239333934393539363937393839393940394139423943394439453946394739483949395039513952395339543955395639573958395939603961396239633964396539663967396839693970397139723973397439753976397739783979398039813982398339843985398639873988398939903991399239933994399539963997399839994000400140024003400440054006400740084009401040114012401340144015401640174018401940204021402240234024402540264027402840294030403140324033403440354036403740384039404040414042404340444045404640474048404940504051405240534054405540564057405840594060406140624063406440654066406740684069407040714072407340744075407640774078407940804081408240834084408540864087408840894090409140924093409440954096409740984099410041014102410341044105410641074108410941104111411241134114411541164117411841194120412141224123412441254126412741284129413041314132413341344135413641374138413941404141414241434144414541464147414841494150415141524153415441554156415741584159416041614162416341644165416641674168416941704171417241734174417541764177417841794180418141824183418441854186418741884189419041914192419341944195419641974198419942004201420242034204420542064207420842094210421142124213421442154216421742184219422042214222422342244225422642274228422942304231423242334234423542364237423842394240424142424243424442454246424742484249425042514252425342544255425642574258425942604261426242634264426542664267426842694270427142724273427442754276427742784279428042814282428342844285428642874288428942904291429242934294429542964297429842994300430143024303430443054306430743084309431043114312431343144315431643174318431943204321432243234324432543264327432843294330433143324333433443354336433743384339434043414342434343444345434643474348434943504351435243534354435543564357435843594360436143624363436443654366436743684369437043714372437343744375437643774378437943804381438243834384438543864387438843894390439143924393439443954396439743984399440044014402440344044405440644074408440944104411441244134414441544164417441844194420442144224423442444254426442744284429443044314432443344344435443644374438443944404441444244434444444544464447444844494450445144524453445444554456445744584459446044614462446344644465446644674468446944704471447244734474447544764477447844794480448144824483448444854486448744884489449044914492449344944495449644974498449945004501450245034504450545064507450845094510451145124513451445154516451745184519452045214522452345244525452645274528452945304531453245334534453545364537453845394540454145424543454445454546454745484549455045514552455345544555455645574558455945604561456245634564456545664567456845694570457145724573457445754576457745784579458045814582458345844585458645874588458945904591459245934594459545964597459845994600460146024603460446054606460746084609461046114612461346144615461646174618461946204621462246234624462546264627462846294630463146324633463446354636463746384639464046414642464346444645464646474648464946504651465246534654465546564657465846594660466146624663466446654666466746684669467046714672467346744675467646774678467946804681468246834684468546864687468846894690469146924693469446954696469746984699470047014702470347044705470647074708470947104711471247134714471547164717471847194720472147224723472447254726472747284729473047314732473347344735473647374738473947404741474247434744474547464747474847494750475147524753475447554756475747584759476047614762476347644765476647674768476947704771477247734774477547764777477847794780478147824783478447854786478747884789479047914792479347944795479647974798479948004801480248034804480548064807480848094810481148124813481448154816481748184819482048214822482348244825482648274828482948304831483248334834483548364837483848394840484148424843484448454846484748484849485048514852485348544855485648574858485948604861486248634864486548664867486848694870487148724873487448754876487748784879488048814882488348844885488648874888488948904891489248934894489548964897489848994900490149024903490449054906490749084909491049114912491349144915491649174918491949204921492249234924492549264927492849294930493149324933493449354936493749384939494049414942494349444945494649474948494949504951495249534954495549564957495849594960496149624963496449654966496749684969497049714972497349744975497649774978497949804981498249834984498549864987498849894990499149924993499449954996499749984999500050015002500350045005500650075008500950105011501250135014501550165017501850195020502150225023502450255026502750285029503050315032503350345035503650375038503950405041504250435044504550465047504850495050505150525053505450555056505750585059506050615062506350645065506650675068506950705071507250735074507550765077507850795080508150825083508450855086508750885089509050915092509350945095509650975098509951005101510251035104510551065107510851095110511151125113511451155116511751185119512051215122512351245125512651275128512951305131513251335134513551365137513851395140514151425143514451455146514751485149515051515152515351545155515651575158515951605161516251635164516551665167516851695170517151725173517451755176517751785179518051815182518351845185518651875188518951905191519251935194519551965197519851995200520152025203520452055206520752085209521052115212521352145215521652175218521952205221522252235224522552265227522852295230523152325233523452355236523752385239524052415242524352445245524652475248524952505251525252535254525552565257525852595260526152625263526452655266526752685269527052715272527352745275527652775278527952805281528252835284528552865287528852895290529152925293529452955296529752985299530053015302530353045305530653075308530953105311531253135314531553165317531853195320532153225323532453255326532753285329533053315332533353345335
  1. *syntax.txt* Nvim
  2. VIM REFERENCE MANUAL by Bram Moolenaar
  3. Syntax highlighting *syntax* *syntax-highlighting* *coloring*
  4. Syntax highlighting enables Vim to show parts of the text in another font or
  5. color. Those parts can be specific keywords or text matching a pattern. Vim
  6. doesn't parse the whole file (to keep it fast), so the highlighting has its
  7. limitations. Lexical highlighting might be a better name, but since everybody
  8. calls it syntax highlighting we'll stick with that.
  9. Vim supports syntax highlighting on all terminals. But since most ordinary
  10. terminals have very limited highlighting possibilities, it works best in the
  11. GUI version, gvim.
  12. In the User Manual:
  13. |usr_06.txt| introduces syntax highlighting.
  14. |usr_44.txt| introduces writing a syntax file.
  15. Type |gO| to see the table of contents.
  16. ==============================================================================
  17. 1. Quick start *:syn-qstart*
  18. *:syn-enable* *:syntax-enable*
  19. This command switches on syntax highlighting: >
  20. :syntax enable
  21. What this command actually does is to execute the command >
  22. :source $VIMRUNTIME/syntax/syntax.vim
  23. If the VIM environment variable is not set, Vim will try to find
  24. the path in another way (see |$VIMRUNTIME|). Usually this works just
  25. fine. If it doesn't, try setting the VIM environment variable to the
  26. directory where the Vim stuff is located. For example, if your syntax files
  27. are in the "/usr/vim/vim50/syntax" directory, set $VIMRUNTIME to
  28. "/usr/vim/vim50". You must do this in the shell, before starting Vim.
  29. This command also sources the |menu.vim| script when the GUI is running or
  30. will start soon. See |'go-M'| about avoiding that.
  31. *:syn-on* *:syntax-on*
  32. The `:syntax enable` command will keep your current color settings. This
  33. allows using `:highlight` commands to set your preferred colors before or
  34. after using this command. If you want Vim to overrule your settings with the
  35. defaults, use: >
  36. :syntax on
  37. <
  38. *:hi-normal* *:highlight-normal*
  39. If you are running in the GUI, you can get white text on a black background
  40. with: >
  41. :highlight Normal guibg=Black guifg=White
  42. For a color terminal see |:hi-normal-cterm|.
  43. For setting up your own colors syntax highlighting see |syncolor|.
  44. NOTE: The syntax files on Windows have lines that end in <CR><NL>. The files
  45. for Unix end in <NL>. This means you should use the right type of file for
  46. your system. Although on Windows the right format is automatically selected
  47. if the 'fileformats' option is not empty.
  48. NOTE: When using reverse video ("gvim -fg white -bg black"), the default value
  49. of 'background' will not be set until the GUI window is opened, which is after
  50. reading the |gvimrc|. This will cause the wrong default highlighting to be
  51. used. To set the default value of 'background' before switching on
  52. highlighting, include the ":gui" command in the |gvimrc|: >
  53. :gui " open window and set default for 'background'
  54. :syntax on " start highlighting, use 'background' to set colors
  55. NOTE: Using ":gui" in the |gvimrc| means that "gvim -f" won't start in the
  56. foreground! Use ":gui -f" then.
  57. *g:syntax_on*
  58. You can toggle the syntax on/off with this command: >
  59. :if exists("g:syntax_on") | syntax off | else | syntax enable | endif
  60. To put this into a mapping, you can use: >
  61. :map <F7> :if exists("g:syntax_on") <Bar>
  62. \ syntax off <Bar>
  63. \ else <Bar>
  64. \ syntax enable <Bar>
  65. \ endif <CR>
  66. [using the |<>| notation, type this literally]
  67. Details:
  68. The ":syntax" commands are implemented by sourcing a file. To see exactly how
  69. this works, look in the file:
  70. command file ~
  71. :syntax enable $VIMRUNTIME/syntax/syntax.vim
  72. :syntax on $VIMRUNTIME/syntax/syntax.vim
  73. :syntax manual $VIMRUNTIME/syntax/manual.vim
  74. :syntax off $VIMRUNTIME/syntax/nosyntax.vim
  75. Also see |syntax-loading|.
  76. NOTE: If displaying long lines is slow and switching off syntax highlighting
  77. makes it fast, consider setting the 'synmaxcol' option to a lower value.
  78. ==============================================================================
  79. 2. Syntax files *:syn-files*
  80. The syntax and highlighting commands for one language are normally stored in
  81. a syntax file. The name convention is: "{name}.vim". Where {name} is the
  82. name of the language, or an abbreviation (to fit the name in 8.3 characters,
  83. a requirement in case the file is used on a DOS filesystem).
  84. Examples:
  85. c.vim perl.vim java.vim html.vim
  86. cpp.vim sh.vim csh.vim
  87. The syntax file can contain any Ex commands, just like a vimrc file. But
  88. the idea is that only commands for a specific language are included. When a
  89. language is a superset of another language, it may include the other one,
  90. for example, the cpp.vim file could include the c.vim file: >
  91. :so $VIMRUNTIME/syntax/c.vim
  92. The .vim files are normally loaded with an autocommand. For example: >
  93. :au Syntax c runtime! syntax/c.vim
  94. :au Syntax cpp runtime! syntax/cpp.vim
  95. These commands are normally in the file $VIMRUNTIME/syntax/synload.vim.
  96. MAKING YOUR OWN SYNTAX FILES *mysyntaxfile*
  97. When you create your own syntax files, and you want to have Vim use these
  98. automatically with ":syntax enable", do this:
  99. 1. Create your user runtime directory. You would normally use the first item
  100. of the 'runtimepath' option. Example for Unix: >
  101. mkdir ~/.config/nvim
  102. 2. Create a directory in there called "syntax". For Unix: >
  103. mkdir ~/.config/nvim/syntax
  104. 3. Write the Vim syntax file. Or download one from the internet. Then write
  105. it in your syntax directory. For example, for the "mine" syntax: >
  106. :w ~/.config/nvim/syntax/mine.vim
  107. Now you can start using your syntax file manually: >
  108. :set syntax=mine
  109. You don't have to exit Vim to use this.
  110. If you also want Vim to detect the type of file, see |new-filetype|.
  111. If you are setting up a system with many users and you don't want each user
  112. to add the same syntax file, you can use another directory from 'runtimepath'.
  113. ADDING TO AN EXISTING SYNTAX FILE *mysyntaxfile-add*
  114. If you are mostly satisfied with an existing syntax file, but would like to
  115. add a few items or change the highlighting, follow these steps:
  116. 1. Create your user directory from 'runtimepath', see above.
  117. 2. Create a directory in there called "after/syntax". For Unix: >
  118. mkdir ~/.config/nvim/after
  119. mkdir ~/.config/nvim/after/syntax
  120. 3. Write a Vim script that contains the commands you want to use. For
  121. example, to change the colors for the C syntax: >
  122. highlight cComment ctermfg=Green guifg=Green
  123. 4. Write that file in the "after/syntax" directory. Use the name of the
  124. syntax, with ".vim" added. For our C syntax: >
  125. :w ~/.config/nvim/after/syntax/c.vim
  126. That's it. The next time you edit a C file the Comment color will be
  127. different. You don't even have to restart Vim.
  128. If you have multiple files, you can use the filetype as the directory name.
  129. All the "*.vim" files in this directory will be used, for example:
  130. ~/.config/nvim/after/syntax/c/one.vim
  131. ~/.config/nvim/after/syntax/c/two.vim
  132. REPLACING AN EXISTING SYNTAX FILE *mysyntaxfile-replace*
  133. If you don't like a distributed syntax file, or you have downloaded a new
  134. version, follow the same steps as for |mysyntaxfile| above. Just make sure
  135. that you write the syntax file in a directory that is early in 'runtimepath'.
  136. Vim will only load the first syntax file found, assuming that it sets
  137. b:current_syntax.
  138. NAMING CONVENTIONS *group-name* *{group-name}* *E669* *W18*
  139. A syntax group name is to be used for syntax items that match the same kind of
  140. thing. These are then linked to a highlight group that specifies the color.
  141. A syntax group name doesn't specify any color or attributes itself.
  142. The name for a highlight or syntax group must consist of ASCII letters, digits
  143. and the underscore. As a regexp: "[a-zA-Z0-9_]*". However, Vim does not give
  144. an error when using other characters.
  145. To be able to allow each user to pick his favorite set of colors, there must
  146. be preferred names for highlight groups that are common for many languages.
  147. These are the suggested group names (if syntax highlighting works properly
  148. you can see the actual color, except for "Ignore"):
  149. *Comment any comment
  150. *Constant any constant
  151. String a string constant: "this is a string"
  152. Character a character constant: 'c', '\n'
  153. Number a number constant: 234, 0xff
  154. Boolean a boolean constant: TRUE, false
  155. Float a floating point constant: 2.3e10
  156. *Identifier any variable name
  157. Function function name (also: methods for classes)
  158. *Statement any statement
  159. Conditional if, then, else, endif, switch, etc.
  160. Repeat for, do, while, etc.
  161. Label case, default, etc.
  162. Operator "sizeof", "+", "*", etc.
  163. Keyword any other keyword
  164. Exception try, catch, throw
  165. *PreProc generic Preprocessor
  166. Include preprocessor #include
  167. Define preprocessor #define
  168. Macro same as Define
  169. PreCondit preprocessor #if, #else, #endif, etc.
  170. *Type int, long, char, etc.
  171. StorageClass static, register, volatile, etc.
  172. Structure struct, union, enum, etc.
  173. Typedef A typedef
  174. *Special any special symbol
  175. SpecialChar special character in a constant
  176. Tag you can use CTRL-] on this
  177. Delimiter character that needs attention
  178. SpecialComment special things inside a comment
  179. Debug debugging statements
  180. *Underlined text that stands out, HTML links
  181. *Ignore left blank, hidden |hl-Ignore|
  182. *Error any erroneous construct
  183. *Todo anything that needs extra attention; mostly the
  184. keywords TODO FIXME and XXX
  185. The names marked with * are the preferred groups; the others are minor groups.
  186. For the preferred groups, the "syntax.vim" file contains default highlighting.
  187. The minor groups are linked to the preferred groups, so they get the same
  188. highlighting. You can override these defaults by using ":highlight" commands
  189. after sourcing the "syntax.vim" file.
  190. Note that highlight group names are not case sensitive. "String" and "string"
  191. can be used for the same group.
  192. The following names are reserved and cannot be used as a group name:
  193. NONE ALL ALLBUT contains contained
  194. *hl-Ignore*
  195. When using the Ignore group, you may also consider using the conceal
  196. mechanism. See |conceal|.
  197. ==============================================================================
  198. 3. Syntax loading procedure *syntax-loading*
  199. This explains the details that happen when the command ":syntax enable" is
  200. issued. When Vim initializes itself, it finds out where the runtime files are
  201. located. This is used here as the variable |$VIMRUNTIME|.
  202. ":syntax enable" and ":syntax on" do the following:
  203. Source $VIMRUNTIME/syntax/syntax.vim
  204. |
  205. +- Clear out any old syntax by sourcing $VIMRUNTIME/syntax/nosyntax.vim
  206. |
  207. +- Source first syntax/synload.vim in 'runtimepath'
  208. | |
  209. | +- Setup the colors for syntax highlighting. If a color scheme is
  210. | | defined it is loaded again with ":colors {name}". Otherwise
  211. | | ":runtime! syntax/syncolor.vim" is used. ":syntax on" overrules
  212. | | existing colors, ":syntax enable" only sets groups that weren't
  213. | | set yet.
  214. | |
  215. | +- Set up syntax autocmds to load the appropriate syntax file when
  216. | | the 'syntax' option is set. *synload-1*
  217. | |
  218. | +- Source the user's optional file, from the |mysyntaxfile| variable.
  219. | This is for backwards compatibility with Vim 5.x only. *synload-2*
  220. |
  221. +- Do ":filetype on", which does ":runtime! filetype.vim". It loads any
  222. | filetype.vim files found. It should always Source
  223. | $VIMRUNTIME/filetype.vim, which does the following.
  224. | |
  225. | +- Install autocmds based on suffix to set the 'filetype' option
  226. | | This is where the connection between file name and file type is
  227. | | made for known file types. *synload-3*
  228. | |
  229. | +- Source the user's optional file, from the *myfiletypefile*
  230. | | variable. This is for backwards compatibility with Vim 5.x only.
  231. | | *synload-4*
  232. | |
  233. | +- Install one autocommand which sources scripts.vim when no file
  234. | | type was detected yet. *synload-5*
  235. | |
  236. | +- Source $VIMRUNTIME/menu.vim, to setup the Syntax menu. |menu.vim|
  237. |
  238. +- Install a FileType autocommand to set the 'syntax' option when a file
  239. | type has been detected. *synload-6*
  240. |
  241. +- Execute syntax autocommands to start syntax highlighting for each
  242. already loaded buffer.
  243. Upon loading a file, Vim finds the relevant syntax file as follows:
  244. Loading the file triggers the BufReadPost autocommands.
  245. |
  246. +- If there is a match with one of the autocommands from |synload-3|
  247. | (known file types) or |synload-4| (user's file types), the 'filetype'
  248. | option is set to the file type.
  249. |
  250. +- The autocommand at |synload-5| is triggered. If the file type was not
  251. | found yet, then scripts.vim is searched for in 'runtimepath'. This
  252. | should always load $VIMRUNTIME/scripts.vim, which does the following.
  253. | |
  254. | +- Source the user's optional file, from the *myscriptsfile*
  255. | | variable. This is for backwards compatibility with Vim 5.x only.
  256. | |
  257. | +- If the file type is still unknown, check the contents of the file,
  258. | again with checks like "getline(1) =~ pattern" as to whether the
  259. | file type can be recognized, and set 'filetype'.
  260. |
  261. +- When the file type was determined and 'filetype' was set, this
  262. | triggers the FileType autocommand |synload-6| above. It sets
  263. | 'syntax' to the determined file type.
  264. |
  265. +- When the 'syntax' option was set above, this triggers an autocommand
  266. | from |synload-1| (and |synload-2|). This find the main syntax file in
  267. | 'runtimepath', with this command:
  268. | runtime! syntax/<name>.vim
  269. |
  270. +- Any other user installed FileType or Syntax autocommands are
  271. triggered. This can be used to change the highlighting for a specific
  272. syntax.
  273. ==============================================================================
  274. 4. Conversion to HTML *2html.vim* *convert-to-HTML*
  275. 2html is not a syntax file itself, but a script that converts the current
  276. window into HTML. Vim opens a new window in which it builds the HTML file.
  277. After you save the resulting file, you can view it with any browser. The
  278. colors should be exactly the same as you see them in Vim. With
  279. |g:html_line_ids| you can jump to specific lines by adding (for example) #L123
  280. or #123 to the end of the URL in your browser's address bar. And with
  281. |g:html_dynamic_folds| enabled, you can show or hide the text that is folded
  282. in Vim.
  283. You are not supposed to set the 'filetype' or 'syntax' option to "2html"!
  284. Source the script to convert the current file: >
  285. :runtime! syntax/2html.vim
  286. <
  287. Many variables affect the output of 2html.vim; see below. Any of the on/off
  288. options listed below can be enabled or disabled by setting them explicitly to
  289. the desired value, or restored to their default by removing the variable using
  290. |:unlet|.
  291. Remarks:
  292. - Some truly ancient browsers may not show the background colors.
  293. - From most browsers you can also print the file (in color)!
  294. - The latest TOhtml may actually work with older versions of Vim, but some
  295. features such as conceal support will not function, and the colors may be
  296. incorrect for an old Vim without GUI support compiled in.
  297. Here is an example how to run the script over all .c and .h files from a
  298. Unix shell: >
  299. for f in *.[ch]; do gvim -f +"syn on" +"run! syntax/2html.vim" +"wq" +"q" $f; done
  300. <
  301. *g:html_start_line* *g:html_end_line*
  302. To restrict the conversion to a range of lines, use a range with the |:TOhtml|
  303. command below, or set "g:html_start_line" and "g:html_end_line" to the first
  304. and last line to be converted. Example, using the last set Visual area: >
  305. :let g:html_start_line = line("'<")
  306. :let g:html_end_line = line("'>")
  307. :runtime! syntax/2html.vim
  308. <
  309. *:TOhtml*
  310. :[range]TOhtml The ":TOhtml" command is defined in a standard plugin.
  311. This command will source |2html.vim| for you. When a
  312. range is given, this command sets |g:html_start_line|
  313. and |g:html_end_line| to the start and end of the
  314. range, respectively. Default range is the entire
  315. buffer.
  316. If the current window is part of a |diff|, unless
  317. |g:html_diff_one_file| is set, :TOhtml will convert
  318. all windows which are part of the diff in the current
  319. tab and place them side-by-side in a <table> element
  320. in the generated HTML. With |g:html_line_ids| you can
  321. jump to lines in specific windows with (for example)
  322. #W1L42 for line 42 in the first diffed window, or
  323. #W3L87 for line 87 in the third.
  324. Examples: >
  325. :10,40TOhtml " convert lines 10-40 to html
  326. :'<,'>TOhtml " convert current/last visual selection
  327. :TOhtml " convert entire buffer
  328. <
  329. *g:html_diff_one_file*
  330. Default: 0.
  331. When 0, and using |:TOhtml| all windows involved in a |diff| in the current tab
  332. page are converted to HTML and placed side-by-side in a <table> element. When
  333. 1, only the current buffer is converted.
  334. Example: >
  335. let g:html_diff_one_file = 1
  336. <
  337. *g:html_whole_filler*
  338. Default: 0.
  339. When 0, if |g:html_diff_one_file| is 1, a sequence of more than 3 filler lines
  340. is displayed as three lines with the middle line mentioning the total number
  341. of inserted lines.
  342. When 1, always display all inserted lines as if |g:html_diff_one_file| were
  343. not set.
  344. >
  345. :let g:html_whole_filler = 1
  346. <
  347. *TOhtml-performance* *g:html_no_progress*
  348. Default: 0.
  349. When 0, display a progress bar in the statusline for each major step in the
  350. 2html.vim conversion process.
  351. When 1, do not display the progress bar. This offers a minor speed improvement
  352. but you won't have any idea how much longer the conversion might take; for big
  353. files it can take a long time!
  354. Example: >
  355. let g:html_no_progress = 1
  356. <
  357. You can obtain better performance improvements by also instructing Vim to not
  358. run interactively, so that too much time is not taken to redraw as the script
  359. moves through the buffer, switches windows, and the like: >
  360. vim -E -s -c "let g:html_no_progress=1" -c "syntax on" -c "set ft=c" -c "runtime syntax/2html.vim" -cwqa myfile.c
  361. <
  362. Note that the -s flag prevents loading your vimrc and any plugins, so you
  363. need to explicitly source/enable anything that will affect the HTML
  364. conversion. See |-E| and |-s-ex| for details. It is probably best to create a
  365. script to replace all the -c commands and use it with the -u flag instead of
  366. specifying each command separately.
  367. *g:html_number_lines*
  368. Default: current 'number' setting.
  369. When 0, buffer text is displayed in the generated HTML without line numbering.
  370. When 1, a column of line numbers is added to the generated HTML with the same
  371. highlighting as the line number column in Vim (|hl-LineNr|).
  372. Force line numbers even if 'number' is not set: >
  373. :let g:html_number_lines = 1
  374. Force to omit the line numbers: >
  375. :let g:html_number_lines = 0
  376. Go back to the default to use 'number' by deleting the variable: >
  377. :unlet g:html_number_lines
  378. <
  379. *g:html_line_ids*
  380. Default: 1 if |g:html_number_lines| is set, 0 otherwise.
  381. When 1, adds an HTML id attribute to each line number, or to an empty <span>
  382. inserted for that purpose if no line numbers are shown. This ID attribute
  383. takes the form of L123 for single-buffer HTML pages, or W2L123 for diff-view
  384. pages, and is used to jump to a specific line (in a specific window of a diff
  385. view). Javascript is inserted to open any closed dynamic folds
  386. (|g:html_dynamic_folds|) containing the specified line before jumping. The
  387. javascript also allows omitting the window ID in the url, and the leading L.
  388. For example: >
  389. page.html#L123 jumps to line 123 in a single-buffer file
  390. page.html#123 does the same
  391. diff.html#W1L42 jumps to line 42 in the first window in a diff
  392. diff.html#42 does the same
  393. <
  394. *g:html_use_css*
  395. Default: 1.
  396. When 1, generate valid HTML 4.01 markup with CSS1 styling, supported in all
  397. modern browsers and most old browsers.
  398. When 0, generate <font> tags and similar outdated markup. This is not
  399. recommended but it may work better in really old browsers, email clients,
  400. forum posts, and similar situations where basic CSS support is unavailable.
  401. Example: >
  402. :let g:html_use_css = 0
  403. <
  404. *g:html_ignore_conceal*
  405. Default: 0.
  406. When 0, concealed text is removed from the HTML and replaced with a character
  407. from |:syn-cchar| or 'listchars' as appropriate, depending on the current
  408. value of 'conceallevel'.
  409. When 1, include all text from the buffer in the generated HTML, even if it is
  410. |conceal|ed.
  411. Either of the following commands will ensure that all text in the buffer is
  412. included in the generated HTML (unless it is folded): >
  413. :let g:html_ignore_conceal = 1
  414. :setl conceallevel=0
  415. <
  416. *g:html_ignore_folding*
  417. Default: 0.
  418. When 0, text in a closed fold is replaced by the text shown for the fold in
  419. Vim (|fold-foldtext|). See |g:html_dynamic_folds| if you also want to allow
  420. the user to expand the fold as in Vim to see the text inside.
  421. When 1, include all text from the buffer in the generated HTML; whether the
  422. text is in a fold has no impact at all. |g:html_dynamic_folds| has no effect.
  423. Either of these commands will ensure that all text in the buffer is included
  424. in the generated HTML (unless it is concealed): >
  425. zR
  426. :let g:html_ignore_folding = 1
  427. <
  428. *g:html_dynamic_folds*
  429. Default: 0.
  430. When 0, text in a closed fold is not included at all in the generated HTML.
  431. When 1, generate javascript to open a fold and show the text within, just like
  432. in Vim.
  433. Setting this variable to 1 causes 2html.vim to always use CSS for styling,
  434. regardless of what |g:html_use_css| is set to.
  435. This variable is ignored when |g:html_ignore_folding| is set.
  436. >
  437. :let g:html_dynamic_folds = 1
  438. <
  439. *g:html_no_foldcolumn*
  440. Default: 0.
  441. When 0, if |g:html_dynamic_folds| is 1, generate a column of text similar to
  442. Vim's foldcolumn (|fold-foldcolumn|) the user can click on to toggle folds
  443. open or closed. The minimum width of the generated text column is the current
  444. 'foldcolumn' setting.
  445. When 1, do not generate this column; instead, hovering the mouse cursor over
  446. folded text will open the fold as if |g:html_hover_unfold| were set.
  447. >
  448. :let g:html_no_foldcolumn = 1
  449. <
  450. *TOhtml-uncopyable-text* *g:html_prevent_copy*
  451. Default: empty string.
  452. This option prevents certain regions of the generated HTML from being copied,
  453. when you select all text in document rendered in a browser and copy it. Useful
  454. for allowing users to copy-paste only the source text even if a fold column or
  455. line numbers are shown in the generated content. Specify regions to be
  456. affected in this way as follows:
  457. f: fold column
  458. n: line numbers (also within fold text)
  459. t: fold text
  460. d: diff filler
  461. Example, to make the fold column and line numbers uncopyable: >
  462. :let g:html_prevent_copy = "fn"
  463. <
  464. This feature is currently implemented by inserting read-only <input> elements
  465. into the markup to contain the uncopyable areas. This does not work well in
  466. all cases. When pasting to some applications which understand HTML, the
  467. <input> elements also get pasted. But plain-text paste destinations should
  468. always work.
  469. *g:html_no_invalid*
  470. Default: 0.
  471. When 0, if |g:html_prevent_copy| is non-empty, an invalid attribute is
  472. intentionally inserted into the <input> element for the uncopyable areas. This
  473. increases the number of applications you can paste to without also pasting the
  474. <input> elements. Specifically, Microsoft Word will not paste the <input>
  475. elements if they contain this invalid attribute.
  476. When 1, no invalid markup is ever intentionally inserted, and the generated
  477. page should validate. However, be careful pasting into Microsoft Word when
  478. |g:html_prevent_copy| is non-empty; it can be hard to get rid of the <input>
  479. elements which get pasted.
  480. *g:html_hover_unfold*
  481. Default: 0.
  482. When 0, the only way to open a fold generated by 2html.vim with
  483. |g:html_dynamic_folds| set, is to click on the generated fold column.
  484. When 1, use CSS 2.0 to allow the user to open a fold by moving the mouse
  485. cursor over the displayed fold text. This is useful to allow users with
  486. disabled javascript to view the folded text.
  487. Note that old browsers (notably Internet Explorer 6) will not support this
  488. feature. Browser-specific markup for IE6 is included to fall back to the
  489. normal CSS1 styling so that the folds show up correctly for this browser, but
  490. they will not be openable without a foldcolumn.
  491. >
  492. :let g:html_hover_unfold = 1
  493. <
  494. *g:html_id_expr*
  495. Default: ""
  496. Dynamic folding and jumping to line IDs rely on unique IDs within the document
  497. to work. If generated HTML is copied into a larger document, these IDs are no
  498. longer guaranteed to be unique. Set g:html_id_expr to an expression Vim can
  499. evaluate to get a unique string to append to each ID used in a given document,
  500. so that the full IDs will be unique even when combined with other content in a
  501. larger HTML document. Example, to append _ and the buffer number to each ID: >
  502. :let g:html_id_expr = '"_".bufnr("%")'
  503. <
  504. To append a string "_mystring" to the end of each ID: >
  505. :let g:html_id_expr = '"_mystring"'
  506. <
  507. Note, when converting a diff view to HTML, the expression will only be
  508. evaluated for the first window in the diff, and the result used for all the
  509. windows.
  510. *TOhtml-wrap-text* *g:html_pre_wrap*
  511. Default: current 'wrap' setting.
  512. When 0, if |g:html_no_pre| is 0 or unset, the text in the generated HTML does
  513. not wrap at the edge of the browser window.
  514. When 1, if |g:html_use_css| is 1, the CSS 2.0 "white-space:pre-wrap" value is
  515. used, causing the text to wrap at whitespace at the edge of the browser
  516. window.
  517. Explicitly enable text wrapping: >
  518. :let g:html_pre_wrap = 1
  519. Explicitly disable wrapping: >
  520. :let g:html_pre_wrap = 0
  521. Go back to default, determine wrapping from 'wrap' setting: >
  522. :unlet g:html_pre_wrap
  523. <
  524. *g:html_no_pre*
  525. Default: 0.
  526. When 0, buffer text in the generated HTML is surrounded by <pre>...</pre>
  527. tags. Series of whitespace is shown as in Vim without special markup, and tab
  528. characters can be included literally (see |g:html_expand_tabs|).
  529. When 1 (not recommended), the <pre> tags are omitted, and a plain <div> is
  530. used instead. Whitespace is replaced by a series of &nbsp; character
  531. references, and <br> is used to end each line. This is another way to allow
  532. text in the generated HTML is wrap (see |g:html_pre_wrap|) which also works in
  533. old browsers, but may cause noticeable differences between Vim's display and
  534. the rendered page generated by 2html.vim.
  535. >
  536. :let g:html_no_pre = 1
  537. <
  538. *g:html_expand_tabs*
  539. Default: 0 if 'tabstop' is 8, 'expandtab' is 0, 'vartabstop' is not in use,
  540. and no fold column or line numbers occur in the generated HTML;
  541. 1 otherwise.
  542. When 1, <Tab> characters in the buffer text are replaced with an appropriate
  543. number of space characters, or &nbsp; references if |g:html_no_pre| is 1.
  544. When 0, if |g:html_no_pre| is 0 or unset, <Tab> characters in the buffer text
  545. are included as-is in the generated HTML. This is useful for when you want to
  546. allow copy and paste from a browser without losing the actual whitespace in
  547. the source document. Note that this can easily break text alignment and
  548. indentation in the HTML, unless set by default.
  549. Force |2html.vim| to keep <Tab> characters: >
  550. :let g:html_expand_tabs = 0
  551. <
  552. Force tabs to be expanded: >
  553. :let g:html_expand_tabs = 1
  554. <
  555. *TOhtml-encoding-detect* *TOhtml-encoding*
  556. It is highly recommended to set your desired encoding with
  557. |g:html_use_encoding| for any content which will be placed on a web server.
  558. If you do not specify an encoding, |2html.vim| uses the preferred IANA name
  559. for the current value of 'fileencoding' if set, or 'encoding' if not.
  560. 'encoding' is always used for certain 'buftype' values. 'fileencoding' will be
  561. set to match the chosen document encoding.
  562. Automatic detection works for the encodings mentioned specifically by name in
  563. |encoding-names|, but TOhtml will only automatically use those encodings with
  564. wide browser support. However, you can override this to support specific
  565. encodings that may not be automatically detected by default (see options
  566. below). See http://www.iana.org/assignments/character-sets for the IANA names.
  567. Note, by default all Unicode encodings are converted to UTF-8 with no BOM in
  568. the generated HTML, as recommended by W3C:
  569. http://www.w3.org/International/questions/qa-choosing-encodings
  570. http://www.w3.org/International/questions/qa-byte-order-mark
  571. *g:html_use_encoding*
  572. Default: none, uses IANA name for current 'fileencoding' as above.
  573. To overrule all automatic charset detection, set g:html_use_encoding to the
  574. name of the charset to be used. It is recommended to set this variable to
  575. something widely supported, like UTF-8, for anything you will be hosting on a
  576. webserver: >
  577. :let g:html_use_encoding = "UTF-8"
  578. You can also use this option to omit the line that specifies the charset
  579. entirely, by setting g:html_use_encoding to an empty string (NOT recommended): >
  580. :let g:html_use_encoding = ""
  581. To go back to the automatic mechanism, delete the |g:html_use_encoding|
  582. variable: >
  583. :unlet g:html_use_encoding
  584. <
  585. *g:html_encoding_override*
  586. Default: none, autoload/tohtml.vim contains default conversions for encodings
  587. mentioned by name at |encoding-names|.
  588. This option allows |2html.vim| to detect the correct 'fileencoding' when you
  589. specify an encoding with |g:html_use_encoding| which is not in the default
  590. list of conversions.
  591. This is a dictionary of charset-encoding pairs that will replace existing
  592. pairs automatically detected by TOhtml, or supplement with new pairs.
  593. Detect the HTML charset "windows-1252" as the encoding "8bit-cp1252": >
  594. :let g:html_encoding_override = {'windows-1252': '8bit-cp1252'}
  595. <
  596. *g:html_charset_override*
  597. Default: none, autoload/tohtml.vim contains default conversions for encodings
  598. mentioned by name at |encoding-names| and which have wide
  599. browser support.
  600. This option allows |2html.vim| to detect the HTML charset for any
  601. 'fileencoding' or 'encoding' which is not detected automatically. You can also
  602. use it to override specific existing encoding-charset pairs. For example,
  603. TOhtml will by default use UTF-8 for all Unicode/UCS encodings. To use UTF-16
  604. and UTF-32 instead, use: >
  605. :let g:html_charset_override = {'ucs-4': 'UTF-32', 'utf-16': 'UTF-16'}
  606. Note that documents encoded in either UTF-32 or UTF-16 have known
  607. compatibility problems with some major browsers.
  608. *g:html_font*
  609. Default: "monospace"
  610. You can specify the font or fonts used in the converted document using
  611. g:html_font. If this option is set to a string, then the value will be
  612. surrounded with single quotes. If this option is set to a list then each list
  613. item is surrounded by single quotes and the list is joined with commas. Either
  614. way, "monospace" is added as the fallback generic family name and the entire
  615. result used as the font family (using CSS) or font face (if not using CSS).
  616. Examples: >
  617. " font-family: 'Consolas', monospace;
  618. :let g:html_font = "Consolas"
  619. " font-family: 'DejaVu Sans Mono', 'Consolas', monospace;
  620. :let g:html_font = ["DejaVu Sans Mono", "Consolas"]
  621. <
  622. *convert-to-XML* *convert-to-XHTML* *g:html_use_xhtml*
  623. Default: 0.
  624. When 0, generate standard HTML 4.01 (strict when possible).
  625. When 1, generate XHTML 1.0 instead (XML compliant HTML).
  626. >
  627. :let g:html_use_xhtml = 1
  628. <
  629. ==============================================================================
  630. 5. Syntax file remarks *:syn-file-remarks*
  631. *b:current_syntax-variable*
  632. Vim stores the name of the syntax that has been loaded in the
  633. "b:current_syntax" variable. You can use this if you want to load other
  634. settings, depending on which syntax is active. Example: >
  635. :au BufReadPost * if b:current_syntax == "csh"
  636. :au BufReadPost * do-some-things
  637. :au BufReadPost * endif
  638. ABEL *abel.vim* *ft-abel-syntax*
  639. ABEL highlighting provides some user-defined options. To enable them, assign
  640. any value to the respective variable. Example: >
  641. :let abel_obsolete_ok=1
  642. To disable them use ":unlet". Example: >
  643. :unlet abel_obsolete_ok
  644. Variable Highlight ~
  645. abel_obsolete_ok obsolete keywords are statements, not errors
  646. abel_cpp_comments_illegal do not interpret '//' as inline comment leader
  647. ADA
  648. See |ft-ada-syntax|
  649. ANT *ant.vim* *ft-ant-syntax*
  650. The ant syntax file provides syntax highlighting for javascript and python
  651. by default. Syntax highlighting for other script languages can be installed
  652. by the function AntSyntaxScript(), which takes the tag name as first argument
  653. and the script syntax file name as second argument. Example: >
  654. :call AntSyntaxScript('perl', 'perl.vim')
  655. will install syntax perl highlighting for the following ant code >
  656. <script language = 'perl'><![CDATA[
  657. # everything inside is highlighted as perl
  658. ]]></script>
  659. See |mysyntaxfile-add| for installing script languages permanently.
  660. APACHE *apache.vim* *ft-apache-syntax*
  661. The apache syntax file provides syntax highlighting for Apache HTTP server
  662. version 2.2.3.
  663. *asm.vim* *asmh8300.vim* *nasm.vim* *masm.vim* *asm68k*
  664. ASSEMBLY *ft-asm-syntax* *ft-asmh8300-syntax* *ft-nasm-syntax*
  665. *ft-masm-syntax* *ft-asm68k-syntax* *fasm.vim*
  666. Files matching "*.i" could be Progress or Assembly. If the automatic detection
  667. doesn't work for you, or you don't edit Progress at all, use this in your
  668. startup vimrc: >
  669. :let filetype_i = "asm"
  670. Replace "asm" with the type of assembly you use.
  671. There are many types of assembly languages that all use the same file name
  672. extensions. Therefore you will have to select the type yourself, or add a
  673. line in the assembly file that Vim will recognize. Currently these syntax
  674. files are included:
  675. asm GNU assembly (the default)
  676. asm68k Motorola 680x0 assembly
  677. asmh8300 Hitachi H-8300 version of GNU assembly
  678. ia64 Intel Itanium 64
  679. fasm Flat assembly (http://flatassembler.net)
  680. masm Microsoft assembly (probably works for any 80x86)
  681. nasm Netwide assembly
  682. tasm Turbo Assembly (with opcodes 80x86 up to Pentium, and
  683. MMX)
  684. pic PIC assembly (currently for PIC16F84)
  685. The most flexible is to add a line in your assembly file containing: >
  686. asmsyntax=nasm
  687. Replace "nasm" with the name of the real assembly syntax. This line must be
  688. one of the first five lines in the file. No non-white text must be
  689. immediately before or after this text. Note that specifying asmsyntax=foo is
  690. equivalent to setting ft=foo in a |modeline|, and that in case of a conflict
  691. between the two settings the one from the modeline will take precedence (in
  692. particular, if you have ft=asm in the modeline, you will get the GNU syntax
  693. highlighting regardless of what is specified as asmsyntax).
  694. The syntax type can always be overruled for a specific buffer by setting the
  695. b:asmsyntax variable: >
  696. :let b:asmsyntax = "nasm"
  697. If b:asmsyntax is not set, either automatically or by hand, then the value of
  698. the global variable asmsyntax is used. This can be seen as a default assembly
  699. language: >
  700. :let asmsyntax = "nasm"
  701. As a last resort, if nothing is defined, the "asm" syntax is used.
  702. Netwide assembler (nasm.vim) optional highlighting ~
  703. To enable a feature: >
  704. :let {variable}=1|set syntax=nasm
  705. To disable a feature: >
  706. :unlet {variable} |set syntax=nasm
  707. Variable Highlight ~
  708. nasm_loose_syntax unofficial parser allowed syntax not as Error
  709. (parser dependent; not recommended)
  710. nasm_ctx_outside_macro contexts outside macro not as Error
  711. nasm_no_warn potentially risky syntax not as ToDo
  712. ASPPERL and ASPVBS *ft-aspperl-syntax* *ft-aspvbs-syntax*
  713. *.asp and *.asa files could be either Perl or Visual Basic script. Since it's
  714. hard to detect this you can set two global variables to tell Vim what you are
  715. using. For Perl script use: >
  716. :let g:filetype_asa = "aspperl"
  717. :let g:filetype_asp = "aspperl"
  718. For Visual Basic use: >
  719. :let g:filetype_asa = "aspvbs"
  720. :let g:filetype_asp = "aspvbs"
  721. BAAN *baan.vim* *baan-syntax*
  722. The baan.vim gives syntax support for BaanC of release BaanIV upto SSA ERP LN
  723. for both 3 GL and 4 GL programming. Large number of standard defines/constants
  724. are supported.
  725. Some special violation of coding standards will be signalled when one specify
  726. in ones |init.vim|: >
  727. let baan_code_stds=1
  728. *baan-folding*
  729. Syntax folding can be enabled at various levels through the variables
  730. mentioned below (Set those in your |init.vim|). The more complex folding on
  731. source blocks and SQL can be CPU intensive.
  732. To allow any folding and enable folding at function level use: >
  733. let baan_fold=1
  734. Folding can be enabled at source block level as if, while, for ,... The
  735. indentation preceding the begin/end keywords has to match (spaces are not
  736. considered equal to a tab). >
  737. let baan_fold_block=1
  738. Folding can be enabled for embedded SQL blocks as SELECT, SELECTDO,
  739. SELECTEMPTY, ... The indentation preceding the begin/end keywords has to
  740. match (spaces are not considered equal to a tab). >
  741. let baan_fold_sql=1
  742. Note: Block folding can result in many small folds. It is suggested to |:set|
  743. the options 'foldminlines' and 'foldnestmax' in |init.vim| or use |:setlocal|
  744. in .../after/syntax/baan.vim (see |after-directory|). Eg: >
  745. set foldminlines=5
  746. set foldnestmax=6
  747. BASIC *basic.vim* *vb.vim* *ft-basic-syntax* *ft-vb-syntax*
  748. Both Visual Basic and "normal" basic use the extension ".bas". To detect
  749. which one should be used, Vim checks for the string "VB_Name" in the first
  750. five lines of the file. If it is not found, filetype will be "basic",
  751. otherwise "vb". Files with the ".frm" extension will always be seen as Visual
  752. Basic.
  753. C *c.vim* *ft-c-syntax*
  754. A few things in C highlighting are optional. To enable them assign any value
  755. to the respective variable. Example: >
  756. :let c_comment_strings = 1
  757. To disable them use ":unlet". Example: >
  758. :unlet c_comment_strings
  759. An alternative is to switch to the C++ highlighting: >
  760. :set filetype=cpp
  761. Variable Highlight ~
  762. *c_gnu* GNU gcc specific items
  763. *c_comment_strings* strings and numbers inside a comment
  764. *c_space_errors* trailing white space and spaces before a <Tab>
  765. *c_no_trail_space_error* ... but no trailing spaces
  766. *c_no_tab_space_error* ... but no spaces before a <Tab>
  767. *c_no_bracket_error* don't highlight {}; inside [] as errors
  768. *c_no_curly_error* don't highlight {}; inside [] and () as errors;
  769. except { and } in first column
  770. Default is to highlight them, otherwise you
  771. can't spot a missing ")".
  772. *c_curly_error* highlight a missing }; this forces syncing from the
  773. start of the file, can be slow
  774. *c_no_ansi* don't do standard ANSI types and constants
  775. *c_ansi_typedefs* ... but do standard ANSI types
  776. *c_ansi_constants* ... but do standard ANSI constants
  777. *c_no_utf* don't highlight \u and \U in strings
  778. *c_syntax_for_h* for *.h files use C syntax instead of C++ and use objc
  779. syntax instead of objcpp
  780. *c_no_if0* don't highlight "#if 0" blocks as comments
  781. *c_no_cformat* don't highlight %-formats in strings
  782. *c_no_c99* don't highlight C99 standard items
  783. *c_no_c11* don't highlight C11 standard items
  784. *c_no_bsd* don't highlight BSD specific types
  785. When 'foldmethod' is set to "syntax" then /* */ comments and { } blocks will
  786. become a fold. If you don't want comments to become a fold use: >
  787. :let c_no_comment_fold = 1
  788. "#if 0" blocks are also folded, unless: >
  789. :let c_no_if0_fold = 1
  790. If you notice highlighting errors while scrolling backwards, which are fixed
  791. when redrawing with CTRL-L, try setting the "c_minlines" internal variable
  792. to a larger number: >
  793. :let c_minlines = 100
  794. This will make the syntax synchronization start 100 lines before the first
  795. displayed line. The default value is 50 (15 when c_no_if0 is set). The
  796. disadvantage of using a larger number is that redrawing can become slow.
  797. When using the "#if 0" / "#endif" comment highlighting, notice that this only
  798. works when the "#if 0" is within "c_minlines" from the top of the window. If
  799. you have a long "#if 0" construct it will not be highlighted correctly.
  800. To match extra items in comments, use the cCommentGroup cluster.
  801. Example: >
  802. :au Syntax c call MyCadd()
  803. :function MyCadd()
  804. : syn keyword cMyItem contained Ni
  805. : syn cluster cCommentGroup add=cMyItem
  806. : hi link cMyItem Title
  807. :endfun
  808. ANSI constants will be highlighted with the "cConstant" group. This includes
  809. "NULL", "SIG_IGN" and others. But not "TRUE", for example, because this is
  810. not in the ANSI standard. If you find this confusing, remove the cConstant
  811. highlighting: >
  812. :hi link cConstant NONE
  813. If you see '{' and '}' highlighted as an error where they are OK, reset the
  814. highlighting for cErrInParen and cErrInBracket.
  815. If you want to use folding in your C files, you can add these lines in a file
  816. in the "after" directory in 'runtimepath'. For Unix this would be
  817. ~/.config/nvim/after/syntax/c.vim. >
  818. syn sync fromstart
  819. set foldmethod=syntax
  820. CH *ch.vim* *ft-ch-syntax*
  821. C/C++ interpreter. Ch has similar syntax highlighting to C and builds upon
  822. the C syntax file. See |c.vim| for all the settings that are available for C.
  823. By setting a variable you can tell Vim to use Ch syntax for *.h files, instead
  824. of C or C++: >
  825. :let ch_syntax_for_h = 1
  826. CHILL *chill.vim* *ft-chill-syntax*
  827. Chill syntax highlighting is similar to C. See |c.vim| for all the settings
  828. that are available. Additionally there is:
  829. chill_space_errors like c_space_errors
  830. chill_comment_string like c_comment_strings
  831. chill_minlines like c_minlines
  832. CHANGELOG *changelog.vim* *ft-changelog-syntax*
  833. ChangeLog supports highlighting spaces at the start of a line.
  834. If you do not like this, add following line to your vimrc: >
  835. let g:changelog_spacing_errors = 0
  836. This works the next time you edit a changelog file. You can also use
  837. "b:changelog_spacing_errors" to set this per buffer (before loading the syntax
  838. file).
  839. You can change the highlighting used, e.g., to flag the spaces as an error: >
  840. :hi link ChangelogError Error
  841. Or to avoid the highlighting: >
  842. :hi link ChangelogError NONE
  843. This works immediately.
  844. CLOJURE *ft-clojure-syntax*
  845. The default syntax groups can be augmented through the
  846. *g:clojure_syntax_keywords* and *b:clojure_syntax_keywords* variables. The
  847. value should be a |Dictionary| of syntax group names to a |List| of custom
  848. identifiers:
  849. >
  850. let g:clojure_syntax_keywords = {
  851. \ 'clojureMacro': ["defproject", "defcustom"],
  852. \ 'clojureFunc': ["string/join", "string/replace"]
  853. \ }
  854. <
  855. Refer to the Clojure syntax script for valid syntax group names.
  856. If the |buffer-variable| *b:clojure_syntax_without_core_keywords* is set, only
  857. language constants and special forms are matched.
  858. Setting *g:clojure_fold* enables folding Clojure code via the syntax engine.
  859. Any list, vector, or map that extends over more than one line can be folded
  860. using the standard Vim |fold-commands|.
  861. Please note that this option does not work with scripts that redefine the
  862. bracket syntax regions, such as rainbow-parentheses plugins.
  863. This option is off by default.
  864. >
  865. " Default
  866. let g:clojure_fold = 0
  867. <
  868. COBOL *cobol.vim* *ft-cobol-syntax*
  869. COBOL highlighting has different needs for legacy code than it does for fresh
  870. development. This is due to differences in what is being done (maintenance
  871. versus development) and other factors. To enable legacy code highlighting,
  872. add this line to your vimrc: >
  873. :let cobol_legacy_code = 1
  874. To disable it again, use this: >
  875. :unlet cobol_legacy_code
  876. COLD FUSION *coldfusion.vim* *ft-coldfusion-syntax*
  877. The ColdFusion has its own version of HTML comments. To turn on ColdFusion
  878. comment highlighting, add the following line to your startup file: >
  879. :let html_wrong_comments = 1
  880. The ColdFusion syntax file is based on the HTML syntax file.
  881. CPP *cpp.vim* *ft-cpp-syntax*
  882. Most of things are same as |ft-c-syntax|.
  883. Variable Highlight ~
  884. cpp_no_cpp11 don't highlight C++11 standard items
  885. cpp_no_cpp14 don't highlight C++14 standard items
  886. CSH *csh.vim* *ft-csh-syntax*
  887. This covers the shell named "csh". Note that on some systems tcsh is actually
  888. used.
  889. Detecting whether a file is csh or tcsh is notoriously hard. Some systems
  890. symlink /bin/csh to /bin/tcsh, making it almost impossible to distinguish
  891. between csh and tcsh. In case VIM guesses wrong you can set the
  892. "filetype_csh" variable. For using csh: *g:filetype_csh*
  893. >
  894. :let g:filetype_csh = "csh"
  895. For using tcsh: >
  896. :let g:filetype_csh = "tcsh"
  897. Any script with a tcsh extension or a standard tcsh filename (.tcshrc,
  898. tcsh.tcshrc, tcsh.login) will have filetype tcsh. All other tcsh/csh scripts
  899. will be classified as tcsh, UNLESS the "filetype_csh" variable exists. If the
  900. "filetype_csh" variable exists, the filetype will be set to the value of the
  901. variable.
  902. CYNLIB *cynlib.vim* *ft-cynlib-syntax*
  903. Cynlib files are C++ files that use the Cynlib class library to enable
  904. hardware modelling and simulation using C++. Typically Cynlib files have a .cc
  905. or a .cpp extension, which makes it very difficult to distinguish them from a
  906. normal C++ file. Thus, to enable Cynlib highlighting for .cc files, add this
  907. line to your vimrc file: >
  908. :let cynlib_cyntax_for_cc=1
  909. Similarly for cpp files (this extension is only usually used in Windows) >
  910. :let cynlib_cyntax_for_cpp=1
  911. To disable these again, use this: >
  912. :unlet cynlib_cyntax_for_cc
  913. :unlet cynlib_cyntax_for_cpp
  914. <
  915. CWEB *cweb.vim* *ft-cweb-syntax*
  916. Files matching "*.w" could be Progress or cweb. If the automatic detection
  917. doesn't work for you, or you don't edit Progress at all, use this in your
  918. startup vimrc: >
  919. :let filetype_w = "cweb"
  920. DESKTOP *desktop.vim* *ft-desktop-syntax*
  921. Primary goal of this syntax file is to highlight .desktop and .directory files
  922. according to freedesktop.org standard:
  923. http://standards.freedesktop.org/desktop-entry-spec/latest/
  924. But actually almost none implements this standard fully. Thus it will
  925. highlight all Unix ini files. But you can force strict highlighting according
  926. to standard by placing this in your vimrc file: >
  927. :let enforce_freedesktop_standard = 1
  928. DIFF *diff.vim*
  929. The diff highlighting normally finds translated headers. This can be slow if
  930. there are very long lines in the file. To disable translations: >
  931. :let diff_translations = 0
  932. Also see |diff-slow|.
  933. DIRCOLORS *dircolors.vim* *ft-dircolors-syntax*
  934. The dircolors utility highlighting definition has one option. It exists to
  935. provide compatibility with the Slackware GNU/Linux distributions version of
  936. the command. It adds a few keywords that are generally ignored by most
  937. versions. On Slackware systems, however, the utility accepts the keywords and
  938. uses them for processing. To enable the Slackware keywords add the following
  939. line to your startup file: >
  940. let dircolors_is_slackware = 1
  941. DOCBOOK *docbk.vim* *ft-docbk-syntax* *docbook*
  942. DOCBOOK XML *docbkxml.vim* *ft-docbkxml-syntax*
  943. DOCBOOK SGML *docbksgml.vim* *ft-docbksgml-syntax*
  944. There are two types of DocBook files: SGML and XML. To specify what type you
  945. are using the "b:docbk_type" variable should be set. Vim does this for you
  946. automatically if it can recognize the type. When Vim can't guess it the type
  947. defaults to XML.
  948. You can set the type manually: >
  949. :let docbk_type = "sgml"
  950. or: >
  951. :let docbk_type = "xml"
  952. You need to do this before loading the syntax file, which is complicated.
  953. Simpler is setting the filetype to "docbkxml" or "docbksgml": >
  954. :set filetype=docbksgml
  955. or: >
  956. :set filetype=docbkxml
  957. You can specify the DocBook version: >
  958. :let docbk_ver = 3
  959. When not set 4 is used.
  960. DOSBATCH *dosbatch.vim* *ft-dosbatch-syntax*
  961. There is one option with highlighting DOS batch files. This covers new
  962. extensions to the Command Interpreter introduced with Windows 2000 and
  963. is controlled by the variable dosbatch_cmdextversion. For Windows NT
  964. this should have the value 1, and for Windows 2000 it should be 2.
  965. Select the version you want with the following line: >
  966. :let dosbatch_cmdextversion = 1
  967. If this variable is not defined it defaults to a value of 2 to support
  968. Windows 2000.
  969. A second option covers whether *.btm files should be detected as type
  970. "dosbatch" (MS-DOS batch files) or type "btm" (4DOS batch files). The latter
  971. is used by default. You may select the former with the following line: >
  972. :let g:dosbatch_syntax_for_btm = 1
  973. If this variable is undefined or zero, btm syntax is selected.
  974. DOXYGEN *doxygen.vim* *doxygen-syntax*
  975. Doxygen generates code documentation using a special documentation format
  976. (similar to Javadoc). This syntax script adds doxygen highlighting to c, cpp,
  977. idl and php files, and should also work with java.
  978. There are a few of ways to turn on doxygen formatting. It can be done
  979. explicitly or in a modeline by appending '.doxygen' to the syntax of the file.
  980. Example: >
  981. :set syntax=c.doxygen
  982. or >
  983. // vim:syntax=c.doxygen
  984. It can also be done automatically for C, C++, C#, IDL and PHP files by setting
  985. the global or buffer-local variable load_doxygen_syntax. This is done by
  986. adding the following to your vimrc. >
  987. :let g:load_doxygen_syntax=1
  988. There are a couple of variables that have an effect on syntax highlighting, and
  989. are to do with non-standard highlighting options.
  990. Variable Default Effect ~
  991. g:doxygen_enhanced_color
  992. g:doxygen_enhanced_colour 0 Use non-standard highlighting for
  993. doxygen comments.
  994. doxygen_my_rendering 0 Disable rendering of HTML bold, italic
  995. and html_my_rendering underline.
  996. doxygen_javadoc_autobrief 1 Set to 0 to disable javadoc autobrief
  997. colour highlighting.
  998. doxygen_end_punctuation '[.]' Set to regexp match for the ending
  999. punctuation of brief
  1000. There are also some highlight groups worth mentioning as they can be useful in
  1001. configuration.
  1002. Highlight Effect ~
  1003. doxygenErrorComment The colour of an end-comment when missing
  1004. punctuation in a code, verbatim or dot section
  1005. doxygenLinkError The colour of an end-comment when missing the
  1006. \endlink from a \link section.
  1007. DTD *dtd.vim* *ft-dtd-syntax*
  1008. The DTD syntax highlighting is case sensitive by default. To disable
  1009. case-sensitive highlighting, add the following line to your startup file: >
  1010. :let dtd_ignore_case=1
  1011. The DTD syntax file will highlight unknown tags as errors. If
  1012. this is annoying, it can be turned off by setting: >
  1013. :let dtd_no_tag_errors=1
  1014. before sourcing the dtd.vim syntax file.
  1015. Parameter entity names are highlighted in the definition using the
  1016. 'Type' highlighting group and 'Comment' for punctuation and '%'.
  1017. Parameter entity instances are highlighted using the 'Constant'
  1018. highlighting group and the 'Type' highlighting group for the
  1019. delimiters % and ;. This can be turned off by setting: >
  1020. :let dtd_no_param_entities=1
  1021. The DTD syntax file is also included by xml.vim to highlight included dtd's.
  1022. EIFFEL *eiffel.vim* *ft-eiffel-syntax*
  1023. While Eiffel is not case-sensitive, its style guidelines are, and the
  1024. syntax highlighting file encourages their use. This also allows to
  1025. highlight class names differently. If you want to disable case-sensitive
  1026. highlighting, add the following line to your startup file: >
  1027. :let eiffel_ignore_case=1
  1028. Case still matters for class names and TODO marks in comments.
  1029. Conversely, for even stricter checks, add one of the following lines: >
  1030. :let eiffel_strict=1
  1031. :let eiffel_pedantic=1
  1032. Setting eiffel_strict will only catch improper capitalization for the
  1033. five predefined words "Current", "Void", "Result", "Precursor", and
  1034. "NONE", to warn against their accidental use as feature or class names.
  1035. Setting eiffel_pedantic will enforce adherence to the Eiffel style
  1036. guidelines fairly rigorously (like arbitrary mixes of upper- and
  1037. lowercase letters as well as outdated ways to capitalize keywords).
  1038. If you want to use the lower-case version of "Current", "Void",
  1039. "Result", and "Precursor", you can use >
  1040. :let eiffel_lower_case_predef=1
  1041. instead of completely turning case-sensitive highlighting off.
  1042. Support for ISE's proposed new creation syntax that is already
  1043. experimentally handled by some compilers can be enabled by: >
  1044. :let eiffel_ise=1
  1045. Finally, some vendors support hexadecimal constants. To handle them, add >
  1046. :let eiffel_hex_constants=1
  1047. to your startup file.
  1048. EUPHORIA *euphoria3.vim* *euphoria4.vim* *ft-euphoria-syntax*
  1049. Two syntax highlighting files exists for Euphoria. One for Euphoria
  1050. version 3.1.1, which is the default syntax highlighting file, and one for
  1051. Euphoria version 4.0.5 or later.
  1052. Euphoria version 3.1.1 (http://www.rapideuphoria.com/) is still necessary
  1053. for developing applications for the DOS platform, which Euphoria version 4
  1054. (http://www.openeuphoria.org/) does not support.
  1055. The following file extensions are auto-detected as Euphoria file type:
  1056. *.e, *.eu, *.ew, *.ex, *.exu, *.exw
  1057. *.E, *.EU, *.EW, *.EX, *.EXU, *.EXW
  1058. To select syntax highlighting file for Euphoria, as well as for
  1059. auto-detecting the *.e and *.E file extensions as Euphoria file type,
  1060. add the following line to your startup file: >
  1061. :let filetype_euphoria="euphoria3"
  1062. or
  1063. :let filetype_euphoria="euphoria4"
  1064. ERLANG *erlang.vim* *ft-erlang-syntax*
  1065. Erlang is a functional programming language developed by Ericsson. Files with
  1066. the following extensions are recognized as Erlang files: erl, hrl, yaws.
  1067. The BIFs (built-in functions) are highlighted by default. To disable this,
  1068. put the following line in your vimrc: >
  1069. :let g:erlang_highlight_bifs = 0
  1070. To enable highlighting some special atoms, put this in your vimrc: >
  1071. :let g:erlang_highlight_special_atoms = 1
  1072. FLEXWIKI *flexwiki.vim* *ft-flexwiki-syntax*
  1073. FlexWiki is an ASP.NET-based wiki package available at http://www.flexwiki.com
  1074. NOTE: this site currently doesn't work, on Wikipedia is mentioned that
  1075. development stopped in 2009.
  1076. Syntax highlighting is available for the most common elements of FlexWiki
  1077. syntax. The associated ftplugin script sets some buffer-local options to make
  1078. editing FlexWiki pages more convenient. FlexWiki considers a newline as the
  1079. start of a new paragraph, so the ftplugin sets 'tw'=0 (unlimited line length),
  1080. 'wrap' (wrap long lines instead of using horizontal scrolling), 'linebreak'
  1081. (to wrap at a character in 'breakat' instead of at the last char on screen),
  1082. and so on. It also includes some keymaps that are disabled by default.
  1083. If you want to enable the keymaps that make "j" and "k" and the cursor keys
  1084. move up and down by display lines, add this to your vimrc: >
  1085. :let flexwiki_maps = 1
  1086. FORM *form.vim* *ft-form-syntax*
  1087. The coloring scheme for syntax elements in the FORM file uses the default
  1088. modes Conditional, Number, Statement, Comment, PreProc, Type, and String,
  1089. following the language specifications in 'Symbolic Manipulation with FORM' by
  1090. J.A.M. Vermaseren, CAN, Netherlands, 1991.
  1091. If you want include your own changes to the default colors, you have to
  1092. redefine the following syntax groups:
  1093. - formConditional
  1094. - formNumber
  1095. - formStatement
  1096. - formHeaderStatement
  1097. - formComment
  1098. - formPreProc
  1099. - formDirective
  1100. - formType
  1101. - formString
  1102. Note that the form.vim syntax file implements FORM preprocessor commands and
  1103. directives per default in the same syntax group.
  1104. A predefined enhanced color mode for FORM is available to distinguish between
  1105. header statements and statements in the body of a FORM program. To activate
  1106. this mode define the following variable in your vimrc file >
  1107. :let form_enhanced_color=1
  1108. The enhanced mode also takes advantage of additional color features for a dark
  1109. gvim display. Here, statements are colored LightYellow instead of Yellow, and
  1110. conditionals are LightBlue for better distinction.
  1111. FORTRAN *fortran.vim* *ft-fortran-syntax*
  1112. Default highlighting and dialect ~
  1113. Highlighting appropriate for Fortran 2008 is used by default. This choice
  1114. should be appropriate for most users most of the time because Fortran 2008 is
  1115. almost a superset of previous versions (Fortran 2003, 95, 90, and 77).
  1116. Fortran source code form ~
  1117. Fortran code can be in either fixed or free source form. Note that the
  1118. syntax highlighting will not be correct if the form is incorrectly set.
  1119. When you create a new fortran file, the syntax script assumes fixed source
  1120. form. If you always use free source form, then >
  1121. :let fortran_free_source=1
  1122. in your vimrc prior to the :syntax on command. If you always use fixed source
  1123. form, then >
  1124. :let fortran_fixed_source=1
  1125. in your vimrc prior to the :syntax on command.
  1126. If the form of the source code depends, in a non-standard way, upon the file
  1127. extension, then it is most convenient to set fortran_free_source in a ftplugin
  1128. file. For more information on ftplugin files, see |ftplugin|. Note that this
  1129. will work only if the "filetype plugin indent on" command precedes the "syntax
  1130. on" command in your .vimrc file.
  1131. When you edit an existing fortran file, the syntax script will assume free
  1132. source form if the fortran_free_source variable has been set, and assumes
  1133. fixed source form if the fortran_fixed_source variable has been set. If
  1134. neither of these variables have been set, the syntax script attempts to
  1135. determine which source form has been used by examining the file extension
  1136. using conventions common to the ifort, gfortran, Cray, NAG, and PathScale
  1137. compilers (.f, .for, .f77 for fixed-source, .f90, .f95, .f03, .f08 for
  1138. free-source). If none of this works, then the script examines the first five
  1139. columns of the first 500 lines of your file. If no signs of free source form
  1140. are detected, then the file is assumed to be in fixed source form. The
  1141. algorithm should work in the vast majority of cases. In some cases, such as a
  1142. file that begins with 500 or more full-line comments, the script may
  1143. incorrectly decide that the fortran code is in fixed form. If that happens,
  1144. just add a non-comment statement beginning anywhere in the first five columns
  1145. of the first twenty-five lines, save (:w) and then reload (:e!) the file.
  1146. Tabs in fortran files ~
  1147. Tabs are not recognized by the Fortran standards. Tabs are not a good idea in
  1148. fixed format fortran source code which requires fixed column boundaries.
  1149. Therefore, tabs are marked as errors. Nevertheless, some programmers like
  1150. using tabs. If your fortran files contain tabs, then you should set the
  1151. variable fortran_have_tabs in your vimrc with a command such as >
  1152. :let fortran_have_tabs=1
  1153. placed prior to the :syntax on command. Unfortunately, the use of tabs will
  1154. mean that the syntax file will not be able to detect incorrect margins.
  1155. Syntax folding of fortran files ~
  1156. If you wish to use foldmethod=syntax, then you must first set the variable
  1157. fortran_fold with a command such as >
  1158. :let fortran_fold=1
  1159. to instruct the syntax script to define fold regions for program units, that
  1160. is main programs starting with a program statement, subroutines, function
  1161. subprograms, block data subprograms, interface blocks, and modules. If you
  1162. also set the variable fortran_fold_conditionals with a command such as >
  1163. :let fortran_fold_conditionals=1
  1164. then fold regions will also be defined for do loops, if blocks, and select
  1165. case constructs. If you also set the variable
  1166. fortran_fold_multilinecomments with a command such as >
  1167. :let fortran_fold_multilinecomments=1
  1168. then fold regions will also be defined for three or more consecutive comment
  1169. lines. Note that defining fold regions can be slow for large files.
  1170. If fortran_fold, and possibly fortran_fold_conditionals and/or
  1171. fortran_fold_multilinecomments, have been set, then vim will fold your file if
  1172. you set foldmethod=syntax. Comments or blank lines placed between two program
  1173. units are not folded because they are seen as not belonging to any program
  1174. unit.
  1175. More precise fortran syntax ~
  1176. If you set the variable fortran_more_precise with a command such as >
  1177. :let fortran_more_precise=1
  1178. then the syntax coloring will be more precise but slower. In particular,
  1179. statement labels used in do, goto and arithmetic if statements will be
  1180. recognized, as will construct names at the end of a do, if, select or forall
  1181. construct.
  1182. Non-default fortran dialects ~
  1183. The syntax script supports two Fortran dialects: f08 and F. You will probably
  1184. find the default highlighting (f08) satisfactory. A few legacy constructs
  1185. deleted or declared obsolescent in the 2008 standard are highlighted as todo
  1186. items.
  1187. If you use F, the advantage of setting the dialect appropriately is that
  1188. other legacy features excluded from F will be highlighted as todo items and
  1189. that free source form will be assumed.
  1190. The dialect can be selected in various ways. If all your fortran files use
  1191. the same dialect, set the global variable fortran_dialect in your vimrc prior
  1192. to your syntax on statement. The case-sensitive, permissible values of
  1193. fortran_dialect are "f08" or "F". Invalid values of fortran_dialect are
  1194. ignored.
  1195. If the dialect depends upon the file extension, then it is most convenient to
  1196. set a buffer-local variable in a ftplugin file. For more information on
  1197. ftplugin files, see |ftplugin|. For example, if all your fortran files with
  1198. an .f90 extension are written in the F subset, your ftplugin file should
  1199. contain the code >
  1200. let s:extfname = expand("%:e")
  1201. if s:extfname ==? "f90"
  1202. let b:fortran_dialect="F"
  1203. else
  1204. unlet! b:fortran_dialect
  1205. endif
  1206. Note that this will work only if the "filetype plugin indent on" command
  1207. precedes the "syntax on" command in your vimrc file.
  1208. Finer control is necessary if the file extension does not uniquely identify
  1209. the dialect. You can override the default dialect, on a file-by-file basis,
  1210. by including a comment with the directive "fortran_dialect=xx" (where xx=F or
  1211. f08) in one of the first three lines in your file. For example, your older .f
  1212. files may be legacy code but your newer ones may be F codes, and you would
  1213. identify the latter by including in the first three lines of those files a
  1214. Fortran comment of the form >
  1215. ! fortran_dialect=F
  1216. For previous versions of the syntax, you may have set fortran_dialect to the
  1217. now-obsolete values "f77", "f90", "f95", or "elf". Such settings will be
  1218. silently handled as "f08". Users of "elf" may wish to experiment with "F"
  1219. instead.
  1220. The syntax/fortran.vim script contains embedded comments that tell you how to
  1221. comment and/or uncomment some lines to (a) activate recognition of some
  1222. non-standard, vendor-supplied intrinsics and (b) to prevent features deleted
  1223. or declared obsolescent in the 2008 standard from being highlighted as todo
  1224. items.
  1225. Limitations ~
  1226. Parenthesis checking does not catch too few closing parentheses. Hollerith
  1227. strings are not recognized. Some keywords may be highlighted incorrectly
  1228. because Fortran90 has no reserved words.
  1229. For further information related to fortran, see |ft-fortran-indent| and
  1230. |ft-fortran-plugin|.
  1231. FVWM CONFIGURATION FILES *fvwm.vim* *ft-fvwm-syntax*
  1232. In order for Vim to recognize Fvwm configuration files that do not match
  1233. the patterns *fvwmrc* or *fvwm2rc* , you must put additional patterns
  1234. appropriate to your system in your myfiletypes.vim file. For these
  1235. patterns, you must set the variable "b:fvwm_version" to the major version
  1236. number of Fvwm, and the 'filetype' option to fvwm.
  1237. For example, to make Vim identify all files in /etc/X11/fvwm2/
  1238. as Fvwm2 configuration files, add the following: >
  1239. :au! BufNewFile,BufRead /etc/X11/fvwm2/* let b:fvwm_version = 2 |
  1240. \ set filetype=fvwm
  1241. GSP *gsp.vim* *ft-gsp-syntax*
  1242. The default coloring style for GSP pages is defined by |html.vim|, and
  1243. the coloring for java code (within java tags or inline between backticks)
  1244. is defined by |java.vim|. The following HTML groups defined in |html.vim|
  1245. are redefined to incorporate and highlight inline java code:
  1246. htmlString
  1247. htmlValue
  1248. htmlEndTag
  1249. htmlTag
  1250. htmlTagN
  1251. Highlighting should look fine most of the places where you'd see inline
  1252. java code, but in some special cases it may not. To add another HTML
  1253. group where you will have inline java code where it does not highlight
  1254. correctly, just copy the line you want from |html.vim| and add gspJava
  1255. to the contains clause.
  1256. The backticks for inline java are highlighted according to the htmlError
  1257. group to make them easier to see.
  1258. GROFF *groff.vim* *ft-groff-syntax*
  1259. The groff syntax file is a wrapper for |nroff.vim|, see the notes
  1260. under that heading for examples of use and configuration. The purpose
  1261. of this wrapper is to set up groff syntax extensions by setting the
  1262. filetype from a |modeline| or in a personal filetype definitions file
  1263. (see |filetype.txt|).
  1264. HASKELL *haskell.vim* *lhaskell.vim* *ft-haskell-syntax*
  1265. The Haskell syntax files support plain Haskell code as well as literate
  1266. Haskell code, the latter in both Bird style and TeX style. The Haskell
  1267. syntax highlighting will also highlight C preprocessor directives.
  1268. If you want to highlight delimiter characters (useful if you have a
  1269. light-coloured background), add to your vimrc: >
  1270. :let hs_highlight_delimiters = 1
  1271. To treat True and False as keywords as opposed to ordinary identifiers,
  1272. add: >
  1273. :let hs_highlight_boolean = 1
  1274. To also treat the names of primitive types as keywords: >
  1275. :let hs_highlight_types = 1
  1276. And to treat the names of even more relatively common types as keywords: >
  1277. :let hs_highlight_more_types = 1
  1278. If you want to highlight the names of debugging functions, put in
  1279. your vimrc: >
  1280. :let hs_highlight_debug = 1
  1281. The Haskell syntax highlighting also highlights C preprocessor
  1282. directives, and flags lines that start with # but are not valid
  1283. directives as erroneous. This interferes with Haskell's syntax for
  1284. operators, as they may start with #. If you want to highlight those
  1285. as operators as opposed to errors, put in your vimrc: >
  1286. :let hs_allow_hash_operator = 1
  1287. The syntax highlighting for literate Haskell code will try to
  1288. automatically guess whether your literate Haskell code contains
  1289. TeX markup or not, and correspondingly highlight TeX constructs
  1290. or nothing at all. You can override this globally by putting
  1291. in your vimrc >
  1292. :let lhs_markup = none
  1293. for no highlighting at all, or >
  1294. :let lhs_markup = tex
  1295. to force the highlighting to always try to highlight TeX markup.
  1296. For more flexibility, you may also use buffer local versions of
  1297. this variable, so e.g. >
  1298. :let b:lhs_markup = tex
  1299. will force TeX highlighting for a particular buffer. It has to be
  1300. set before turning syntax highlighting on for the buffer or
  1301. loading a file.
  1302. HTML *html.vim* *ft-html-syntax*
  1303. The coloring scheme for tags in the HTML file works as follows.
  1304. The <> of opening tags are colored differently than the </> of a closing tag.
  1305. This is on purpose! For opening tags the 'Function' color is used, while for
  1306. closing tags the 'Type' color is used (See syntax.vim to check how those are
  1307. defined for you)
  1308. Known tag names are colored the same way as statements in C. Unknown tag
  1309. names are colored with the same color as the <> or </> respectively which
  1310. makes it easy to spot errors
  1311. Note that the same is true for argument (or attribute) names. Known attribute
  1312. names are colored differently than unknown ones.
  1313. Some HTML tags are used to change the rendering of text. The following tags
  1314. are recognized by the html.vim syntax coloring file and change the way normal
  1315. text is shown: <B> <I> <U> <EM> <STRONG> (<EM> is used as an alias for <I>,
  1316. while <STRONG> as an alias for <B>), <H1> - <H6>, <HEAD>, <TITLE> and <A>, but
  1317. only if used as a link (that is, it must include a href as in
  1318. <A href="somefile.html">).
  1319. If you want to change how such text is rendered, you must redefine the
  1320. following syntax groups:
  1321. - htmlBold
  1322. - htmlBoldUnderline
  1323. - htmlBoldUnderlineItalic
  1324. - htmlUnderline
  1325. - htmlUnderlineItalic
  1326. - htmlItalic
  1327. - htmlTitle for titles
  1328. - htmlH1 - htmlH6 for headings
  1329. To make this redefinition work you must redefine them all with the exception
  1330. of the last two (htmlTitle and htmlH[1-6], which are optional) and define the
  1331. following variable in your vimrc (this is due to the order in which the files
  1332. are read during initialization) >
  1333. :let html_my_rendering=1
  1334. If you'd like to see an example download mysyntax.vim at
  1335. http://www.fleiner.com/vim/download.html
  1336. You can also disable this rendering by adding the following line to your
  1337. vimrc file: >
  1338. :let html_no_rendering=1
  1339. HTML comments are rather special (see an HTML reference document for the
  1340. details), and the syntax coloring scheme will highlight all errors.
  1341. However, if you prefer to use the wrong style (starts with <!-- and
  1342. ends with -->) you can define >
  1343. :let html_wrong_comments=1
  1344. JavaScript and Visual Basic embedded inside HTML documents are highlighted as
  1345. 'Special' with statements, comments, strings and so on colored as in standard
  1346. programming languages. Note that only JavaScript and Visual Basic are currently
  1347. supported, no other scripting language has been added yet.
  1348. Embedded and inlined cascading style sheets (CSS) are highlighted too.
  1349. There are several html preprocessor languages out there. html.vim has been
  1350. written such that it should be trivial to include it. To do so add the
  1351. following two lines to the syntax coloring file for that language
  1352. (the example comes from the asp.vim file):
  1353. runtime! syntax/html.vim
  1354. syn cluster htmlPreproc add=asp
  1355. Now you just need to make sure that you add all regions that contain
  1356. the preprocessor language to the cluster htmlPreproc.
  1357. HTML/OS (by Aestiva) *htmlos.vim* *ft-htmlos-syntax*
  1358. The coloring scheme for HTML/OS works as follows:
  1359. Functions and variable names are the same color by default, because VIM
  1360. doesn't specify different colors for Functions and Identifiers. To change
  1361. this (which is recommended if you want function names to be recognizable in a
  1362. different color) you need to add the following line to your vimrc: >
  1363. :hi Function cterm=bold ctermfg=LightGray
  1364. Of course, the ctermfg can be a different color if you choose.
  1365. Another issues that HTML/OS runs into is that there is no special filetype to
  1366. signify that it is a file with HTML/OS coding. You can change this by opening
  1367. a file and turning on HTML/OS syntax by doing the following: >
  1368. :set syntax=htmlos
  1369. Lastly, it should be noted that the opening and closing characters to begin a
  1370. block of HTML/OS code can either be << or [[ and >> or ]], respectively.
  1371. IA64 *ia64.vim* *intel-itanium* *ft-ia64-syntax*
  1372. Highlighting for the Intel Itanium 64 assembly language. See |asm.vim| for
  1373. how to recognize this filetype.
  1374. To have *.inc files be recognized as IA64, add this to your vimrc file: >
  1375. :let g:filetype_inc = "ia64"
  1376. INFORM *inform.vim* *ft-inform-syntax*
  1377. Inform highlighting includes symbols provided by the Inform Library, as
  1378. most programs make extensive use of it. If do not wish Library symbols
  1379. to be highlighted add this to your vim startup: >
  1380. :let inform_highlight_simple=1
  1381. By default it is assumed that Inform programs are Z-machine targeted,
  1382. and highlights Z-machine assembly language symbols appropriately. If
  1383. you intend your program to be targeted to a Glulx/Glk environment you
  1384. need to add this to your startup sequence: >
  1385. :let inform_highlight_glulx=1
  1386. This will highlight Glulx opcodes instead, and also adds glk() to the
  1387. set of highlighted system functions.
  1388. The Inform compiler will flag certain obsolete keywords as errors when
  1389. it encounters them. These keywords are normally highlighted as errors
  1390. by Vim. To prevent such error highlighting, you must add this to your
  1391. startup sequence: >
  1392. :let inform_suppress_obsolete=1
  1393. By default, the language features highlighted conform to Compiler
  1394. version 6.30 and Library version 6.11. If you are using an older
  1395. Inform development environment, you may with to add this to your
  1396. startup sequence: >
  1397. :let inform_highlight_old=1
  1398. IDL *idl.vim* *idl-syntax*
  1399. IDL (Interface Definition Language) files are used to define RPC calls. In
  1400. Microsoft land, this is also used for defining COM interfaces and calls.
  1401. IDL's structure is simple enough to permit a full grammar based approach to
  1402. rather than using a few heuristics. The result is large and somewhat
  1403. repetitive but seems to work.
  1404. There are some Microsoft extensions to idl files that are here. Some of them
  1405. are disabled by defining idl_no_ms_extensions.
  1406. The more complex of the extensions are disabled by defining idl_no_extensions.
  1407. Variable Effect ~
  1408. idl_no_ms_extensions Disable some of the Microsoft specific
  1409. extensions
  1410. idl_no_extensions Disable complex extensions
  1411. idlsyntax_showerror Show IDL errors (can be rather intrusive, but
  1412. quite helpful)
  1413. idlsyntax_showerror_soft Use softer colours by default for errors
  1414. JAVA *java.vim* *ft-java-syntax*
  1415. The java.vim syntax highlighting file offers several options:
  1416. In Java 1.0.2 it was never possible to have braces inside parens, so this was
  1417. flagged as an error. Since Java 1.1 this is possible (with anonymous
  1418. classes), and therefore is no longer marked as an error. If you prefer the old
  1419. way, put the following line into your vim startup file: >
  1420. :let java_mark_braces_in_parens_as_errors=1
  1421. All identifiers in java.lang.* are always visible in all classes. To
  1422. highlight them use: >
  1423. :let java_highlight_java_lang_ids=1
  1424. You can also highlight identifiers of most standard Java packages if you
  1425. download the javaid.vim script at http://www.fleiner.com/vim/download.html.
  1426. If you prefer to only highlight identifiers of a certain package, say java.io
  1427. use the following: >
  1428. :let java_highlight_java_io=1
  1429. Check the javaid.vim file for a list of all the packages that are supported.
  1430. Function names are not highlighted, as the way to find functions depends on
  1431. how you write Java code. The syntax file knows two possible ways to highlight
  1432. functions:
  1433. If you write function declarations that are always indented by either
  1434. a tab, 8 spaces or 2 spaces you may want to set >
  1435. :let java_highlight_functions="indent"
  1436. However, if you follow the Java guidelines about how functions and classes are
  1437. supposed to be named (with respect to upper and lowercase), use >
  1438. :let java_highlight_functions="style"
  1439. If both options do not work for you, but you would still want function
  1440. declarations to be highlighted create your own definitions by changing the
  1441. definitions in java.vim or by creating your own java.vim which includes the
  1442. original one and then adds the code to highlight functions.
  1443. In Java 1.1 the functions System.out.println() and System.err.println() should
  1444. only be used for debugging. Therefore it is possible to highlight debugging
  1445. statements differently. To do this you must add the following definition in
  1446. your startup file: >
  1447. :let java_highlight_debug=1
  1448. The result will be that those statements are highlighted as 'Special'
  1449. characters. If you prefer to have them highlighted differently you must define
  1450. new highlightings for the following groups.:
  1451. Debug, DebugSpecial, DebugString, DebugBoolean, DebugType
  1452. which are used for the statement itself, special characters used in debug
  1453. strings, strings, boolean constants and types (this, super) respectively. I
  1454. have opted to chose another background for those statements.
  1455. Javadoc is a program that takes special comments out of Java program files and
  1456. creates HTML pages. The standard configuration will highlight this HTML code
  1457. similarly to HTML files (see |html.vim|). You can even add Javascript
  1458. and CSS inside this code (see below). There are four differences however:
  1459. 1. The title (all characters up to the first '.' which is followed by
  1460. some white space or up to the first '@') is colored differently (to change
  1461. the color change the group CommentTitle).
  1462. 2. The text is colored as 'Comment'.
  1463. 3. HTML comments are colored as 'Special'
  1464. 4. The special Javadoc tags (@see, @param, ...) are highlighted as specials
  1465. and the argument (for @see, @param, @exception) as Function.
  1466. To turn this feature off add the following line to your startup file: >
  1467. :let java_ignore_javadoc=1
  1468. If you use the special Javadoc comment highlighting described above you
  1469. can also turn on special highlighting for Javascript, visual basic
  1470. scripts and embedded CSS (stylesheets). This makes only sense if you
  1471. actually have Javadoc comments that include either Javascript or embedded
  1472. CSS. The options to use are >
  1473. :let java_javascript=1
  1474. :let java_css=1
  1475. :let java_vb=1
  1476. In order to highlight nested parens with different colors define colors
  1477. for javaParen, javaParen1 and javaParen2, for example with >
  1478. :hi link javaParen Comment
  1479. or >
  1480. :hi javaParen ctermfg=blue guifg=#0000ff
  1481. If you notice highlighting errors while scrolling backwards, which are fixed
  1482. when redrawing with CTRL-L, try setting the "java_minlines" internal variable
  1483. to a larger number: >
  1484. :let java_minlines = 50
  1485. This will make the syntax synchronization start 50 lines before the first
  1486. displayed line. The default value is 10. The disadvantage of using a larger
  1487. number is that redrawing can become slow.
  1488. LACE *lace.vim* *ft-lace-syntax*
  1489. Lace (Language for Assembly of Classes in Eiffel) is case insensitive, but the
  1490. style guide lines are not. If you prefer case insensitive highlighting, just
  1491. define the vim variable 'lace_case_insensitive' in your startup file: >
  1492. :let lace_case_insensitive=1
  1493. LEX *lex.vim* *ft-lex-syntax*
  1494. Lex uses brute-force synchronizing as the "^%%$" section delimiter
  1495. gives no clue as to what section follows. Consequently, the value for >
  1496. :syn sync minlines=300
  1497. may be changed by the user if s/he is experiencing synchronization
  1498. difficulties (such as may happen with large lex files).
  1499. LIFELINES *lifelines.vim* *ft-lifelines-syntax*
  1500. To highlight deprecated functions as errors, add in your vimrc: >
  1501. :let g:lifelines_deprecated = 1
  1502. <
  1503. LISP *lisp.vim* *ft-lisp-syntax*
  1504. The lisp syntax highlighting provides two options: >
  1505. g:lisp_instring : if it exists, then "(...)" strings are highlighted
  1506. as if the contents of the string were lisp.
  1507. Useful for AutoLisp.
  1508. g:lisp_rainbow : if it exists and is nonzero, then differing levels
  1509. of parenthesization will receive different
  1510. highlighting.
  1511. <
  1512. The g:lisp_rainbow option provides 10 levels of individual colorization for
  1513. the parentheses and backquoted parentheses. Because of the quantity of
  1514. colorization levels, unlike non-rainbow highlighting, the rainbow mode
  1515. specifies its highlighting using ctermfg and guifg, thereby bypassing the
  1516. usual colorscheme control using standard highlighting groups. The actual
  1517. highlighting used depends on the dark/bright setting (see |'bg'|).
  1518. LITE *lite.vim* *ft-lite-syntax*
  1519. There are two options for the lite syntax highlighting.
  1520. If you like SQL syntax highlighting inside Strings, use this: >
  1521. :let lite_sql_query = 1
  1522. For syncing, minlines defaults to 100. If you prefer another value, you can
  1523. set "lite_minlines" to the value you desire. Example: >
  1524. :let lite_minlines = 200
  1525. LPC *lpc.vim* *ft-lpc-syntax*
  1526. LPC stands for a simple, memory-efficient language: Lars Pensjö C. The
  1527. file name of LPC is usually *.c. Recognizing these files as LPC would bother
  1528. users writing only C programs. If you want to use LPC syntax in Vim, you
  1529. should set a variable in your vimrc file: >
  1530. :let lpc_syntax_for_c = 1
  1531. If it doesn't work properly for some particular C or LPC files, use a
  1532. modeline. For a LPC file:
  1533. // vim:set ft=lpc:
  1534. For a C file that is recognized as LPC:
  1535. // vim:set ft=c:
  1536. If you don't want to set the variable, use the modeline in EVERY LPC file.
  1537. There are several implementations for LPC, we intend to support most widely
  1538. used ones. Here the default LPC syntax is for MudOS series, for MudOS v22
  1539. and before, you should turn off the sensible modifiers, and this will also
  1540. assert the new efuns after v22 to be invalid, don't set this variable when
  1541. you are using the latest version of MudOS: >
  1542. :let lpc_pre_v22 = 1
  1543. For LpMud 3.2 series of LPC: >
  1544. :let lpc_compat_32 = 1
  1545. For LPC4 series of LPC: >
  1546. :let lpc_use_lpc4_syntax = 1
  1547. For uLPC series of LPC:
  1548. uLPC has been developed to Pike, so you should use Pike syntax
  1549. instead, and the name of your source file should be *.pike
  1550. LUA *lua.vim* *ft-lua-syntax*
  1551. The Lua syntax file can be used for versions 4.0, 5.0, 5.1 and 5.2 (5.2 is
  1552. the default). You can select one of these versions using the global variables
  1553. lua_version and lua_subversion. For example, to activate Lua
  1554. 5.1 syntax highlighting, set the variables like this:
  1555. :let lua_version = 5
  1556. :let lua_subversion = 1
  1557. MAIL *mail.vim* *ft-mail.vim*
  1558. Vim highlights all the standard elements of an email (headers, signatures,
  1559. quoted text and URLs / email addresses). In keeping with standard conventions,
  1560. signatures begin in a line containing only "--" followed optionally by
  1561. whitespaces and end with a newline.
  1562. Vim treats lines beginning with ']', '}', '|', '>' or a word followed by '>'
  1563. as quoted text. However Vim highlights headers and signatures in quoted text
  1564. only if the text is quoted with '>' (optionally followed by one space).
  1565. By default mail.vim synchronises syntax to 100 lines before the first
  1566. displayed line. If you have a slow machine, and generally deal with emails
  1567. with short headers, you can change this to a smaller value: >
  1568. :let mail_minlines = 30
  1569. MAKE *make.vim* *ft-make-syntax*
  1570. In makefiles, commands are usually highlighted to make it easy for you to spot
  1571. errors. However, this may be too much coloring for you. You can turn this
  1572. feature off by using: >
  1573. :let make_no_commands = 1
  1574. MAPLE *maple.vim* *ft-maple-syntax*
  1575. Maple V, by Waterloo Maple Inc, supports symbolic algebra. The language
  1576. supports many packages of functions which are selectively loaded by the user.
  1577. The standard set of packages' functions as supplied in Maple V release 4 may be
  1578. highlighted at the user's discretion. Users may place in their vimrc file: >
  1579. :let mvpkg_all= 1
  1580. to get all package functions highlighted, or users may select any subset by
  1581. choosing a variable/package from the table below and setting that variable to
  1582. 1, also in their vimrc file (prior to sourcing
  1583. $VIMRUNTIME/syntax/syntax.vim).
  1584. Table of Maple V Package Function Selectors >
  1585. mv_DEtools mv_genfunc mv_networks mv_process
  1586. mv_Galois mv_geometry mv_numapprox mv_simplex
  1587. mv_GaussInt mv_grobner mv_numtheory mv_stats
  1588. mv_LREtools mv_group mv_orthopoly mv_student
  1589. mv_combinat mv_inttrans mv_padic mv_sumtools
  1590. mv_combstruct mv_liesymm mv_plots mv_tensor
  1591. mv_difforms mv_linalg mv_plottools mv_totorder
  1592. mv_finance mv_logic mv_powseries
  1593. MATHEMATICA *mma.vim* *ft-mma-syntax* *ft-mathematica-syntax*
  1594. Empty *.m files will automatically be presumed to be Matlab files unless you
  1595. have the following in your vimrc: >
  1596. let filetype_m = "mma"
  1597. MOO *moo.vim* *ft-moo-syntax*
  1598. If you use C-style comments inside expressions and find it mangles your
  1599. highlighting, you may want to use extended (slow!) matches for C-style
  1600. comments: >
  1601. :let moo_extended_cstyle_comments = 1
  1602. To disable highlighting of pronoun substitution patterns inside strings: >
  1603. :let moo_no_pronoun_sub = 1
  1604. To disable highlighting of the regular expression operator '%|', and matching
  1605. '%(' and '%)' inside strings: >
  1606. :let moo_no_regexp = 1
  1607. Unmatched double quotes can be recognized and highlighted as errors: >
  1608. :let moo_unmatched_quotes = 1
  1609. To highlight builtin properties (.name, .location, .programmer etc.): >
  1610. :let moo_builtin_properties = 1
  1611. Unknown builtin functions can be recognized and highlighted as errors. If you
  1612. use this option, add your own extensions to the mooKnownBuiltinFunction group.
  1613. To enable this option: >
  1614. :let moo_unknown_builtin_functions = 1
  1615. An example of adding sprintf() to the list of known builtin functions: >
  1616. :syn keyword mooKnownBuiltinFunction sprintf contained
  1617. MSQL *msql.vim* *ft-msql-syntax*
  1618. There are two options for the msql syntax highlighting.
  1619. If you like SQL syntax highlighting inside Strings, use this: >
  1620. :let msql_sql_query = 1
  1621. For syncing, minlines defaults to 100. If you prefer another value, you can
  1622. set "msql_minlines" to the value you desire. Example: >
  1623. :let msql_minlines = 200
  1624. N1QL *n1ql.vim* *ft-n1ql-syntax*
  1625. N1QL is a SQL-like declarative language for manipulating JSON documents in
  1626. Couchbase Server databases.
  1627. Vim syntax highlights N1QL statements, keywords, operators, types, comments,
  1628. and special values. Vim ignores syntactical elements specific to SQL or its
  1629. many dialects, like COLUMN or CHAR, that don't exist in N1QL.
  1630. NCF *ncf.vim* *ft-ncf-syntax*
  1631. There is one option for NCF syntax highlighting.
  1632. If you want to have unrecognized (by ncf.vim) statements highlighted as
  1633. errors, use this: >
  1634. :let ncf_highlight_unknowns = 1
  1635. If you don't want to highlight these errors, leave it unset.
  1636. NROFF *nroff.vim* *ft-nroff-syntax*
  1637. The nroff syntax file works with AT&T n/troff out of the box. You need to
  1638. activate the GNU groff extra features included in the syntax file before you
  1639. can use them.
  1640. For example, Linux and BSD distributions use groff as their default text
  1641. processing package. In order to activate the extra syntax highlighting
  1642. features for groff, add the following option to your start-up files: >
  1643. :let b:nroff_is_groff = 1
  1644. Groff is different from the old AT&T n/troff that you may still find in
  1645. Solaris. Groff macro and request names can be longer than 2 characters and
  1646. there are extensions to the language primitives. For example, in AT&T troff
  1647. you access the year as a 2-digit number with the request \(yr. In groff you
  1648. can use the same request, recognized for compatibility, or you can use groff's
  1649. native syntax, \[yr]. Furthermore, you can use a 4-digit year directly:
  1650. \[year]. Macro requests can be longer than 2 characters, for example, GNU mm
  1651. accepts the requests ".VERBON" and ".VERBOFF" for creating verbatim
  1652. environments.
  1653. In order to obtain the best formatted output g/troff can give you, you should
  1654. follow a few simple rules about spacing and punctuation.
  1655. 1. Do not leave empty spaces at the end of lines.
  1656. 2. Leave one space and one space only after an end-of-sentence period,
  1657. exclamation mark, etc.
  1658. 3. For reasons stated below, it is best to follow all period marks with a
  1659. carriage return.
  1660. The reason behind these unusual tips is that g/n/troff have a line breaking
  1661. algorithm that can be easily upset if you don't follow the rules given above.
  1662. Unlike TeX, troff fills text line-by-line, not paragraph-by-paragraph and,
  1663. furthermore, it does not have a concept of glue or stretch, all horizontal and
  1664. vertical space input will be output as is.
  1665. Therefore, you should be careful about not using more space between sentences
  1666. than you intend to have in your final document. For this reason, the common
  1667. practice is to insert a carriage return immediately after all punctuation
  1668. marks. If you want to have "even" text in your final processed output, you
  1669. need to maintain regular spacing in the input text. To mark both trailing
  1670. spaces and two or more spaces after a punctuation as an error, use: >
  1671. :let nroff_space_errors = 1
  1672. Another technique to detect extra spacing and other errors that will interfere
  1673. with the correct typesetting of your file, is to define an eye-catching
  1674. highlighting definition for the syntax groups "nroffDefinition" and
  1675. "nroffDefSpecial" in your configuration files. For example: >
  1676. hi def nroffDefinition cterm=italic gui=reverse
  1677. hi def nroffDefSpecial cterm=italic,bold gui=reverse,bold
  1678. If you want to navigate preprocessor entries in your source file as easily as
  1679. with section markers, you can activate the following option in your vimrc
  1680. file: >
  1681. let b:preprocs_as_sections = 1
  1682. As well, the syntax file adds an extra paragraph marker for the extended
  1683. paragraph macro (.XP) in the ms package.
  1684. Finally, there is a |groff.vim| syntax file that can be used for enabling
  1685. groff syntax highlighting either on a file basis or globally by default.
  1686. OCAML *ocaml.vim* *ft-ocaml-syntax*
  1687. The OCaml syntax file handles files having the following prefixes: .ml,
  1688. .mli, .mll and .mly. By setting the following variable >
  1689. :let ocaml_revised = 1
  1690. you can switch from standard OCaml-syntax to revised syntax as supported
  1691. by the camlp4 preprocessor. Setting the variable >
  1692. :let ocaml_noend_error = 1
  1693. prevents highlighting of "end" as error, which is useful when sources
  1694. contain very long structures that Vim does not synchronize anymore.
  1695. PAPP *papp.vim* *ft-papp-syntax*
  1696. The PApp syntax file handles .papp files and, to a lesser extend, .pxml
  1697. and .pxsl files which are all a mixture of perl/xml/html/other using xml
  1698. as the top-level file format. By default everything inside phtml or pxml
  1699. sections is treated as a string with embedded preprocessor commands. If
  1700. you set the variable: >
  1701. :let papp_include_html=1
  1702. in your startup file it will try to syntax-hilight html code inside phtml
  1703. sections, but this is relatively slow and much too colourful to be able to
  1704. edit sensibly. ;)
  1705. The newest version of the papp.vim syntax file can usually be found at
  1706. http://papp.plan9.de.
  1707. PASCAL *pascal.vim* *ft-pascal-syntax*
  1708. Files matching "*.p" could be Progress or Pascal. If the automatic detection
  1709. doesn't work for you, or you don't edit Progress at all, use this in your
  1710. startup vimrc: >
  1711. :let filetype_p = "pascal"
  1712. The Pascal syntax file has been extended to take into account some extensions
  1713. provided by Turbo Pascal, Free Pascal Compiler and GNU Pascal Compiler.
  1714. Delphi keywords are also supported. By default, Turbo Pascal 7.0 features are
  1715. enabled. If you prefer to stick with the standard Pascal keywords, add the
  1716. following line to your startup file: >
  1717. :let pascal_traditional=1
  1718. To switch on Delphi specific constructions (such as one-line comments,
  1719. keywords, etc): >
  1720. :let pascal_delphi=1
  1721. The option pascal_symbol_operator controls whether symbol operators such as +,
  1722. *, .., etc. are displayed using the Operator color or not. To colorize symbol
  1723. operators, add the following line to your startup file: >
  1724. :let pascal_symbol_operator=1
  1725. Some functions are highlighted by default. To switch it off: >
  1726. :let pascal_no_functions=1
  1727. Furthermore, there are specific variables for some compilers. Besides
  1728. pascal_delphi, there are pascal_gpc and pascal_fpc. Default extensions try to
  1729. match Turbo Pascal. >
  1730. :let pascal_gpc=1
  1731. or >
  1732. :let pascal_fpc=1
  1733. To ensure that strings are defined on a single line, you can define the
  1734. pascal_one_line_string variable. >
  1735. :let pascal_one_line_string=1
  1736. If you dislike <Tab> chars, you can set the pascal_no_tabs variable. Tabs
  1737. will be highlighted as Error. >
  1738. :let pascal_no_tabs=1
  1739. PERL *perl.vim* *ft-perl-syntax*
  1740. There are a number of possible options to the perl syntax highlighting.
  1741. Inline POD highlighting is now turned on by default. If you don't wish
  1742. to have the added complexity of highlighting POD embedded within Perl
  1743. files, you may set the 'perl_include_pod' option to 0: >
  1744. :let perl_include_pod = 0
  1745. To reduce the complexity of parsing (and increase performance) you can switch
  1746. off two elements in the parsing of variable names and contents. >
  1747. To handle package references in variable and function names not differently
  1748. from the rest of the name (like 'PkgName::' in '$PkgName::VarName'): >
  1749. :let perl_no_scope_in_variables = 1
  1750. (In Vim 6.x it was the other way around: "perl_want_scope_in_variables"
  1751. enabled it.)
  1752. If you do not want complex things like '@{${"foo"}}' to be parsed: >
  1753. :let perl_no_extended_vars = 1
  1754. (In Vim 6.x it was the other way around: "perl_extended_vars" enabled it.)
  1755. The coloring strings can be changed. By default strings and qq friends will be
  1756. highlighted like the first line. If you set the variable
  1757. perl_string_as_statement, it will be highlighted as in the second line.
  1758. "hello world!"; qq|hello world|;
  1759. ^^^^^^^^^^^^^^NN^^^^^^^^^^^^^^^N (unlet perl_string_as_statement)
  1760. S^^^^^^^^^^^^SNNSSS^^^^^^^^^^^SN (let perl_string_as_statement)
  1761. (^ = perlString, S = perlStatement, N = None at all)
  1762. The syncing has 3 options. The first two switch off some triggering of
  1763. synchronization and should only be needed in case it fails to work properly.
  1764. If while scrolling all of a sudden the whole screen changes color completely
  1765. then you should try and switch off one of those. Let me know if you can figure
  1766. out the line that causes the mistake.
  1767. One triggers on "^\s*sub\s*" and the other on "^[$@%]" more or less. >
  1768. :let perl_no_sync_on_sub
  1769. :let perl_no_sync_on_global_var
  1770. Below you can set the maximum distance VIM should look for starting points for
  1771. its attempts in syntax highlighting. >
  1772. :let perl_sync_dist = 100
  1773. If you want to use folding with perl, set perl_fold: >
  1774. :let perl_fold = 1
  1775. If you want to fold blocks in if statements, etc. as well set the following: >
  1776. :let perl_fold_blocks = 1
  1777. Subroutines are folded by default if 'perl_fold' is set. If you do not want
  1778. this, you can set 'perl_nofold_subs': >
  1779. :let perl_nofold_subs = 1
  1780. Anonymous subroutines are not folded by default; you may enable their folding
  1781. via 'perl_fold_anonymous_subs': >
  1782. :let perl_fold_anonymous_subs = 1
  1783. Packages are also folded by default if 'perl_fold' is set. To disable this
  1784. behavior, set 'perl_nofold_packages': >
  1785. :let perl_nofold_packages = 1
  1786. PHP3 and PHP4 *php.vim* *php3.vim* *ft-php-syntax* *ft-php3-syntax*
  1787. [note: previously this was called "php3", but since it now also supports php4
  1788. it has been renamed to "php"]
  1789. There are the following options for the php syntax highlighting.
  1790. If you like SQL syntax highlighting inside Strings: >
  1791. let php_sql_query = 1
  1792. For highlighting the Baselib methods: >
  1793. let php_baselib = 1
  1794. Enable HTML syntax highlighting inside strings: >
  1795. let php_htmlInStrings = 1
  1796. Using the old colorstyle: >
  1797. let php_oldStyle = 1
  1798. Enable highlighting ASP-style short tags: >
  1799. let php_asp_tags = 1
  1800. Disable short tags: >
  1801. let php_noShortTags = 1
  1802. For highlighting parent error ] or ): >
  1803. let php_parent_error_close = 1
  1804. For skipping a php end tag, if there exists an open ( or [ without a closing
  1805. one: >
  1806. let php_parent_error_open = 1
  1807. Enable folding for classes and functions: >
  1808. let php_folding = 1
  1809. Selecting syncing method: >
  1810. let php_sync_method = x
  1811. x = -1 to sync by search (default),
  1812. x > 0 to sync at least x lines backwards,
  1813. x = 0 to sync from start.
  1814. PLAINTEX *plaintex.vim* *ft-plaintex-syntax*
  1815. TeX is a typesetting language, and plaintex is the file type for the "plain"
  1816. variant of TeX. If you never want your *.tex files recognized as plain TeX,
  1817. see |ft-tex-plugin|.
  1818. This syntax file has the option >
  1819. let g:plaintex_delimiters = 1
  1820. if you want to highlight brackets "[]" and braces "{}".
  1821. PPWIZARD *ppwiz.vim* *ft-ppwiz-syntax*
  1822. PPWizard is a preprocessor for HTML and OS/2 INF files
  1823. This syntax file has the options:
  1824. - ppwiz_highlight_defs : determines highlighting mode for PPWizard's
  1825. definitions. Possible values are
  1826. ppwiz_highlight_defs = 1 : PPWizard #define statements retain the
  1827. colors of their contents (e.g. PPWizard macros and variables)
  1828. ppwiz_highlight_defs = 2 : preprocessor #define and #evaluate
  1829. statements are shown in a single color with the exception of line
  1830. continuation symbols
  1831. The default setting for ppwiz_highlight_defs is 1.
  1832. - ppwiz_with_html : If the value is 1 (the default), highlight literal
  1833. HTML code; if 0, treat HTML code like ordinary text.
  1834. PHTML *phtml.vim* *ft-phtml-syntax*
  1835. There are two options for the phtml syntax highlighting.
  1836. If you like SQL syntax highlighting inside Strings, use this: >
  1837. :let phtml_sql_query = 1
  1838. For syncing, minlines defaults to 100. If you prefer another value, you can
  1839. set "phtml_minlines" to the value you desire. Example: >
  1840. :let phtml_minlines = 200
  1841. POSTSCRIPT *postscr.vim* *ft-postscr-syntax*
  1842. There are several options when it comes to highlighting PostScript.
  1843. First which version of the PostScript language to highlight. There are
  1844. currently three defined language versions, or levels. Level 1 is the original
  1845. and base version, and includes all extensions prior to the release of level 2.
  1846. Level 2 is the most common version around, and includes its own set of
  1847. extensions prior to the release of level 3. Level 3 is currently the highest
  1848. level supported. You select which level of the PostScript language you want
  1849. highlighted by defining the postscr_level variable as follows: >
  1850. :let postscr_level=2
  1851. If this variable is not defined it defaults to 2 (level 2) since this is
  1852. the most prevalent version currently.
  1853. Note, not all PS interpreters will support all language features for a
  1854. particular language level. In particular the %!PS-Adobe-3.0 at the start of
  1855. PS files does NOT mean the PostScript present is level 3 PostScript!
  1856. If you are working with Display PostScript, you can include highlighting of
  1857. Display PS language features by defining the postscr_display variable as
  1858. follows: >
  1859. :let postscr_display=1
  1860. If you are working with Ghostscript, you can include highlighting of
  1861. Ghostscript specific language features by defining the variable
  1862. postscr_ghostscript as follows: >
  1863. :let postscr_ghostscript=1
  1864. PostScript is a large language, with many predefined elements. While it
  1865. useful to have all these elements highlighted, on slower machines this can
  1866. cause Vim to slow down. In an attempt to be machine friendly font names and
  1867. character encodings are not highlighted by default. Unless you are working
  1868. explicitly with either of these this should be ok. If you want them to be
  1869. highlighted you should set one or both of the following variables: >
  1870. :let postscr_fonts=1
  1871. :let postscr_encodings=1
  1872. There is a stylistic option to the highlighting of and, or, and not. In
  1873. PostScript the function of these operators depends on the types of their
  1874. operands - if the operands are booleans then they are the logical operators,
  1875. if they are integers then they are binary operators. As binary and logical
  1876. operators can be highlighted differently they have to be highlighted one way
  1877. or the other. By default they are treated as logical operators. They can be
  1878. highlighted as binary operators by defining the variable
  1879. postscr_andornot_binary as follows: >
  1880. :let postscr_andornot_binary=1
  1881. <
  1882. *ptcap.vim* *ft-printcap-syntax*
  1883. PRINTCAP + TERMCAP *ft-ptcap-syntax* *ft-termcap-syntax*
  1884. This syntax file applies to the printcap and termcap databases.
  1885. In order for Vim to recognize printcap/termcap files that do not match
  1886. the patterns *printcap*, or *termcap*, you must put additional patterns
  1887. appropriate to your system in your |myfiletypefile| file. For these
  1888. patterns, you must set the variable "b:ptcap_type" to either "print" or
  1889. "term", and then the 'filetype' option to ptcap.
  1890. For example, to make Vim identify all files in /etc/termcaps/ as termcap
  1891. files, add the following: >
  1892. :au BufNewFile,BufRead /etc/termcaps/* let b:ptcap_type = "term" |
  1893. \ set filetype=ptcap
  1894. If you notice highlighting errors while scrolling backwards, which
  1895. are fixed when redrawing with CTRL-L, try setting the "ptcap_minlines"
  1896. internal variable to a larger number: >
  1897. :let ptcap_minlines = 50
  1898. (The default is 20 lines.)
  1899. PROGRESS *progress.vim* *ft-progress-syntax*
  1900. Files matching "*.w" could be Progress or cweb. If the automatic detection
  1901. doesn't work for you, or you don't edit cweb at all, use this in your
  1902. startup vimrc: >
  1903. :let filetype_w = "progress"
  1904. The same happens for "*.i", which could be assembly, and "*.p", which could be
  1905. Pascal. Use this if you don't use assembly and Pascal: >
  1906. :let filetype_i = "progress"
  1907. :let filetype_p = "progress"
  1908. PYTHON *python.vim* *ft-python-syntax*
  1909. There are six options to control Python syntax highlighting.
  1910. For highlighted numbers: >
  1911. :let python_no_number_highlight = 1
  1912. For highlighted builtin functions: >
  1913. :let python_no_builtin_highlight = 1
  1914. For highlighted standard exceptions: >
  1915. :let python_no_exception_highlight = 1
  1916. For highlighted doctests and code inside: >
  1917. :let python_no_doctest_highlight = 1
  1918. or >
  1919. :let python_no_doctest_code_highlight = 1
  1920. (first option implies second one).
  1921. For highlighted trailing whitespace and mix of spaces and tabs: >
  1922. :let python_space_error_highlight = 1
  1923. If you want all possible Python highlighting (the same as setting the
  1924. preceding last option and unsetting all other ones): >
  1925. :let python_highlight_all = 1
  1926. Note: only existence of these options matter, not their value. You can replace
  1927. 1 above with anything.
  1928. QUAKE *quake.vim* *ft-quake-syntax*
  1929. The Quake syntax definition should work for most any FPS (First Person
  1930. Shooter) based on one of the Quake engines. However, the command names vary
  1931. a bit between the three games (Quake, Quake 2, and Quake 3 Arena) so the
  1932. syntax definition checks for the existence of three global variables to allow
  1933. users to specify what commands are legal in their files. The three variables
  1934. can be set for the following effects:
  1935. set to highlight commands only available in Quake: >
  1936. :let quake_is_quake1 = 1
  1937. set to highlight commands only available in Quake 2: >
  1938. :let quake_is_quake2 = 1
  1939. set to highlight commands only available in Quake 3 Arena: >
  1940. :let quake_is_quake3 = 1
  1941. Any combination of these three variables is legal, but might highlight more
  1942. commands than are actually available to you by the game.
  1943. R *r.vim* *ft-r-syntax*
  1944. The parsing of R code for syntax highlight starts 40 lines backwards, but you
  1945. can set a different value in your |vimrc|. Example: >
  1946. let r_syntax_minlines = 60
  1947. You can also turn off syntax highlighting of ROxygen: >
  1948. let r_syntax_hl_roxygen = 0
  1949. enable folding of code delimited by parentheses, square brackets and curly
  1950. braces: >
  1951. let r_syntax_folding = 1
  1952. and highlight as functions all keywords followed by an opening parenthesis: >
  1953. let r_syntax_fun_pattern = 1
  1954. R MARKDOWN *rmd.vim* *ft-rmd-syntax*
  1955. To disable syntax highlight of YAML header, add to your |vimrc|: >
  1956. let rmd_syn_hl_yaml = 0
  1957. To disable syntax highlighting of citation keys: >
  1958. let rmd_syn_hl_citations = 0
  1959. To highlight R code in knitr chunk headers: >
  1960. let rmd_syn_hl_chunk = 1
  1961. By default, chunks of R code will be highlighted following the rules of R
  1962. language. If you want proper syntax highlighting of chunks of other languages,
  1963. you should add them to either `markdown_fenced_languages` or
  1964. `rmd_fenced_languages`. For example to properly highlight both R and Python,
  1965. you may add this to your |vimrc|: >
  1966. let rmd_fenced_languages = ['r', 'python']
  1967. R RESTRUCTURED TEXT *rrst.vim* *ft-rrst-syntax*
  1968. To highlight R code in knitr chunk headers, add to your |vimrc|: >
  1969. let rrst_syn_hl_chunk = 1
  1970. READLINE *readline.vim* *ft-readline-syntax*
  1971. The readline library is primarily used by the BASH shell, which adds quite a
  1972. few commands and options to the ones already available. To highlight these
  1973. items as well you can add the following to your |vimrc| or just type it in the
  1974. command line before loading a file with the readline syntax: >
  1975. let readline_has_bash = 1
  1976. This will add highlighting for the commands that BASH (version 2.05a and
  1977. later, and part earlier) adds.
  1978. RESTRUCTURED TEXT *rst.vim* *ft-rst-syntax*
  1979. Syntax highlighting is enabled for code blocks within the document for a
  1980. select number of file types. See $VIMRUNTIME/syntax/rst.vim for the default
  1981. syntax list.
  1982. To set a user-defined list of code block syntax highlighting: >
  1983. let rst_syntax_code_list = ['vim', 'lisp', ...]
  1984. To assign multiple code block types to a single syntax, define
  1985. `rst_syntax_code_list` as a mapping: >
  1986. let rst_syntax_code_list = {
  1987. \ 'cpp' = ['cpp', 'c++'],
  1988. \ 'bash' = ['bash', 'sh'],
  1989. ...
  1990. }
  1991. To use color highlighting for emphasis text: >
  1992. let rst_use_emphasis_colors = 1
  1993. To enable folding of sections: >
  1994. let rst_fold_enabled = 1
  1995. Note that folding can cause performance issues on some platforms.
  1996. REXX *rexx.vim* *ft-rexx-syntax*
  1997. If you notice highlighting errors while scrolling backwards, which are fixed
  1998. when redrawing with CTRL-L, try setting the "rexx_minlines" internal variable
  1999. to a larger number: >
  2000. :let rexx_minlines = 50
  2001. This will make the syntax synchronization start 50 lines before the first
  2002. displayed line. The default value is 10. The disadvantage of using a larger
  2003. number is that redrawing can become slow.
  2004. Vim tries to guess what type a ".r" file is. If it can't be detected (from
  2005. comment lines), the default is "r". To make the default rexx add this line to
  2006. your vimrc: *g:filetype_r*
  2007. >
  2008. :let g:filetype_r = "r"
  2009. RUBY *ruby.vim* *ft-ruby-syntax*
  2010. Ruby: Operator highlighting |ruby_operators|
  2011. Ruby: Whitespace errors |ruby_space_errors|
  2012. Ruby: Folding |ruby_fold| |ruby_foldable_groups|
  2013. Ruby: Reducing expensive operations |ruby_no_expensive| |ruby_minlines|
  2014. Ruby: Spellchecking strings |ruby_spellcheck_strings|
  2015. *ruby_operators*
  2016. Ruby: Operator highlighting ~
  2017. Operators can be highlighted by defining "ruby_operators": >
  2018. :let ruby_operators = 1
  2019. <
  2020. *ruby_space_errors*
  2021. Ruby: Whitespace errors ~
  2022. Whitespace errors can be highlighted by defining "ruby_space_errors": >
  2023. :let ruby_space_errors = 1
  2024. <
  2025. This will highlight trailing whitespace and tabs preceded by a space character
  2026. as errors. This can be refined by defining "ruby_no_trail_space_error" and
  2027. "ruby_no_tab_space_error" which will ignore trailing whitespace and tabs after
  2028. spaces respectively.
  2029. *ruby_fold* *ruby_foldable_groups*
  2030. Ruby: Folding ~
  2031. Folding can be enabled by defining "ruby_fold": >
  2032. :let ruby_fold = 1
  2033. <
  2034. This will set the value of 'foldmethod' to "syntax" locally to the current
  2035. buffer or window, which will enable syntax-based folding when editing Ruby
  2036. filetypes.
  2037. Default folding is rather detailed, i.e., small syntax units like "if", "do",
  2038. "%w[]" may create corresponding fold levels.
  2039. You can set "ruby_foldable_groups" to restrict which groups are foldable: >
  2040. :let ruby_foldable_groups = 'if case %'
  2041. <
  2042. The value is a space-separated list of keywords:
  2043. keyword meaning ~
  2044. -------- ------------------------------------- ~
  2045. ALL Most block syntax (default)
  2046. NONE Nothing
  2047. if "if" or "unless" block
  2048. def "def" block
  2049. class "class" block
  2050. module "module" block
  2051. do "do" block
  2052. begin "begin" block
  2053. case "case" block
  2054. for "for", "while", "until" loops
  2055. { Curly bracket block or hash literal
  2056. [ Array literal
  2057. % Literal with "%" notation, e.g.: %w(STRING), %!STRING!
  2058. / Regexp
  2059. string String and shell command output (surrounded by ', ", `)
  2060. : Symbol
  2061. # Multiline comment
  2062. << Here documents
  2063. __END__ Source code after "__END__" directive
  2064. *ruby_no_expensive*
  2065. Ruby: Reducing expensive operations ~
  2066. By default, the "end" keyword is colorized according to the opening statement
  2067. of the block it closes. While useful, this feature can be expensive; if you
  2068. experience slow redrawing (or you are on a terminal with poor color support)
  2069. you may want to turn it off by defining the "ruby_no_expensive" variable: >
  2070. :let ruby_no_expensive = 1
  2071. <
  2072. In this case the same color will be used for all control keywords.
  2073. *ruby_minlines*
  2074. If you do want this feature enabled, but notice highlighting errors while
  2075. scrolling backwards, which are fixed when redrawing with CTRL-L, try setting
  2076. the "ruby_minlines" variable to a value larger than 50: >
  2077. :let ruby_minlines = 100
  2078. <
  2079. Ideally, this value should be a number of lines large enough to embrace your
  2080. largest class or module.
  2081. *ruby_spellcheck_strings*
  2082. Ruby: Spellchecking strings ~
  2083. Ruby syntax will perform spellchecking of strings if you define
  2084. "ruby_spellcheck_strings": >
  2085. :let ruby_spellcheck_strings = 1
  2086. <
  2087. SCHEME *scheme.vim* *ft-scheme-syntax*
  2088. By default only R7RS keywords are highlighted and properly indented.
  2089. scheme.vim also supports extensions of the CHICKEN Scheme->C compiler.
  2090. Define b:is_chicken or g:is_chicken, if you need them.
  2091. SDL *sdl.vim* *ft-sdl-syntax*
  2092. The SDL highlighting probably misses a few keywords, but SDL has so many
  2093. of them it's almost impossibly to cope.
  2094. The new standard, SDL-2000, specifies that all identifiers are
  2095. case-sensitive (which was not so before), and that all keywords can be
  2096. used either completely lowercase or completely uppercase. To have the
  2097. highlighting reflect this, you can set the following variable: >
  2098. :let sdl_2000=1
  2099. This also sets many new keywords. If you want to disable the old
  2100. keywords, which is probably a good idea, use: >
  2101. :let SDL_no_96=1
  2102. The indentation is probably also incomplete, but right now I am very
  2103. satisfied with it for my own projects.
  2104. SED *sed.vim* *ft-sed-syntax*
  2105. To make tabs stand out from regular blanks (accomplished by using Todo
  2106. highlighting on the tabs), define "highlight_sedtabs" by putting >
  2107. :let highlight_sedtabs = 1
  2108. in the vimrc file. (This special highlighting only applies for tabs
  2109. inside search patterns, replacement texts, addresses or text included
  2110. by an Append/Change/Insert command.) If you enable this option, it is
  2111. also a good idea to set the tab width to one character; by doing that,
  2112. you can easily count the number of tabs in a string.
  2113. Bugs:
  2114. The transform command (y) is treated exactly like the substitute
  2115. command. This means that, as far as this syntax file is concerned,
  2116. transform accepts the same flags as substitute, which is wrong.
  2117. (Transform accepts no flags.) I tolerate this bug because the
  2118. involved commands need very complex treatment (95 patterns, one for
  2119. each plausible pattern delimiter).
  2120. SGML *sgml.vim* *ft-sgml-syntax*
  2121. The coloring scheme for tags in the SGML file works as follows.
  2122. The <> of opening tags are colored differently than the </> of a closing tag.
  2123. This is on purpose! For opening tags the 'Function' color is used, while for
  2124. closing tags the 'Type' color is used (See syntax.vim to check how those are
  2125. defined for you)
  2126. Known tag names are colored the same way as statements in C. Unknown tag
  2127. names are not colored which makes it easy to spot errors.
  2128. Note that the same is true for argument (or attribute) names. Known attribute
  2129. names are colored differently than unknown ones.
  2130. Some SGML tags are used to change the rendering of text. The following tags
  2131. are recognized by the sgml.vim syntax coloring file and change the way normal
  2132. text is shown: <varname> <emphasis> <command> <function> <literal>
  2133. <replaceable> <ulink> and <link>.
  2134. If you want to change how such text is rendered, you must redefine the
  2135. following syntax groups:
  2136. - sgmlBold
  2137. - sgmlBoldItalic
  2138. - sgmlUnderline
  2139. - sgmlItalic
  2140. - sgmlLink for links
  2141. To make this redefinition work you must redefine them all and define the
  2142. following variable in your vimrc (this is due to the order in which the files
  2143. are read during initialization) >
  2144. let sgml_my_rendering=1
  2145. You can also disable this rendering by adding the following line to your
  2146. vimrc file: >
  2147. let sgml_no_rendering=1
  2148. (Adapted from the html.vim help text by Claudio Fleiner <claudio@fleiner.com>)
  2149. *ft-posix-synax* *ft-dash-syntax*
  2150. SH *sh.vim* *ft-sh-syntax* *ft-bash-syntax* *ft-ksh-syntax*
  2151. This covers syntax highlighting for the older Unix (Bourne) sh, and newer
  2152. shells such as bash, dash, posix, and the Korn shells.
  2153. Vim attempts to determine which shell type is in use by specifying that
  2154. various filenames are of specific types, e.g.: >
  2155. ksh : .kshrc* *.ksh
  2156. bash: .bashrc* bashrc bash.bashrc .bash_profile* *.bash
  2157. <
  2158. See $VIMRUNTIME/filetype.vim for the full list of patterns. If none of these
  2159. cases pertain, then the first line of the file is examined (ex. looking for
  2160. /bin/sh /bin/ksh /bin/bash). If the first line specifies a shelltype, then
  2161. that shelltype is used. However some files (ex. .profile) are known to be
  2162. shell files but the type is not apparent. Furthermore, on many systems sh is
  2163. symbolically linked to "bash" (Linux, Windows+cygwin) or "ksh" (Posix).
  2164. One may specify a global default by instantiating one of the following
  2165. variables in your vimrc:
  2166. ksh: >
  2167. let g:is_kornshell = 1
  2168. < posix: (using this is the nearly the same as setting g:is_kornshell to 1) >
  2169. let g:is_posix = 1
  2170. < bash: >
  2171. let g:is_bash = 1
  2172. < sh: (default) Bourne shell >
  2173. let g:is_sh = 1
  2174. < (dash users should use posix)
  2175. If there's no "#! ..." line, and the user hasn't availed himself/herself of a
  2176. default sh.vim syntax setting as just shown, then syntax/sh.vim will assume
  2177. the Bourne shell syntax. No need to quote RFCs or market penetration
  2178. statistics in error reports, please -- just select the default version of the
  2179. sh your system uses and install the associated "let..." in your <.vimrc>.
  2180. The syntax/sh.vim file provides several levels of syntax-based folding: >
  2181. let g:sh_fold_enabled= 0 (default, no syntax folding)
  2182. let g:sh_fold_enabled= 1 (enable function folding)
  2183. let g:sh_fold_enabled= 2 (enable heredoc folding)
  2184. let g:sh_fold_enabled= 4 (enable if/do/for folding)
  2185. >
  2186. then various syntax items (ie. HereDocuments and function bodies) become
  2187. syntax-foldable (see |:syn-fold|). You also may add these together
  2188. to get multiple types of folding: >
  2189. let g:sh_fold_enabled= 3 (enables function and heredoc folding)
  2190. If you notice highlighting errors while scrolling backwards which are fixed
  2191. when one redraws with CTRL-L, try setting the "sh_minlines" internal variable
  2192. to a larger number. Example: >
  2193. let sh_minlines = 500
  2194. This will make syntax synchronization start 500 lines before the first
  2195. displayed line. The default value is 200. The disadvantage of using a larger
  2196. number is that redrawing can become slow.
  2197. If you don't have much to synchronize on, displaying can be very slow. To
  2198. reduce this, the "sh_maxlines" internal variable can be set. Example: >
  2199. let sh_maxlines = 100
  2200. <
  2201. The default is to use the twice sh_minlines. Set it to a smaller number to
  2202. speed up displaying. The disadvantage is that highlight errors may appear.
  2203. syntax/sh.vim tries to flag certain problems as errors; usually things like
  2204. extra ']'s, 'done's, 'fi's, etc. If you find the error handling problematic
  2205. for your purposes, you may suppress such error highlighting by putting
  2206. the following line in your .vimrc: >
  2207. let g:sh_no_error= 1
  2208. <
  2209. *sh-embed* *sh-awk*
  2210. Sh: EMBEDDING LANGUAGES~
  2211. You may wish to embed languages into sh. I'll give an example courtesy of
  2212. Lorance Stinson on how to do this with awk as an example. Put the following
  2213. file into $HOME/.config/nvim/after/syntax/sh/awkembed.vim: >
  2214. " AWK Embedding:
  2215. " ==============
  2216. " Shamelessly ripped from aspperl.vim by Aaron Hope.
  2217. if exists("b:current_syntax")
  2218. unlet b:current_syntax
  2219. endif
  2220. syn include @AWKScript syntax/awk.vim
  2221. syn region AWKScriptCode matchgroup=AWKCommand start=+[=\\]\@<!'+ skip=+\\'+ end=+'+ contains=@AWKScript contained
  2222. syn region AWKScriptEmbedded matchgroup=AWKCommand start=+\<awk\>+ skip=+\\$+ end=+[=\\]\@<!'+me=e-1 contains=@shIdList,@shExprList2 nextgroup=AWKScriptCode
  2223. syn cluster shCommandSubList add=AWKScriptEmbedded
  2224. hi def link AWKCommand Type
  2225. <
  2226. This code will then let the awk code in the single quotes: >
  2227. awk '...awk code here...'
  2228. be highlighted using the awk highlighting syntax. Clearly this may be
  2229. extended to other languages.
  2230. SPEEDUP *spup.vim* *ft-spup-syntax*
  2231. (AspenTech plant simulator)
  2232. The Speedup syntax file has some options:
  2233. - strict_subsections : If this variable is defined, only keywords for
  2234. sections and subsections will be highlighted as statements but not
  2235. other keywords (like WITHIN in the OPERATION section).
  2236. - highlight_types : Definition of this variable causes stream types
  2237. like temperature or pressure to be highlighted as Type, not as a
  2238. plain Identifier. Included are the types that are usually found in
  2239. the DECLARE section; if you defined own types, you have to include
  2240. them in the syntax file.
  2241. - oneline_comments : this value ranges from 1 to 3 and determines the
  2242. highlighting of # style comments.
  2243. oneline_comments = 1 : allow normal Speedup code after an even
  2244. number of #s.
  2245. oneline_comments = 2 : show code starting with the second # as
  2246. error. This is the default setting.
  2247. oneline_comments = 3 : show the whole line as error if it contains
  2248. more than one #.
  2249. Since especially OPERATION sections tend to become very large due to
  2250. PRESETting variables, syncing may be critical. If your computer is
  2251. fast enough, you can increase minlines and/or maxlines near the end of
  2252. the syntax file.
  2253. SQL *sql.vim* *ft-sql-syntax*
  2254. *sqlinformix.vim* *ft-sqlinformix-syntax*
  2255. *sqlanywhere.vim* *ft-sqlanywhere-syntax*
  2256. While there is an ANSI standard for SQL, most database engines add their own
  2257. custom extensions. Vim currently supports the Oracle and Informix dialects of
  2258. SQL. Vim assumes "*.sql" files are Oracle SQL by default.
  2259. Vim currently has SQL support for a variety of different vendors via syntax
  2260. scripts. You can change Vim's default from Oracle to any of the current SQL
  2261. supported types. You can also easily alter the SQL dialect being used on a
  2262. buffer by buffer basis.
  2263. For more detailed instructions see |ft_sql.txt|.
  2264. TCSH *tcsh.vim* *ft-tcsh-syntax*
  2265. This covers the shell named "tcsh". It is a superset of csh. See |csh.vim|
  2266. for how the filetype is detected.
  2267. Tcsh does not allow \" in strings unless the "backslash_quote" shell variable
  2268. is set. If you want VIM to assume that no backslash quote constructs exist add
  2269. this line to your vimrc: >
  2270. :let tcsh_backslash_quote = 0
  2271. If you notice highlighting errors while scrolling backwards, which are fixed
  2272. when redrawing with CTRL-L, try setting the "tcsh_minlines" internal variable
  2273. to a larger number: >
  2274. :let tcsh_minlines = 1000
  2275. This will make the syntax synchronization start 1000 lines before the first
  2276. displayed line. If you set "tcsh_minlines" to "fromstart", then
  2277. synchronization is done from the start of the file. The default value for
  2278. tcsh_minlines is 100. The disadvantage of using a larger number is that
  2279. redrawing can become slow.
  2280. TEX *tex.vim* *ft-tex-syntax* *latex-syntax*
  2281. Tex Contents~
  2282. Tex: Want Syntax Folding? |tex-folding|
  2283. Tex: No Spell Checking Wanted |g:tex_nospell|
  2284. Tex: Don't Want Spell Checking In Comments? |tex-nospell|
  2285. Tex: Want Spell Checking in Verbatim Zones? |tex-verb|
  2286. Tex: Run-on Comments or MathZones |tex-runon|
  2287. Tex: Slow Syntax Highlighting? |tex-slow|
  2288. Tex: Want To Highlight More Commands? |tex-morecommands|
  2289. Tex: Excessive Error Highlighting? |tex-error|
  2290. Tex: Need a new Math Group? |tex-math|
  2291. Tex: Starting a New Style? |tex-style|
  2292. Tex: Taking Advantage of Conceal Mode |tex-conceal|
  2293. Tex: Selective Conceal Mode |g:tex_conceal|
  2294. Tex: Controlling iskeyword |g:tex_isk|
  2295. Tex: Fine Subscript and Superscript Control |tex-supersub|
  2296. *tex-folding* *g:tex_fold_enabled*
  2297. Tex: Want Syntax Folding? ~
  2298. As of version 28 of <syntax/tex.vim>, syntax-based folding of parts, chapters,
  2299. sections, subsections, etc are supported. Put >
  2300. let g:tex_fold_enabled=1
  2301. in your vimrc, and :set fdm=syntax. I suggest doing the latter via a
  2302. modeline at the end of your LaTeX file: >
  2303. % vim: fdm=syntax
  2304. If your system becomes too slow, then you might wish to look into >
  2305. https://vimhelp.org/vim_faq.txt.html#faq-29.7
  2306. <
  2307. *g:tex_nospell*
  2308. Tex: No Spell Checking Wanted~
  2309. If you don't want spell checking anywhere in your LaTeX document, put >
  2310. let g:tex_nospell=1
  2311. into your vimrc. If you merely wish to suppress spell checking inside
  2312. comments only, see |g:tex_comment_nospell|.
  2313. *tex-nospell* *g:tex_comment_nospell*
  2314. Tex: Don't Want Spell Checking In Comments? ~
  2315. Some folks like to include things like source code in comments and so would
  2316. prefer that spell checking be disabled in comments in LaTeX files. To do
  2317. this, put the following in your vimrc: >
  2318. let g:tex_comment_nospell= 1
  2319. If you want to suppress spell checking everywhere inside your LaTeX document,
  2320. see |g:tex_nospell|.
  2321. *tex-verb* *g:tex_verbspell*
  2322. Tex: Want Spell Checking in Verbatim Zones?~
  2323. Often verbatim regions are used for things like source code; seldom does
  2324. one want source code spell-checked. However, for those of you who do
  2325. want your verbatim zones spell-checked, put the following in your vimrc: >
  2326. let g:tex_verbspell= 1
  2327. <
  2328. *tex-runon* *tex-stopzone*
  2329. Tex: Run-on Comments or MathZones ~
  2330. The <syntax/tex.vim> highlighting supports TeX, LaTeX, and some AmsTeX. The
  2331. highlighting supports three primary zones/regions: normal, texZone, and
  2332. texMathZone. Although considerable effort has been made to have these zones
  2333. terminate properly, zones delineated by $..$ and $$..$$ cannot be synchronized
  2334. as there's no difference between start and end patterns. Consequently, a
  2335. special "TeX comment" has been provided >
  2336. %stopzone
  2337. which will forcibly terminate the highlighting of either a texZone or a
  2338. texMathZone.
  2339. *tex-slow* *tex-sync*
  2340. Tex: Slow Syntax Highlighting? ~
  2341. If you have a slow computer, you may wish to reduce the values for >
  2342. :syn sync maxlines=200
  2343. :syn sync minlines=50
  2344. (especially the latter). If your computer is fast, you may wish to
  2345. increase them. This primarily affects synchronizing (i.e. just what group,
  2346. if any, is the text at the top of the screen supposed to be in?).
  2347. Another cause of slow highlighting is due to syntax-driven folding; see
  2348. |tex-folding| for a way around this.
  2349. *g:tex_fast*
  2350. Finally, if syntax highlighting is still too slow, you may set >
  2351. :let g:tex_fast= ""
  2352. in your vimrc. Used this way, the g:tex_fast variable causes the syntax
  2353. highlighting script to avoid defining any regions and associated
  2354. synchronization. The result will be much faster syntax highlighting; the
  2355. price: you will no longer have as much highlighting or any syntax-based
  2356. folding, and you will be missing syntax-based error checking.
  2357. You may decide that some syntax is acceptable; you may use the following table
  2358. selectively to enable just some syntax highlighting: >
  2359. b : allow bold and italic syntax
  2360. c : allow texComment syntax
  2361. m : allow texMatcher syntax (ie. {...} and [...])
  2362. M : allow texMath syntax
  2363. p : allow parts, chapter, section, etc syntax
  2364. r : allow texRefZone syntax (nocite, bibliography, label, pageref, eqref)
  2365. s : allow superscript/subscript regions
  2366. S : allow texStyle syntax
  2367. v : allow verbatim syntax
  2368. V : allow texNewEnv and texNewCmd syntax
  2369. <
  2370. As an example, let g:tex_fast= "M" will allow math-associated highlighting
  2371. but suppress all the other region-based syntax highlighting.
  2372. (also see: |g:tex_conceal| and |tex-supersub|)
  2373. *tex-morecommands* *tex-package*
  2374. Tex: Want To Highlight More Commands? ~
  2375. LaTeX is a programmable language, and so there are thousands of packages full
  2376. of specialized LaTeX commands, syntax, and fonts. If you're using such a
  2377. package you'll often wish that the distributed syntax/tex.vim would support
  2378. it. However, clearly this is impractical. So please consider using the
  2379. techniques in |mysyntaxfile-add| to extend or modify the highlighting provided
  2380. by syntax/tex.vim. Please consider uploading any extensions that you write,
  2381. which typically would go in $HOME/after/syntax/tex/[pkgname].vim, to
  2382. http://vim.sf.net/.
  2383. I've included some support for various popular packages on my website: >
  2384. http://www.drchip.org/astronaut/vim/index.html#LATEXPKGS
  2385. <
  2386. The syntax files there go into your .../after/syntax/tex/ directory.
  2387. *tex-error* *g:tex_no_error*
  2388. Tex: Excessive Error Highlighting? ~
  2389. The <tex.vim> supports lexical error checking of various sorts. Thus,
  2390. although the error checking is ofttimes very useful, it can indicate
  2391. errors where none actually are. If this proves to be a problem for you,
  2392. you may put in your vimrc the following statement: >
  2393. let g:tex_no_error=1
  2394. and all error checking by <syntax/tex.vim> will be suppressed.
  2395. *tex-math*
  2396. Tex: Need a new Math Group? ~
  2397. If you want to include a new math group in your LaTeX, the following
  2398. code shows you an example as to how you might do so: >
  2399. call TexNewMathZone(sfx,mathzone,starform)
  2400. You'll want to provide the new math group with a unique suffix
  2401. (currently, A-L and V-Z are taken by <syntax/tex.vim> itself).
  2402. As an example, consider how eqnarray is set up by <syntax/tex.vim>: >
  2403. call TexNewMathZone("D","eqnarray",1)
  2404. You'll need to change "mathzone" to the name of your new math group,
  2405. and then to the call to it in .vim/after/syntax/tex.vim.
  2406. The "starform" variable, if true, implies that your new math group
  2407. has a starred form (ie. eqnarray*).
  2408. *tex-style* *b:tex_stylish*
  2409. Tex: Starting a New Style? ~
  2410. One may use "\makeatletter" in *.tex files, thereby making the use of "@" in
  2411. commands available. However, since the *.tex file doesn't have one of the
  2412. following suffices: sty cls clo dtx ltx, the syntax highlighting will flag
  2413. such use of @ as an error. To solve this: >
  2414. :let b:tex_stylish = 1
  2415. :set ft=tex
  2416. Putting "let g:tex_stylish=1" into your vimrc will make <syntax/tex.vim>
  2417. always accept such use of @.
  2418. *tex-cchar* *tex-cole* *tex-conceal*
  2419. Tex: Taking Advantage of Conceal Mode~
  2420. If you have |'conceallevel'| set to 2 and if your encoding is utf-8, then a
  2421. number of character sequences can be translated into appropriate utf-8 glyphs,
  2422. including various accented characters, Greek characters in MathZones, and
  2423. superscripts and subscripts in MathZones. Not all characters can be made into
  2424. superscripts or subscripts; the constraint is due to what utf-8 supports.
  2425. In fact, only a few characters are supported as subscripts.
  2426. One way to use this is to have vertically split windows (see |CTRL-W_v|); one
  2427. with |'conceallevel'| at 0 and the other at 2; and both using |'scrollbind'|.
  2428. *g:tex_conceal*
  2429. Tex: Selective Conceal Mode~
  2430. You may selectively use conceal mode by setting g:tex_conceal in your
  2431. vimrc. By default, g:tex_conceal is set to "admgs" to enable concealment
  2432. for the following sets of characters: >
  2433. a = accents/ligatures
  2434. b = bold and italic
  2435. d = delimiters
  2436. m = math symbols
  2437. g = Greek
  2438. s = superscripts/subscripts
  2439. <
  2440. By leaving one or more of these out, the associated conceal-character
  2441. substitution will not be made.
  2442. *g:tex_isk* *g:tex_stylish*
  2443. Tex: Controlling iskeyword~
  2444. Normally, LaTeX keywords support 0-9, a-z, A-z, and 192-255 only. Latex
  2445. keywords don't support the underscore - except when in *.sty files. The
  2446. syntax highlighting script handles this with the following logic:
  2447. * If g:tex_stylish exists and is 1
  2448. then the file will be treated as a "sty" file, so the "_"
  2449. will be allowed as part of keywords
  2450. (regardless of g:tex_isk)
  2451. * Else if the file's suffix is sty, cls, clo, dtx, or ltx,
  2452. then the file will be treated as a "sty" file, so the "_"
  2453. will be allowed as part of keywords
  2454. (regardless of g:tex_isk)
  2455. * If g:tex_isk exists, then it will be used for the local 'iskeyword'
  2456. * Else the local 'iskeyword' will be set to 48-57,a-z,A-Z,192-255
  2457. *tex-supersub* *g:tex_superscripts* *g:tex_subscripts*
  2458. Tex: Fine Subscript and Superscript Control~
  2459. See |tex-conceal| for how to enable concealed character replacement.
  2460. See |g:tex_conceal| for selectively concealing accents, bold/italic,
  2461. math, Greek, and superscripts/subscripts.
  2462. One may exert fine control over which superscripts and subscripts one
  2463. wants syntax-based concealment for (see |:syn-cchar|). Since not all
  2464. fonts support all characters, one may override the
  2465. concealed-replacement lists; by default these lists are given by: >
  2466. let g:tex_superscripts= "[0-9a-zA-W.,:;+-<>/()=]"
  2467. let g:tex_subscripts= "[0-9aehijklmnoprstuvx,+-/().]"
  2468. <
  2469. For example, I use Luxi Mono Bold; it doesn't support subscript
  2470. characters for "hklmnpst", so I put >
  2471. let g:tex_subscripts= "[0-9aeijoruvx,+-/().]"
  2472. < in ~/.config/nvim/ftplugin/tex/tex.vim in order to avoid having
  2473. inscrutable utf-8 glyphs appear.
  2474. TF *tf.vim* *ft-tf-syntax*
  2475. There is one option for the tf syntax highlighting.
  2476. For syncing, minlines defaults to 100. If you prefer another value, you can
  2477. set "tf_minlines" to the value you desire. Example: >
  2478. :let tf_minlines = your choice
  2479. <
  2480. VIM *vim.vim* *ft-vim-syntax*
  2481. *g:vimsyn_minlines* *g:vimsyn_maxlines*
  2482. There is a trade-off between more accurate syntax highlighting versus screen
  2483. updating speed. To improve accuracy, you may wish to increase the
  2484. g:vimsyn_minlines variable. The g:vimsyn_maxlines variable may be used to
  2485. improve screen updating rates (see |:syn-sync| for more on this). >
  2486. g:vimsyn_minlines : used to set synchronization minlines
  2487. g:vimsyn_maxlines : used to set synchronization maxlines
  2488. <
  2489. (g:vim_minlines and g:vim_maxlines are deprecated variants of
  2490. these two options)
  2491. *g:vimsyn_embed*
  2492. The g:vimsyn_embed option allows users to select what, if any, types of
  2493. embedded script highlighting they wish to have. >
  2494. g:vimsyn_embed == 0 : disable (don't embed any scripts)
  2495. g:vimsyn_embed == 'lPr' : support embedded lua, python and ruby
  2496. <
  2497. This option is disabled by default.
  2498. *g:vimsyn_folding*
  2499. Some folding is now supported with syntax/vim.vim: >
  2500. g:vimsyn_folding == 0 or doesn't exist: no syntax-based folding
  2501. g:vimsyn_folding =~ 'a' : augroups
  2502. g:vimsyn_folding =~ 'f' : fold functions
  2503. g:vimsyn_folding =~ 'P' : fold python script
  2504. <
  2505. *g:vimsyn_noerror*
  2506. Not all error highlighting that syntax/vim.vim does may be correct; Vim script
  2507. is a difficult language to highlight correctly. A way to suppress error
  2508. highlighting is to put the following line in your |vimrc|: >
  2509. let g:vimsyn_noerror = 1
  2510. <
  2511. XF86CONFIG *xf86conf.vim* *ft-xf86conf-syntax*
  2512. The syntax of XF86Config file differs in XFree86 v3.x and v4.x. Both
  2513. variants are supported. Automatic detection is used, but is far from perfect.
  2514. You may need to specify the version manually. Set the variable
  2515. xf86conf_xfree86_version to 3 or 4 according to your XFree86 version in
  2516. your vimrc. Example: >
  2517. :let xf86conf_xfree86_version=3
  2518. When using a mix of versions, set the b:xf86conf_xfree86_version variable.
  2519. Note that spaces and underscores in option names are not supported. Use
  2520. "SyncOnGreen" instead of "__s yn con gr_e_e_n" if you want the option name
  2521. highlighted.
  2522. XML *xml.vim* *ft-xml-syntax*
  2523. Xml namespaces are highlighted by default. This can be inhibited by
  2524. setting a global variable: >
  2525. :let g:xml_namespace_transparent=1
  2526. <
  2527. *xml-folding*
  2528. The xml syntax file provides syntax |folding| (see |:syn-fold|) between
  2529. start and end tags. This can be turned on by >
  2530. :let g:xml_syntax_folding = 1
  2531. :set foldmethod=syntax
  2532. Note: syntax folding might slow down syntax highlighting significantly,
  2533. especially for large files.
  2534. X Pixmaps (XPM) *xpm.vim* *ft-xpm-syntax*
  2535. xpm.vim creates its syntax items dynamically based upon the contents of the
  2536. XPM file. Thus if you make changes e.g. in the color specification strings,
  2537. you have to source it again e.g. with ":set syn=xpm".
  2538. To copy a pixel with one of the colors, yank a "pixel" with "yl" and insert it
  2539. somewhere else with "P".
  2540. Do you want to draw with the mouse? Try the following: >
  2541. :function! GetPixel()
  2542. : let c = getline(".")[col(".") - 1]
  2543. : echo c
  2544. : exe "noremap <LeftMouse> <LeftMouse>r".c
  2545. : exe "noremap <LeftDrag> <LeftMouse>r".c
  2546. :endfunction
  2547. :noremap <RightMouse> <LeftMouse>:call GetPixel()<CR>
  2548. :set guicursor=n:hor20 " to see the color beneath the cursor
  2549. This turns the right button into a pipette and the left button into a pen.
  2550. It will work with XPM files that have one character per pixel only and you
  2551. must not click outside of the pixel strings, but feel free to improve it.
  2552. It will look much better with a font in a quadratic cell size, e.g. for X: >
  2553. :set guifont=-*-clean-medium-r-*-*-8-*-*-*-*-80-*
  2554. YAML *yaml.vim* *ft-yaml-syntax*
  2555. *g:yaml_schema* *b:yaml_schema*
  2556. A YAML schema is a combination of a set of tags and a mechanism for resolving
  2557. non-specific tags. For user this means that YAML parser may, depending on
  2558. plain scalar contents, treat plain scalar (which can actually be only string
  2559. and nothing else) as a value of the other type: null, boolean, floating-point,
  2560. integer. `g:yaml_schema` option determines according to which schema values
  2561. will be highlighted specially. Supported schemas are
  2562. Schema Description ~
  2563. failsafe No additional highlighting.
  2564. json Supports JSON-style numbers, booleans and null.
  2565. core Supports more number, boolean and null styles.
  2566. pyyaml In addition to core schema supports highlighting timestamps,
  2567. but there are some differences in what is recognized as
  2568. numbers and many additional boolean values not present in core
  2569. schema.
  2570. Default schema is `core`.
  2571. Note that schemas are not actually limited to plain scalars, but this is the
  2572. only difference between schemas defined in YAML specification and the only
  2573. difference defined in the syntax file.
  2574. ZSH *zsh.vim* *ft-zsh-syntax*
  2575. The syntax script for zsh allows for syntax-based folding: >
  2576. :let g:zsh_fold_enable = 1
  2577. ==============================================================================
  2578. 6. Defining a syntax *:syn-define* *E410*
  2579. Vim understands three types of syntax items:
  2580. 1. Keyword
  2581. It can only contain keyword characters, according to the 'iskeyword'
  2582. option. It cannot contain other syntax items. It will only match with a
  2583. complete word (there are no keyword characters before or after the match).
  2584. The keyword "if" would match in "if(a=b)", but not in "ifdef x", because
  2585. "(" is not a keyword character and "d" is.
  2586. 2. Match
  2587. This is a match with a single regexp pattern.
  2588. 3. Region
  2589. This starts at a match of the "start" regexp pattern and ends with a match
  2590. with the "end" regexp pattern. Any other text can appear in between. A
  2591. "skip" regexp pattern can be used to avoid matching the "end" pattern.
  2592. Several syntax ITEMs can be put into one syntax GROUP. For a syntax group
  2593. you can give highlighting attributes. For example, you could have an item
  2594. to define a "/* .. */" comment and another one that defines a "// .." comment,
  2595. and put them both in the "Comment" group. You can then specify that a
  2596. "Comment" will be in bold font and have a blue color. You are free to make
  2597. one highlight group for one syntax item, or put all items into one group.
  2598. This depends on how you want to specify your highlighting attributes. Putting
  2599. each item in its own group results in having to specify the highlighting
  2600. for a lot of groups.
  2601. Note that a syntax group and a highlight group are similar. For a highlight
  2602. group you will have given highlight attributes. These attributes will be used
  2603. for the syntax group with the same name.
  2604. In case more than one item matches at the same position, the one that was
  2605. defined LAST wins. Thus you can override previously defined syntax items by
  2606. using an item that matches the same text. But a keyword always goes before a
  2607. match or region. And a keyword with matching case always goes before a
  2608. keyword with ignoring case.
  2609. PRIORITY *:syn-priority*
  2610. When several syntax items may match, these rules are used:
  2611. 1. When multiple Match or Region items start in the same position, the item
  2612. defined last has priority.
  2613. 2. A Keyword has priority over Match and Region items.
  2614. 3. An item that starts in an earlier position has priority over items that
  2615. start in later positions.
  2616. DEFINING CASE *:syn-case* *E390*
  2617. :sy[ntax] case [match | ignore]
  2618. This defines if the following ":syntax" commands will work with
  2619. matching case, when using "match", or with ignoring case, when using
  2620. "ignore". Note that any items before this are not affected, and all
  2621. items until the next ":syntax case" command are affected.
  2622. :sy[ntax] case
  2623. Show either "syntax case match" or "syntax case ignore" (translated).
  2624. SPELL CHECKING *:syn-spell*
  2625. :sy[ntax] spell [toplevel | notoplevel | default]
  2626. This defines where spell checking is to be done for text that is not
  2627. in a syntax item:
  2628. toplevel: Text is spell checked.
  2629. notoplevel: Text is not spell checked.
  2630. default: When there is a @Spell cluster no spell checking.
  2631. For text in syntax items use the @Spell and @NoSpell clusters
  2632. |spell-syntax|. When there is no @Spell and no @NoSpell cluster then
  2633. spell checking is done for "default" and "toplevel".
  2634. To activate spell checking the 'spell' option must be set.
  2635. :sy[ntax] spell
  2636. Show either "syntax spell toplevel", "syntax spell notoplevel" or
  2637. "syntax spell default" (translated).
  2638. SYNTAX ISKEYWORD SETTING *:syn-iskeyword*
  2639. :sy[ntax] iskeyword [clear | {option}]
  2640. This defines the keyword characters. It's like the 'iskeyword' option
  2641. for but only applies to syntax highlighting.
  2642. clear: Syntax specific iskeyword setting is disabled and the
  2643. buffer-local 'iskeyword' setting is used.
  2644. {option} Set the syntax 'iskeyword' option to a new value.
  2645. Example: >
  2646. :syntax iskeyword @,48-57,192-255,$,_
  2647. <
  2648. This would set the syntax specific iskeyword option to include all
  2649. alphabetic characters, plus the numeric characters, all accented
  2650. characters and also includes the "_" and the "$".
  2651. If no argument is given, the current value will be output.
  2652. Setting this option influences what |/\k| matches in syntax patterns
  2653. and also determines where |:syn-keyword| will be checked for a new
  2654. match.
  2655. It is recommended when writing syntax files, to use this command to
  2656. set the correct value for the specific syntax language and not change
  2657. the 'iskeyword' option.
  2658. DEFINING KEYWORDS *:syn-keyword*
  2659. :sy[ntax] keyword {group-name} [{options}] {keyword} .. [{options}]
  2660. This defines a number of keywords.
  2661. {group-name} Is a syntax group name such as "Comment".
  2662. [{options}] See |:syn-arguments| below.
  2663. {keyword} .. Is a list of keywords which are part of this group.
  2664. Example: >
  2665. :syntax keyword Type int long char
  2666. <
  2667. The {options} can be given anywhere in the line. They will apply to
  2668. all keywords given, also for options that come after a keyword.
  2669. These examples do exactly the same: >
  2670. :syntax keyword Type contained int long char
  2671. :syntax keyword Type int long contained char
  2672. :syntax keyword Type int long char contained
  2673. < *E789* *E890*
  2674. When you have a keyword with an optional tail, like Ex commands in
  2675. Vim, you can put the optional characters inside [], to define all the
  2676. variations at once: >
  2677. :syntax keyword vimCommand ab[breviate] n[ext]
  2678. <
  2679. Don't forget that a keyword can only be recognized if all the
  2680. characters are included in the 'iskeyword' option. If one character
  2681. isn't, the keyword will never be recognized.
  2682. Multi-byte characters can also be used. These do not have to be in
  2683. 'iskeyword'.
  2684. See |:syn-iskeyword| for defining syntax specific iskeyword settings.
  2685. A keyword always has higher priority than a match or region, the
  2686. keyword is used if more than one item matches. Keywords do not nest
  2687. and a keyword can't contain anything else.
  2688. Note that when you have a keyword that is the same as an option (even
  2689. one that isn't allowed here), you can not use it. Use a match
  2690. instead.
  2691. The maximum length of a keyword is 80 characters.
  2692. The same keyword can be defined multiple times, when its containment
  2693. differs. For example, you can define the keyword once not contained
  2694. and use one highlight group, and once contained, and use a different
  2695. highlight group. Example: >
  2696. :syn keyword vimCommand tag
  2697. :syn keyword vimSetting contained tag
  2698. < When finding "tag" outside of any syntax item, the "vimCommand"
  2699. highlight group is used. When finding "tag" in a syntax item that
  2700. contains "vimSetting", the "vimSetting" group is used.
  2701. DEFINING MATCHES *:syn-match*
  2702. :sy[ntax] match {group-name} [{options}]
  2703. [excludenl]
  2704. [keepend]
  2705. {pattern}
  2706. [{options}]
  2707. This defines one match.
  2708. {group-name} A syntax group name such as "Comment".
  2709. [{options}] See |:syn-arguments| below.
  2710. [excludenl] Don't make a pattern with the end-of-line "$"
  2711. extend a containing match or region. Must be
  2712. given before the pattern. |:syn-excludenl|
  2713. keepend Don't allow contained matches to go past a
  2714. match with the end pattern. See
  2715. |:syn-keepend|.
  2716. {pattern} The search pattern that defines the match.
  2717. See |:syn-pattern| below.
  2718. Note that the pattern may match more than one
  2719. line, which makes the match depend on where
  2720. Vim starts searching for the pattern. You
  2721. need to make sure syncing takes care of this.
  2722. Example (match a character constant): >
  2723. :syntax match Character /'.'/hs=s+1,he=e-1
  2724. <
  2725. DEFINING REGIONS *:syn-region* *:syn-start* *:syn-skip* *:syn-end*
  2726. *E398* *E399*
  2727. :sy[ntax] region {group-name} [{options}]
  2728. [matchgroup={group-name}]
  2729. [keepend]
  2730. [extend]
  2731. [excludenl]
  2732. start={start_pattern} ..
  2733. [skip={skip_pattern}]
  2734. end={end_pattern} ..
  2735. [{options}]
  2736. This defines one region. It may span several lines.
  2737. {group-name} A syntax group name such as "Comment".
  2738. [{options}] See |:syn-arguments| below.
  2739. [matchgroup={group-name}] The syntax group to use for the following
  2740. start or end pattern matches only. Not used
  2741. for the text in between the matched start and
  2742. end patterns. Use NONE to reset to not using
  2743. a different group for the start or end match.
  2744. See |:syn-matchgroup|.
  2745. keepend Don't allow contained matches to go past a
  2746. match with the end pattern. See
  2747. |:syn-keepend|.
  2748. extend Override a "keepend" for an item this region
  2749. is contained in. See |:syn-extend|.
  2750. excludenl Don't make a pattern with the end-of-line "$"
  2751. extend a containing match or item. Only
  2752. useful for end patterns. Must be given before
  2753. the patterns it applies to. |:syn-excludenl|
  2754. start={start_pattern} The search pattern that defines the start of
  2755. the region. See |:syn-pattern| below.
  2756. skip={skip_pattern} The search pattern that defines text inside
  2757. the region where not to look for the end
  2758. pattern. See |:syn-pattern| below.
  2759. end={end_pattern} The search pattern that defines the end of
  2760. the region. See |:syn-pattern| below.
  2761. Example: >
  2762. :syntax region String start=+"+ skip=+\\"+ end=+"+
  2763. <
  2764. The start/skip/end patterns and the options can be given in any order.
  2765. There can be zero or one skip pattern. There must be one or more
  2766. start and end patterns. This means that you can omit the skip
  2767. pattern, but you must give at least one start and one end pattern. It
  2768. is allowed to have white space before and after the equal sign
  2769. (although it mostly looks better without white space).
  2770. When more than one start pattern is given, a match with one of these
  2771. is sufficient. This means there is an OR relation between the start
  2772. patterns. The last one that matches is used. The same is true for
  2773. the end patterns.
  2774. The search for the end pattern starts right after the start pattern.
  2775. Offsets are not used for this. This implies that the match for the
  2776. end pattern will never overlap with the start pattern.
  2777. The skip and end pattern can match across line breaks, but since the
  2778. search for the pattern can start in any line it often does not do what
  2779. you want. The skip pattern doesn't avoid a match of an end pattern in
  2780. the next line. Use single-line patterns to avoid trouble.
  2781. Note: The decision to start a region is only based on a matching start
  2782. pattern. There is no check for a matching end pattern. This does NOT
  2783. work: >
  2784. :syn region First start="(" end=":"
  2785. :syn region Second start="(" end=";"
  2786. < The Second always matches before the First (last defined pattern has
  2787. higher priority). The Second region then continues until the next
  2788. ';', no matter if there is a ':' before it. Using a match does work: >
  2789. :syn match First "(\_.\{-}:"
  2790. :syn match Second "(\_.\{-};"
  2791. < This pattern matches any character or line break with "\_." and
  2792. repeats that with "\{-}" (repeat as few as possible).
  2793. *:syn-keepend*
  2794. By default, a contained match can obscure a match for the end pattern.
  2795. This is useful for nesting. For example, a region that starts with
  2796. "{" and ends with "}", can contain another region. An encountered "}"
  2797. will then end the contained region, but not the outer region:
  2798. { starts outer "{}" region
  2799. { starts contained "{}" region
  2800. } ends contained "{}" region
  2801. } ends outer "{} region
  2802. If you don't want this, the "keepend" argument will make the matching
  2803. of an end pattern of the outer region also end any contained item.
  2804. This makes it impossible to nest the same region, but allows for
  2805. contained items to highlight parts of the end pattern, without causing
  2806. that to skip the match with the end pattern. Example: >
  2807. :syn match vimComment +"[^"]\+$+
  2808. :syn region vimCommand start="set" end="$" contains=vimComment keepend
  2809. < The "keepend" makes the vimCommand always end at the end of the line,
  2810. even though the contained vimComment includes a match with the <EOL>.
  2811. When "keepend" is not used, a match with an end pattern is retried
  2812. after each contained match. When "keepend" is included, the first
  2813. encountered match with an end pattern is used, truncating any
  2814. contained matches.
  2815. *:syn-extend*
  2816. The "keepend" behavior can be changed by using the "extend" argument.
  2817. When an item with "extend" is contained in an item that uses
  2818. "keepend", the "keepend" is ignored and the containing region will be
  2819. extended.
  2820. This can be used to have some contained items extend a region while
  2821. others don't. Example: >
  2822. :syn region htmlRef start=+<a>+ end=+</a>+ keepend contains=htmlItem,htmlScript
  2823. :syn match htmlItem +<[^>]*>+ contained
  2824. :syn region htmlScript start=+<script+ end=+</script[^>]*>+ contained extend
  2825. < Here the htmlItem item does not make the htmlRef item continue
  2826. further, it is only used to highlight the <> items. The htmlScript
  2827. item does extend the htmlRef item.
  2828. Another example: >
  2829. :syn region xmlFold start="<a>" end="</a>" fold transparent keepend extend
  2830. < This defines a region with "keepend", so that its end cannot be
  2831. changed by contained items, like when the "</a>" is matched to
  2832. highlight it differently. But when the xmlFold region is nested (it
  2833. includes itself), the "extend" applies, so that the "</a>" of a nested
  2834. region only ends that region, and not the one it is contained in.
  2835. *:syn-excludenl*
  2836. When a pattern for a match or end pattern of a region includes a '$'
  2837. to match the end-of-line, it will make a region item that it is
  2838. contained in continue on the next line. For example, a match with
  2839. "\\$" (backslash at the end of the line) can make a region continue
  2840. that would normally stop at the end of the line. This is the default
  2841. behavior. If this is not wanted, there are two ways to avoid it:
  2842. 1. Use "keepend" for the containing item. This will keep all
  2843. contained matches from extending the match or region. It can be
  2844. used when all contained items must not extend the containing item.
  2845. 2. Use "excludenl" in the contained item. This will keep that match
  2846. from extending the containing match or region. It can be used if
  2847. only some contained items must not extend the containing item.
  2848. "excludenl" must be given before the pattern it applies to.
  2849. *:syn-matchgroup*
  2850. "matchgroup" can be used to highlight the start and/or end pattern
  2851. differently than the body of the region. Example: >
  2852. :syntax region String matchgroup=Quote start=+"+ skip=+\\"+ end=+"+
  2853. < This will highlight the quotes with the "Quote" group, and the text in
  2854. between with the "String" group.
  2855. The "matchgroup" is used for all start and end patterns that follow,
  2856. until the next "matchgroup". Use "matchgroup=NONE" to go back to not
  2857. using a matchgroup.
  2858. In a start or end pattern that is highlighted with "matchgroup" the
  2859. contained items of the region are not used. This can be used to avoid
  2860. that a contained item matches in the start or end pattern match. When
  2861. using "transparent", this does not apply to a start or end pattern
  2862. match that is highlighted with "matchgroup".
  2863. Here is an example, which highlights three levels of parentheses in
  2864. different colors: >
  2865. :sy region par1 matchgroup=par1 start=/(/ end=/)/ contains=par2
  2866. :sy region par2 matchgroup=par2 start=/(/ end=/)/ contains=par3 contained
  2867. :sy region par3 matchgroup=par3 start=/(/ end=/)/ contains=par1 contained
  2868. :hi par1 ctermfg=red guifg=red
  2869. :hi par2 ctermfg=blue guifg=blue
  2870. :hi par3 ctermfg=darkgreen guifg=darkgreen
  2871. <
  2872. *E849*
  2873. The maximum number of syntax groups is 19999.
  2874. ==============================================================================
  2875. 7. :syntax arguments *:syn-arguments*
  2876. The :syntax commands that define syntax items take a number of arguments.
  2877. The common ones are explained here. The arguments may be given in any order
  2878. and may be mixed with patterns.
  2879. Not all commands accept all arguments. This table shows which arguments
  2880. can not be used for all commands:
  2881. *E395*
  2882. contains oneline fold display extend concealends~
  2883. :syntax keyword - - - - - -
  2884. :syntax match yes - yes yes yes -
  2885. :syntax region yes yes yes yes yes yes
  2886. These arguments can be used for all three commands:
  2887. conceal
  2888. cchar
  2889. contained
  2890. containedin
  2891. nextgroup
  2892. transparent
  2893. skipwhite
  2894. skipnl
  2895. skipempty
  2896. conceal *conceal* *:syn-conceal*
  2897. When the "conceal" argument is given, the item is marked as concealable.
  2898. Whether or not it is actually concealed depends on the value of the
  2899. 'conceallevel' option. The 'concealcursor' option is used to decide whether
  2900. concealable items in the current line are displayed unconcealed to be able to
  2901. edit the line.
  2902. Another way to conceal text is with |matchadd()|.
  2903. concealends *:syn-concealends*
  2904. When the "concealends" argument is given, the start and end matches of
  2905. the region, but not the contents of the region, are marked as concealable.
  2906. Whether or not they are actually concealed depends on the setting on the
  2907. 'conceallevel' option. The ends of a region can only be concealed separately
  2908. in this way when they have their own highlighting via "matchgroup"
  2909. cchar *:syn-cchar*
  2910. *E844*
  2911. The "cchar" argument defines the character shown in place of the item
  2912. when it is concealed (setting "cchar" only makes sense when the conceal
  2913. argument is given.) If "cchar" is not set then the default conceal
  2914. character defined in the 'listchars' option is used. The character cannot be
  2915. a control character such as Tab. Example: >
  2916. :syntax match Entity "&amp;" conceal cchar=&
  2917. See |hl-Conceal| for highlighting.
  2918. contained *:syn-contained*
  2919. When the "contained" argument is given, this item will not be recognized at
  2920. the top level, but only when it is mentioned in the "contains" field of
  2921. another match. Example: >
  2922. :syntax keyword Todo TODO contained
  2923. :syntax match Comment "//.*" contains=Todo
  2924. display *:syn-display*
  2925. If the "display" argument is given, this item will be skipped when the
  2926. detected highlighting will not be displayed. This will speed up highlighting,
  2927. by skipping this item when only finding the syntax state for the text that is
  2928. to be displayed.
  2929. Generally, you can use "display" for match and region items that meet these
  2930. conditions:
  2931. - The item does not continue past the end of a line. Example for C: A region
  2932. for a "/*" comment can't contain "display", because it continues on the next
  2933. line.
  2934. - The item does not contain items that continue past the end of the line or
  2935. make it continue on the next line.
  2936. - The item does not change the size of any item it is contained in. Example
  2937. for C: A match with "\\$" in a preprocessor match can't have "display",
  2938. because it may make that preprocessor match shorter.
  2939. - The item does not allow other items to match that didn't match otherwise,
  2940. and that item may extend the match too far. Example for C: A match for a
  2941. "//" comment can't use "display", because a "/*" inside that comment would
  2942. match then and start a comment which extends past the end of the line.
  2943. Examples, for the C language, where "display" can be used:
  2944. - match with a number
  2945. - match with a label
  2946. transparent *:syn-transparent*
  2947. If the "transparent" argument is given, this item will not be highlighted
  2948. itself, but will take the highlighting of the item it is contained in. This
  2949. is useful for syntax items that don't need any highlighting but are used
  2950. only to skip over a part of the text.
  2951. The "contains=" argument is also inherited from the item it is contained in,
  2952. unless a "contains" argument is given for the transparent item itself. To
  2953. avoid that unwanted items are contained, use "contains=NONE". Example, which
  2954. highlights words in strings, but makes an exception for "vim": >
  2955. :syn match myString /'[^']*'/ contains=myWord,myVim
  2956. :syn match myWord /\<[a-z]*\>/ contained
  2957. :syn match myVim /\<vim\>/ transparent contained contains=NONE
  2958. :hi link myString String
  2959. :hi link myWord Comment
  2960. Since the "myVim" match comes after "myWord" it is the preferred match (last
  2961. match in the same position overrules an earlier one). The "transparent"
  2962. argument makes the "myVim" match use the same highlighting as "myString". But
  2963. it does not contain anything. If the "contains=NONE" argument would be left
  2964. out, then "myVim" would use the contains argument from myString and allow
  2965. "myWord" to be contained, which will be highlighted as a Constant. This
  2966. happens because a contained match doesn't match inside itself in the same
  2967. position, thus the "myVim" match doesn't overrule the "myWord" match here.
  2968. When you look at the colored text, it is like looking at layers of contained
  2969. items. The contained item is on top of the item it is contained in, thus you
  2970. see the contained item. When a contained item is transparent, you can look
  2971. through, thus you see the item it is contained in. In a picture:
  2972. look from here
  2973. | | | | | |
  2974. V V V V V V
  2975. xxxx yyy more contained items
  2976. .................... contained item (transparent)
  2977. ============================= first item
  2978. The 'x', 'y' and '=' represent a highlighted syntax item. The '.' represent a
  2979. transparent group.
  2980. What you see is:
  2981. =======xxxx=======yyy========
  2982. Thus you look through the transparent "....".
  2983. oneline *:syn-oneline*
  2984. The "oneline" argument indicates that the region does not cross a line
  2985. boundary. It must match completely in the current line. However, when the
  2986. region has a contained item that does cross a line boundary, it continues on
  2987. the next line anyway. A contained item can be used to recognize a line
  2988. continuation pattern. But the "end" pattern must still match in the first
  2989. line, otherwise the region doesn't even start.
  2990. When the start pattern includes a "\n" to match an end-of-line, the end
  2991. pattern must be found in the same line as where the start pattern ends. The
  2992. end pattern may also include an end-of-line. Thus the "oneline" argument
  2993. means that the end of the start pattern and the start of the end pattern must
  2994. be within one line. This can't be changed by a skip pattern that matches a
  2995. line break.
  2996. fold *:syn-fold*
  2997. The "fold" argument makes the fold level increase by one for this item.
  2998. Example: >
  2999. :syn region myFold start="{" end="}" transparent fold
  3000. :syn sync fromstart
  3001. :set foldmethod=syntax
  3002. This will make each {} block form one fold.
  3003. The fold will start on the line where the item starts, and end where the item
  3004. ends. If the start and end are within the same line, there is no fold.
  3005. The 'foldnestmax' option limits the nesting of syntax folds.
  3006. *:syn-contains* *E405* *E406* *E407* *E408* *E409*
  3007. contains={group-name},..
  3008. The "contains" argument is followed by a list of syntax group names. These
  3009. groups will be allowed to begin inside the item (they may extend past the
  3010. containing group's end). This allows for recursive nesting of matches and
  3011. regions. If there is no "contains" argument, no groups will be contained in
  3012. this item. The group names do not need to be defined before they can be used
  3013. here.
  3014. contains=ALL
  3015. If the only item in the contains list is "ALL", then all
  3016. groups will be accepted inside the item.
  3017. contains=ALLBUT,{group-name},..
  3018. If the first item in the contains list is "ALLBUT", then all
  3019. groups will be accepted inside the item, except the ones that
  3020. are listed. Example: >
  3021. :syntax region Block start="{" end="}" ... contains=ALLBUT,Function
  3022. contains=TOP
  3023. If the first item in the contains list is "TOP", then all
  3024. groups will be accepted that don't have the "contained"
  3025. argument.
  3026. contains=TOP,{group-name},..
  3027. Like "TOP", but excluding the groups that are listed.
  3028. contains=CONTAINED
  3029. If the first item in the contains list is "CONTAINED", then
  3030. all groups will be accepted that have the "contained"
  3031. argument.
  3032. contains=CONTAINED,{group-name},..
  3033. Like "CONTAINED", but excluding the groups that are
  3034. listed.
  3035. The {group-name} in the "contains" list can be a pattern. All group names
  3036. that match the pattern will be included (or excluded, if "ALLBUT" is used).
  3037. The pattern cannot contain white space or a ','. Example: >
  3038. ... contains=Comment.*,Keyw[0-3]
  3039. The matching will be done at moment the syntax command is executed. Groups
  3040. that are defined later will not be matched. Also, if the current syntax
  3041. command defines a new group, it is not matched. Be careful: When putting
  3042. syntax commands in a file you can't rely on groups NOT being defined, because
  3043. the file may have been sourced before, and ":syn clear" doesn't remove the
  3044. group names.
  3045. The contained groups will also match in the start and end patterns of a
  3046. region. If this is not wanted, the "matchgroup" argument can be used
  3047. |:syn-matchgroup|. The "ms=" and "me=" offsets can be used to change the
  3048. region where contained items do match. Note that this may also limit the
  3049. area that is highlighted
  3050. containedin={group-name}... *:syn-containedin*
  3051. The "containedin" argument is followed by a list of syntax group names. The
  3052. item will be allowed to begin inside these groups. This works as if the
  3053. containing item has a "contains=" argument that includes this item.
  3054. The {group-name}... can be used just like for "contains", as explained above.
  3055. This is useful when adding a syntax item afterwards. An item can be told to
  3056. be included inside an already existing item, without changing the definition
  3057. of that item. For example, to highlight a word in a C comment after loading
  3058. the C syntax: >
  3059. :syn keyword myword HELP containedin=cComment contained
  3060. Note that "contained" is also used, to avoid that the item matches at the top
  3061. level.
  3062. Matches for "containedin" are added to the other places where the item can
  3063. appear. A "contains" argument may also be added as usual. Don't forget that
  3064. keywords never contain another item, thus adding them to "containedin" won't
  3065. work.
  3066. nextgroup={group-name},.. *:syn-nextgroup*
  3067. The "nextgroup" argument is followed by a list of syntax group names,
  3068. separated by commas (just like with "contains", so you can also use patterns).
  3069. If the "nextgroup" argument is given, the mentioned syntax groups will be
  3070. tried for a match, after the match or region ends. If none of the groups have
  3071. a match, highlighting continues normally. If there is a match, this group
  3072. will be used, even when it is not mentioned in the "contains" field of the
  3073. current group. This is like giving the mentioned group priority over all
  3074. other groups. Example: >
  3075. :syntax match ccFoobar "Foo.\{-}Bar" contains=ccFoo
  3076. :syntax match ccFoo "Foo" contained nextgroup=ccFiller
  3077. :syntax region ccFiller start="." matchgroup=ccBar end="Bar" contained
  3078. This will highlight "Foo" and "Bar" differently, and only when there is a
  3079. "Bar" after "Foo". In the text line below, "f" shows where ccFoo is used for
  3080. highlighting, and "bbb" where ccBar is used. >
  3081. Foo asdfasd Bar asdf Foo asdf Bar asdf
  3082. fff bbb fff bbb
  3083. Note the use of ".\{-}" to skip as little as possible until the next Bar.
  3084. when ".*" would be used, the "asdf" in between "Bar" and "Foo" would be
  3085. highlighted according to the "ccFoobar" group, because the ccFooBar match
  3086. would include the first "Foo" and the last "Bar" in the line (see |pattern|).
  3087. skipwhite *:syn-skipwhite*
  3088. skipnl *:syn-skipnl*
  3089. skipempty *:syn-skipempty*
  3090. These arguments are only used in combination with "nextgroup". They can be
  3091. used to allow the next group to match after skipping some text:
  3092. skipwhite skip over space and tab characters
  3093. skipnl skip over the end of a line
  3094. skipempty skip over empty lines (implies a "skipnl")
  3095. When "skipwhite" is present, the white space is only skipped if there is no
  3096. next group that matches the white space.
  3097. When "skipnl" is present, the match with nextgroup may be found in the next
  3098. line. This only happens when the current item ends at the end of the current
  3099. line! When "skipnl" is not present, the nextgroup will only be found after
  3100. the current item in the same line.
  3101. When skipping text while looking for a next group, the matches for other
  3102. groups are ignored. Only when no next group matches, other items are tried
  3103. for a match again. This means that matching a next group and skipping white
  3104. space and <EOL>s has a higher priority than other items.
  3105. Example: >
  3106. :syn match ifstart "\<if.*" nextgroup=ifline skipwhite skipempty
  3107. :syn match ifline "[^ \t].*" nextgroup=ifline skipwhite skipempty contained
  3108. :syn match ifline "endif" contained
  3109. Note that the "[^ \t].*" match matches all non-white text. Thus it would also
  3110. match "endif". Therefore the "endif" match is put last, so that it takes
  3111. precedence.
  3112. Note that this example doesn't work for nested "if"s. You need to add
  3113. "contains" arguments to make that work (omitted for simplicity of the
  3114. example).
  3115. IMPLICIT CONCEAL *:syn-conceal-implicit*
  3116. :sy[ntax] conceal [on|off]
  3117. This defines if the following ":syntax" commands will define keywords,
  3118. matches or regions with the "conceal" flag set. After ":syn conceal
  3119. on", all subsequent ":syn keyword", ":syn match" or ":syn region"
  3120. defined will have the "conceal" flag set implicitly. ":syn conceal
  3121. off" returns to the normal state where the "conceal" flag must be
  3122. given explicitly.
  3123. :sy[ntax] conceal
  3124. Show either "syntax conceal on" or "syntax conceal off" (translated).
  3125. ==============================================================================
  3126. 8. Syntax patterns *:syn-pattern* *E401* *E402*
  3127. In the syntax commands, a pattern must be surrounded by two identical
  3128. characters. This is like it works for the ":s" command. The most common to
  3129. use is the double quote. But if the pattern contains a double quote, you can
  3130. use another character that is not used in the pattern. Examples: >
  3131. :syntax region Comment start="/\*" end="\*/"
  3132. :syntax region String start=+"+ end=+"+ skip=+\\"+
  3133. See |pattern| for the explanation of what a pattern is. Syntax patterns are
  3134. always interpreted like the 'magic' option is set, no matter what the actual
  3135. value of 'magic' is. And the patterns are interpreted like the 'l' flag is
  3136. not included in 'cpoptions'. This was done to make syntax files portable and
  3137. independent of the 'magic' setting.
  3138. Try to avoid patterns that can match an empty string, such as "[a-z]*".
  3139. This slows down the highlighting a lot, because it matches everywhere.
  3140. *:syn-pattern-offset*
  3141. The pattern can be followed by a character offset. This can be used to
  3142. change the highlighted part, and to change the text area included in the
  3143. match or region (which only matters when trying to match other items). Both
  3144. are relative to the matched pattern. The character offset for a skip
  3145. pattern can be used to tell where to continue looking for an end pattern.
  3146. The offset takes the form of "{what}={offset}"
  3147. The {what} can be one of seven strings:
  3148. ms Match Start offset for the start of the matched text
  3149. me Match End offset for the end of the matched text
  3150. hs Highlight Start offset for where the highlighting starts
  3151. he Highlight End offset for where the highlighting ends
  3152. rs Region Start offset for where the body of a region starts
  3153. re Region End offset for where the body of a region ends
  3154. lc Leading Context offset past "leading context" of pattern
  3155. The {offset} can be:
  3156. s start of the matched pattern
  3157. s+{nr} start of the matched pattern plus {nr} chars to the right
  3158. s-{nr} start of the matched pattern plus {nr} chars to the left
  3159. e end of the matched pattern
  3160. e+{nr} end of the matched pattern plus {nr} chars to the right
  3161. e-{nr} end of the matched pattern plus {nr} chars to the left
  3162. {nr} (for "lc" only): start matching {nr} chars right of the start
  3163. Examples: "ms=s+1", "hs=e-2", "lc=3".
  3164. Although all offsets are accepted after any pattern, they are not always
  3165. meaningful. This table shows which offsets are actually used:
  3166. ms me hs he rs re lc ~
  3167. match item yes yes yes yes - - yes
  3168. region item start yes - yes - yes - yes
  3169. region item skip - yes - - - - yes
  3170. region item end - yes - yes - yes yes
  3171. Offsets can be concatenated, with a ',' in between. Example: >
  3172. :syn match String /"[^"]*"/hs=s+1,he=e-1
  3173. <
  3174. some "string" text
  3175. ^^^^^^ highlighted
  3176. Notes:
  3177. - There must be no white space between the pattern and the character
  3178. offset(s).
  3179. - The highlighted area will never be outside of the matched text.
  3180. - A negative offset for an end pattern may not always work, because the end
  3181. pattern may be detected when the highlighting should already have stopped.
  3182. - Before Vim 7.2 the offsets were counted in bytes instead of characters.
  3183. This didn't work well for multi-byte characters, so it was changed with the
  3184. Vim 7.2 release.
  3185. - The start of a match cannot be in a line other than where the pattern
  3186. matched. This doesn't work: "a\nb"ms=e. You can make the highlighting
  3187. start in another line, this does work: "a\nb"hs=e.
  3188. Example (match a comment but don't highlight the /* and */): >
  3189. :syntax region Comment start="/\*"hs=e+1 end="\*/"he=s-1
  3190. <
  3191. /* this is a comment */
  3192. ^^^^^^^^^^^^^^^^^^^ highlighted
  3193. A more complicated Example: >
  3194. :syn region Exa matchgroup=Foo start="foo"hs=s+2,rs=e+2 matchgroup=Bar end="bar"me=e-1,he=e-1,re=s-1
  3195. <
  3196. abcfoostringbarabc
  3197. mmmmmmmmmmm match
  3198. sssrrreee highlight start/region/end ("Foo", "Exa" and "Bar")
  3199. Leading context *:syn-lc* *:syn-leading* *:syn-context*
  3200. Note: This is an obsolete feature, only included for backwards compatibility
  3201. with previous Vim versions. It's now recommended to use the |/\@<=| construct
  3202. in the pattern.
  3203. The "lc" offset specifies leading context -- a part of the pattern that must
  3204. be present, but is not considered part of the match. An offset of "lc=n" will
  3205. cause Vim to step back n columns before attempting the pattern match, allowing
  3206. characters which have already been matched in previous patterns to also be
  3207. used as leading context for this match. This can be used, for instance, to
  3208. specify that an "escaping" character must not precede the match: >
  3209. :syn match ZNoBackslash "[^\\]z"ms=s+1
  3210. :syn match WNoBackslash "[^\\]w"lc=1
  3211. :syn match Underline "_\+"
  3212. <
  3213. ___zzzz ___wwww
  3214. ^^^ ^^^ matches Underline
  3215. ^ ^ matches ZNoBackslash
  3216. ^^^^ matches WNoBackslash
  3217. The "ms" offset is automatically set to the same value as the "lc" offset,
  3218. unless you set "ms" explicitly.
  3219. Multi-line patterns *:syn-multi-line*
  3220. The patterns can include "\n" to match an end-of-line. Mostly this works as
  3221. expected, but there are a few exceptions.
  3222. When using a start pattern with an offset, the start of the match is not
  3223. allowed to start in a following line. The highlighting can start in a
  3224. following line though. Using the "\zs" item also requires that the start of
  3225. the match doesn't move to another line.
  3226. The skip pattern can include the "\n", but the search for an end pattern will
  3227. continue in the first character of the next line, also when that character is
  3228. matched by the skip pattern. This is because redrawing may start in any line
  3229. halfway in a region and there is no check if the skip pattern started in a
  3230. previous line. For example, if the skip pattern is "a\nb" and an end pattern
  3231. is "b", the end pattern does match in the second line of this: >
  3232. x x a
  3233. b x x
  3234. Generally this means that the skip pattern should not match any characters
  3235. after the "\n".
  3236. External matches *:syn-ext-match*
  3237. These extra regular expression items are available in region patterns:
  3238. */\z(* */\z(\)* *E50* *E52* *E879*
  3239. \z(\) Marks the sub-expression as "external", meaning that it can be
  3240. accessed from another pattern match. Currently only usable in
  3241. defining a syntax region start pattern.
  3242. */\z1* */\z2* */\z3* */\z4* */\z5*
  3243. \z1 ... \z9 */\z6* */\z7* */\z8* */\z9* *E66* *E67*
  3244. Matches the same string that was matched by the corresponding
  3245. sub-expression in a previous start pattern match.
  3246. Sometimes the start and end patterns of a region need to share a common
  3247. sub-expression. A common example is the "here" document in Perl and many Unix
  3248. shells. This effect can be achieved with the "\z" special regular expression
  3249. items, which marks a sub-expression as "external", in the sense that it can be
  3250. referenced from outside the pattern in which it is defined. The here-document
  3251. example, for instance, can be done like this: >
  3252. :syn region hereDoc start="<<\z(\I\i*\)" end="^\z1$"
  3253. As can be seen here, the \z actually does double duty. In the start pattern,
  3254. it marks the "\(\I\i*\)" sub-expression as external; in the end pattern, it
  3255. changes the \z1 back-reference into an external reference referring to the
  3256. first external sub-expression in the start pattern. External references can
  3257. also be used in skip patterns: >
  3258. :syn region foo start="start \(\I\i*\)" skip="not end \z1" end="end \z1"
  3259. Note that normal and external sub-expressions are completely orthogonal and
  3260. indexed separately; for instance, if the pattern "\z(..\)\(..\)" is applied
  3261. to the string "aabb", then \1 will refer to "bb" and \z1 will refer to "aa".
  3262. Note also that external sub-expressions cannot be accessed as back-references
  3263. within the same pattern like normal sub-expressions. If you want to use one
  3264. sub-expression as both a normal and an external sub-expression, you can nest
  3265. the two, as in "\(\z(...\)\)".
  3266. Note that only matches within a single line can be used. Multi-line matches
  3267. cannot be referred to.
  3268. ==============================================================================
  3269. 9. Syntax clusters *:syn-cluster* *E400*
  3270. :sy[ntax] cluster {cluster-name} [contains={group-name}..]
  3271. [add={group-name}..]
  3272. [remove={group-name}..]
  3273. This command allows you to cluster a list of syntax groups together under a
  3274. single name.
  3275. contains={group-name}..
  3276. The cluster is set to the specified list of groups.
  3277. add={group-name}..
  3278. The specified groups are added to the cluster.
  3279. remove={group-name}..
  3280. The specified groups are removed from the cluster.
  3281. A cluster so defined may be referred to in a contains=.., containedin=..,
  3282. nextgroup=.., add=.. or remove=.. list with a "@" prefix. You can also use
  3283. this notation to implicitly declare a cluster before specifying its contents.
  3284. Example: >
  3285. :syntax match Thing "# [^#]\+ #" contains=@ThingMembers
  3286. :syntax cluster ThingMembers contains=ThingMember1,ThingMember2
  3287. As the previous example suggests, modifications to a cluster are effectively
  3288. retroactive; the membership of the cluster is checked at the last minute, so
  3289. to speak: >
  3290. :syntax keyword A aaa
  3291. :syntax keyword B bbb
  3292. :syntax cluster AandB contains=A
  3293. :syntax match Stuff "( aaa bbb )" contains=@AandB
  3294. :syntax cluster AandB add=B " now both keywords are matched in Stuff
  3295. This also has implications for nested clusters: >
  3296. :syntax keyword A aaa
  3297. :syntax keyword B bbb
  3298. :syntax cluster SmallGroup contains=B
  3299. :syntax cluster BigGroup contains=A,@SmallGroup
  3300. :syntax match Stuff "( aaa bbb )" contains=@BigGroup
  3301. :syntax cluster BigGroup remove=B " no effect, since B isn't in BigGroup
  3302. :syntax cluster SmallGroup remove=B " now bbb isn't matched within Stuff
  3303. <
  3304. *E848*
  3305. The maximum number of clusters is 9767.
  3306. ==============================================================================
  3307. 10. Including syntax files *:syn-include* *E397*
  3308. It is often useful for one language's syntax file to include a syntax file for
  3309. a related language. Depending on the exact relationship, this can be done in
  3310. two different ways:
  3311. - If top-level syntax items in the included syntax file are to be
  3312. allowed at the top level in the including syntax, you can simply use
  3313. the |:runtime| command: >
  3314. " In cpp.vim:
  3315. :runtime! syntax/c.vim
  3316. :unlet b:current_syntax
  3317. < - If top-level syntax items in the included syntax file are to be
  3318. contained within a region in the including syntax, you can use the
  3319. ":syntax include" command:
  3320. :sy[ntax] include [@{grouplist-name}] {file-name}
  3321. All syntax items declared in the included file will have the
  3322. "contained" flag added. In addition, if a group list is specified,
  3323. all top-level syntax items in the included file will be added to
  3324. that list. >
  3325. " In perl.vim:
  3326. :syntax include @Pod <sfile>:p:h/pod.vim
  3327. :syntax region perlPOD start="^=head" end="^=cut" contains=@Pod
  3328. <
  3329. When {file-name} is an absolute path (starts with "/", "c:", "$VAR"
  3330. or "<sfile>") that file is sourced. When it is a relative path
  3331. (e.g., "syntax/pod.vim") the file is searched for in 'runtimepath'.
  3332. All matching files are loaded. Using a relative path is
  3333. recommended, because it allows a user to replace the included file
  3334. with his own version, without replacing the file that does the ":syn
  3335. include".
  3336. *E847*
  3337. The maximum number of includes is 999.
  3338. ==============================================================================
  3339. 11. Synchronizing *:syn-sync* *E403* *E404*
  3340. Vim wants to be able to start redrawing in any position in the document. To
  3341. make this possible it needs to know the syntax state at the position where
  3342. redrawing starts.
  3343. :sy[ntax] sync [ccomment [group-name] | minlines={N} | ...]
  3344. There are four ways to synchronize:
  3345. 1. Always parse from the start of the file.
  3346. |:syn-sync-first|
  3347. 2. Based on C-style comments. Vim understands how C-comments work and can
  3348. figure out if the current line starts inside or outside a comment.
  3349. |:syn-sync-second|
  3350. 3. Jumping back a certain number of lines and start parsing there.
  3351. |:syn-sync-third|
  3352. 4. Searching backwards in the text for a pattern to sync on.
  3353. |:syn-sync-fourth|
  3354. *:syn-sync-maxlines* *:syn-sync-minlines*
  3355. For the last three methods, the line range where the parsing can start is
  3356. limited by "minlines" and "maxlines".
  3357. If the "minlines={N}" argument is given, the parsing always starts at least
  3358. that many lines backwards. This can be used if the parsing may take a few
  3359. lines before it's correct, or when it's not possible to use syncing.
  3360. If the "maxlines={N}" argument is given, the number of lines that are searched
  3361. for a comment or syncing pattern is restricted to N lines backwards (after
  3362. adding "minlines"). This is useful if you have few things to sync on and a
  3363. slow machine. Example: >
  3364. :syntax sync maxlines=500 ccomment
  3365. <
  3366. *:syn-sync-linebreaks*
  3367. When using a pattern that matches multiple lines, a change in one line may
  3368. cause a pattern to no longer match in a previous line. This means has to
  3369. start above where the change was made. How many lines can be specified with
  3370. the "linebreaks" argument. For example, when a pattern may include one line
  3371. break use this: >
  3372. :syntax sync linebreaks=1
  3373. The result is that redrawing always starts at least one line before where a
  3374. change was made. The default value for "linebreaks" is zero. Usually the
  3375. value for "minlines" is bigger than "linebreaks".
  3376. First syncing method: *:syn-sync-first*
  3377. >
  3378. :syntax sync fromstart
  3379. The file will be parsed from the start. This makes syntax highlighting
  3380. accurate, but can be slow for long files. Vim caches previously parsed text,
  3381. so that it's only slow when parsing the text for the first time. However,
  3382. when making changes some part of the text needs to be parsed again (worst
  3383. case: to the end of the file).
  3384. Using "fromstart" is equivalent to using "minlines" with a very large number.
  3385. Second syncing method: *:syn-sync-second* *:syn-sync-ccomment*
  3386. For the second method, only the "ccomment" argument needs to be given.
  3387. Example: >
  3388. :syntax sync ccomment
  3389. When Vim finds that the line where displaying starts is inside a C-style
  3390. comment, the last region syntax item with the group-name "Comment" will be
  3391. used. This requires that there is a region with the group-name "Comment"!
  3392. An alternate group name can be specified, for example: >
  3393. :syntax sync ccomment javaComment
  3394. This means that the last item specified with "syn region javaComment" will be
  3395. used for the detected C comment region. This only works properly if that
  3396. region does have a start pattern "\/*" and an end pattern "*\/".
  3397. The "maxlines" argument can be used to restrict the search to a number of
  3398. lines. The "minlines" argument can be used to at least start a number of
  3399. lines back (e.g., for when there is some construct that only takes a few
  3400. lines, but it hard to sync on).
  3401. Note: Syncing on a C comment doesn't work properly when strings are used
  3402. that cross a line and contain a "*/". Since letting strings cross a line
  3403. is a bad programming habit (many compilers give a warning message), and the
  3404. chance of a "*/" appearing inside a comment is very small, this restriction
  3405. is hardly ever noticed.
  3406. Third syncing method: *:syn-sync-third*
  3407. For the third method, only the "minlines={N}" argument needs to be given.
  3408. Vim will subtract {N} from the line number and start parsing there. This
  3409. means {N} extra lines need to be parsed, which makes this method a bit slower.
  3410. Example: >
  3411. :syntax sync minlines=50
  3412. "lines" is equivalent to "minlines" (used by older versions).
  3413. Fourth syncing method: *:syn-sync-fourth*
  3414. The idea is to synchronize on the end of a few specific regions, called a
  3415. sync pattern. Only regions can cross lines, so when we find the end of some
  3416. region, we might be able to know in which syntax item we are. The search
  3417. starts in the line just above the one where redrawing starts. From there
  3418. the search continues backwards in the file.
  3419. This works just like the non-syncing syntax items. You can use contained
  3420. matches, nextgroup, etc. But there are a few differences:
  3421. - Keywords cannot be used.
  3422. - The syntax items with the "sync" keyword form a completely separated group
  3423. of syntax items. You can't mix syncing groups and non-syncing groups.
  3424. - The matching works backwards in the buffer (line by line), instead of
  3425. forwards.
  3426. - A line continuation pattern can be given. It is used to decide which group
  3427. of lines need to be searched like they were one line. This means that the
  3428. search for a match with the specified items starts in the first of the
  3429. consecutive that contain the continuation pattern.
  3430. - When using "nextgroup" or "contains", this only works within one line (or
  3431. group of continued lines).
  3432. - When using a region, it must start and end in the same line (or group of
  3433. continued lines). Otherwise the end is assumed to be at the end of the
  3434. line (or group of continued lines).
  3435. - When a match with a sync pattern is found, the rest of the line (or group of
  3436. continued lines) is searched for another match. The last match is used.
  3437. This is used when a line can contain both the start end the end of a region
  3438. (e.g., in a C-comment like /* this */, the last "*/" is used).
  3439. There are two ways how a match with a sync pattern can be used:
  3440. 1. Parsing for highlighting starts where redrawing starts (and where the
  3441. search for the sync pattern started). The syntax group that is expected
  3442. to be valid there must be specified. This works well when the regions
  3443. that cross lines cannot contain other regions.
  3444. 2. Parsing for highlighting continues just after the match. The syntax group
  3445. that is expected to be present just after the match must be specified.
  3446. This can be used when the previous method doesn't work well. It's much
  3447. slower, because more text needs to be parsed.
  3448. Both types of sync patterns can be used at the same time.
  3449. Besides the sync patterns, other matches and regions can be specified, to
  3450. avoid finding unwanted matches.
  3451. [The reason that the sync patterns are given separately, is that mostly the
  3452. search for the sync point can be much simpler than figuring out the
  3453. highlighting. The reduced number of patterns means it will go (much)
  3454. faster.]
  3455. *syn-sync-grouphere* *E393* *E394*
  3456. :syntax sync match {sync-group-name} grouphere {group-name} "pattern" ..
  3457. Define a match that is used for syncing. {group-name} is the
  3458. name of a syntax group that follows just after the match. Parsing
  3459. of the text for highlighting starts just after the match. A region
  3460. must exist for this {group-name}. The first one defined will be used.
  3461. "NONE" can be used for when there is no syntax group after the match.
  3462. *syn-sync-groupthere*
  3463. :syntax sync match {sync-group-name} groupthere {group-name} "pattern" ..
  3464. Like "grouphere", but {group-name} is the name of a syntax group that
  3465. is to be used at the start of the line where searching for the sync
  3466. point started. The text between the match and the start of the sync
  3467. pattern searching is assumed not to change the syntax highlighting.
  3468. For example, in C you could search backwards for "/*" and "*/". If
  3469. "/*" is found first, you know that you are inside a comment, so the
  3470. "groupthere" is "cComment". If "*/" is found first, you know that you
  3471. are not in a comment, so the "groupthere" is "NONE". (in practice
  3472. it's a bit more complicated, because the "/*" and "*/" could appear
  3473. inside a string. That's left as an exercise to the reader...).
  3474. :syntax sync match ..
  3475. :syntax sync region ..
  3476. Without a "groupthere" argument. Define a region or match that is
  3477. skipped while searching for a sync point.
  3478. *syn-sync-linecont*
  3479. :syntax sync linecont {pattern}
  3480. When {pattern} matches in a line, it is considered to continue in
  3481. the next line. This means that the search for a sync point will
  3482. consider the lines to be concatenated.
  3483. If the "maxlines={N}" argument is given too, the number of lines that are
  3484. searched for a match is restricted to N. This is useful if you have very
  3485. few things to sync on and a slow machine. Example: >
  3486. :syntax sync maxlines=100
  3487. You can clear all sync settings with: >
  3488. :syntax sync clear
  3489. You can clear specific sync patterns with: >
  3490. :syntax sync clear {sync-group-name} ..
  3491. ==============================================================================
  3492. 12. Listing syntax items *:syntax* *:sy* *:syn* *:syn-list*
  3493. This command lists all the syntax items: >
  3494. :sy[ntax] [list]
  3495. To show the syntax items for one syntax group: >
  3496. :sy[ntax] list {group-name}
  3497. To list the syntax groups in one cluster: *E392* >
  3498. :sy[ntax] list @{cluster-name}
  3499. See above for other arguments for the ":syntax" command.
  3500. Note that the ":syntax" command can be abbreviated to ":sy", although ":syn"
  3501. is mostly used, because it looks better.
  3502. ==============================================================================
  3503. 12. Highlight command *:highlight* *:hi* *E28* *E411* *E415*
  3504. There are two types of highlight groups:
  3505. - The built-in |highlight-groups|.
  3506. - The ones used for specific languages. For these the name starts with the
  3507. name of the language. Many of these don't have any attributes, but are
  3508. linked to a group of the second type.
  3509. *hitest.vim*
  3510. You can see all the groups currently active with this command: >
  3511. :so $VIMRUNTIME/syntax/hitest.vim
  3512. This will open a new window containing all highlight group names, displayed
  3513. in their own color.
  3514. *:colo* *:colorscheme* *E185*
  3515. :colo[rscheme] Output the name of the currently active color scheme.
  3516. This is basically the same as >
  3517. :echo g:colors_name
  3518. < In case g:colors_name has not been defined :colo will
  3519. output "default". When compiled without the |+eval|
  3520. feature it will output "unknown".
  3521. :colo[rscheme] {name} Load color scheme {name}. This searches 'runtimepath'
  3522. for the file "colors/{name}.vim". The first one that
  3523. is found is loaded.
  3524. Also searches all plugins in 'packpath', first below
  3525. "start" and then under "opt".
  3526. Doesn't work recursively, thus you can't use
  3527. ":colorscheme" in a color scheme script.
  3528. To customize a colorscheme use another name, e.g.
  3529. "~/.vim/colors/mine.vim", and use `:runtime` to load
  3530. the original colorscheme: >
  3531. runtime colors/evening.vim
  3532. hi Statement ctermfg=Blue guifg=Blue
  3533. < Before the color scheme will be loaded the
  3534. |ColorSchemePre| autocommand event is triggered.
  3535. After the color scheme has been loaded the
  3536. |ColorScheme| autocommand event is triggered.
  3537. For info about writing a colorscheme file: >
  3538. :edit $VIMRUNTIME/colors/README.txt
  3539. :hi[ghlight] List all the current highlight groups that have
  3540. attributes set.
  3541. :hi[ghlight] {group-name}
  3542. List one highlight group.
  3543. :hi[ghlight] clear Reset all highlighting to the defaults. Removes all
  3544. highlighting for groups added by the user!
  3545. Uses the current value of 'background' to decide which
  3546. default colors to use.
  3547. :hi[ghlight] clear {group-name}
  3548. :hi[ghlight] {group-name} NONE
  3549. Disable the highlighting for one highlight group. It
  3550. is _not_ set back to the default colors.
  3551. :hi[ghlight] [default] {group-name} {key}={arg} ..
  3552. Add a highlight group, or change the highlighting for
  3553. an existing group.
  3554. See |highlight-args| for the {key}={arg} arguments.
  3555. See |:highlight-default| for the optional [default]
  3556. argument.
  3557. Normally a highlight group is added once when starting up. This sets the
  3558. default values for the highlighting. After that, you can use additional
  3559. highlight commands to change the arguments that you want to set to non-default
  3560. values. The value "NONE" can be used to switch the value off or go back to
  3561. the default value.
  3562. A simple way to change colors is with the |:colorscheme| command. This loads
  3563. a file with ":highlight" commands such as this: >
  3564. :hi Comment gui=bold
  3565. Note that all settings that are not included remain the same, only the
  3566. specified field is used, and settings are merged with previous ones. So, the
  3567. result is like this single command has been used: >
  3568. :hi Comment ctermfg=Cyan guifg=#80a0ff gui=bold
  3569. <
  3570. *:highlight-verbose*
  3571. When listing a highlight group and 'verbose' is non-zero, the listing will
  3572. also tell where it was last set. Example: >
  3573. :verbose hi Comment
  3574. < Comment xxx ctermfg=4 guifg=Blue ~
  3575. Last set from /home/mool/vim/vim7/runtime/syntax/syncolor.vim ~
  3576. When ":hi clear" is used then the script where this command is used will be
  3577. mentioned for the default values. See |:verbose-cmd| for more information.
  3578. *highlight-args* *E416* *E417* *E423*
  3579. There are two types of UIs for highlighting:
  3580. cterm terminal UI (|TUI|)
  3581. gui GUI or RGB-capable TUI ('termguicolors')
  3582. For each type the highlighting can be given. This makes it possible to use
  3583. the same syntax file on all UIs.
  3584. 1. TUI highlight arguments
  3585. *bold* *underline* *undercurl*
  3586. *inverse* *italic* *standout*
  3587. *strikethrough*
  3588. cterm={attr-list} *attr-list* *highlight-cterm* *E418*
  3589. attr-list is a comma separated list (without spaces) of the
  3590. following items (in any order):
  3591. bold
  3592. underline
  3593. undercurl curly underline
  3594. reverse
  3595. inverse same as reverse
  3596. italic
  3597. standout
  3598. strikethrough
  3599. NONE no attributes used (used to reset it)
  3600. Note that "bold" can be used here and by using a bold font. They
  3601. have the same effect.
  3602. "undercurl" falls back to "underline" in a terminal that does not
  3603. support it. The color is set using |highlight-guisp|.
  3604. start={term-list} *highlight-start* *E422*
  3605. stop={term-list} *term-list* *highlight-stop*
  3606. These lists of terminal codes can be used to get
  3607. non-standard attributes on a terminal.
  3608. The escape sequence specified with the "start" argument
  3609. is written before the characters in the highlighted
  3610. area. It can be anything that you want to send to the
  3611. terminal to highlight this area. The escape sequence
  3612. specified with the "stop" argument is written after the
  3613. highlighted area. This should undo the "start" argument.
  3614. Otherwise the screen will look messed up.
  3615. {term-list} is a a string with escape sequences. This is any string of
  3616. characters, except that it can't start with "t_" and blanks are not
  3617. allowed. The <> notation is recognized here, so you can use things
  3618. like "<Esc>" and "<Space>". Example:
  3619. start=<Esc>[27h;<Esc>[<Space>r;
  3620. ctermfg={color-nr} *highlight-ctermfg* *E421*
  3621. ctermbg={color-nr} *highlight-ctermbg*
  3622. The {color-nr} argument is a color number. Its range is zero to
  3623. (not including) the number of |tui-colors| available.
  3624. The actual color with this number depends on the type of terminal
  3625. and its settings. Sometimes the color also depends on the settings of
  3626. "cterm". For example, on some systems "cterm=bold ctermfg=3" gives
  3627. another color, on others you just get color 3.
  3628. The following (case-insensitive) names are recognized:
  3629. *cterm-colors*
  3630. NR-16 NR-8 COLOR NAME ~
  3631. 0 0 Black
  3632. 1 4 DarkBlue
  3633. 2 2 DarkGreen
  3634. 3 6 DarkCyan
  3635. 4 1 DarkRed
  3636. 5 5 DarkMagenta
  3637. 6 3 Brown, DarkYellow
  3638. 7 7 LightGray, LightGrey, Gray, Grey
  3639. 8 0* DarkGray, DarkGrey
  3640. 9 4* Blue, LightBlue
  3641. 10 2* Green, LightGreen
  3642. 11 6* Cyan, LightCyan
  3643. 12 1* Red, LightRed
  3644. 13 5* Magenta, LightMagenta
  3645. 14 3* Yellow, LightYellow
  3646. 15 7* White
  3647. The number under "NR-16" is used for 16-color terminals ('t_Co'
  3648. greater than or equal to 16). The number under "NR-8" is used for
  3649. 8-color terminals ('t_Co' less than 16). The '*' indicates that the
  3650. bold attribute is set for ctermfg. In many 8-color terminals (e.g.,
  3651. "linux"), this causes the bright colors to appear. This doesn't work
  3652. for background colors! Without the '*' the bold attribute is removed.
  3653. If you want to set the bold attribute in a different way, put a
  3654. "cterm=" argument AFTER the "ctermfg=" or "ctermbg=" argument. Or use
  3655. a number instead of a color name.
  3656. Note that for 16 color ansi style terminals (including xterms), the
  3657. numbers in the NR-8 column is used. Here '*' means 'add 8' so that Blue
  3658. is 12, DarkGray is 8 etc.
  3659. Note that for some color terminals these names may result in the wrong
  3660. colors!
  3661. You can also use "NONE" to remove the color.
  3662. *:hi-normal-cterm*
  3663. When setting the "ctermfg" or "ctermbg" colors for the Normal group,
  3664. these will become the colors used for the non-highlighted text.
  3665. Example: >
  3666. :highlight Normal ctermfg=grey ctermbg=darkblue
  3667. < When setting the "ctermbg" color for the Normal group, the
  3668. 'background' option will be adjusted automatically, under the
  3669. condition that the color is recognized and 'background' was not set
  3670. explicitly. This causes the highlight groups that depend on
  3671. 'background' to change! This means you should set the colors for
  3672. Normal first, before setting other colors.
  3673. When a colorscheme is being used, changing 'background' causes it to
  3674. be reloaded, which may reset all colors (including Normal). First
  3675. delete the "g:colors_name" variable when you don't want this.
  3676. When you have set "ctermfg" or "ctermbg" for the Normal group, Vim
  3677. needs to reset the color when exiting. This is done with the
  3678. "orig_pair" |terminfo| entry.
  3679. *E419* *E420*
  3680. When Vim knows the normal foreground and background colors, "fg" and
  3681. "bg" can be used as color names. This only works after setting the
  3682. colors for the Normal group and for the Windows console. Example, for
  3683. reverse video: >
  3684. :highlight Visual ctermfg=bg ctermbg=fg
  3685. < Note that the colors are used that are valid at the moment this
  3686. command are given. If the Normal group colors are changed later, the
  3687. "fg" and "bg" colors will not be adjusted.
  3688. 2. GUI highlight arguments
  3689. gui={attr-list} *highlight-gui*
  3690. These give the attributes to use in the GUI mode.
  3691. See |attr-list| for a description.
  3692. Note that "bold" can be used here and by using a bold font. They
  3693. have the same effect.
  3694. Note that the attributes are ignored for the "Normal" group.
  3695. font={font-name} *highlight-font*
  3696. font-name is the name of a font, as it is used on the system Vim
  3697. runs on. For X11 this is a complicated name, for example: >
  3698. font=-misc-fixed-bold-r-normal--14-130-75-75-c-70-iso8859-1
  3699. <
  3700. The font-name "NONE" can be used to revert to the default font.
  3701. When setting the font for the "Normal" group, this becomes the default
  3702. font (until the 'guifont' option is changed; the last one set is
  3703. used).
  3704. The following only works with Motif not with other GUIs:
  3705. When setting the font for the "Menu" group, the menus will be changed.
  3706. When setting the font for the "Tooltip" group, the tooltips will be
  3707. changed.
  3708. All fonts used, except for Menu and Tooltip, should be of the same
  3709. character size as the default font! Otherwise redrawing problems will
  3710. occur.
  3711. To use a font name with an embedded space or other special character,
  3712. put it in single quotes. The single quote cannot be used then.
  3713. Example: >
  3714. :hi comment font='Monospace 10'
  3715. guifg={color-name} *highlight-guifg*
  3716. guibg={color-name} *highlight-guibg*
  3717. guisp={color-name} *highlight-guisp*
  3718. These give the foreground (guifg), background (guibg) and special
  3719. (guisp) color to use in the GUI. "guisp" is used for undercurl
  3720. and underline.
  3721. There are a few special names:
  3722. NONE no color (transparent)
  3723. bg use normal background color
  3724. background use normal background color
  3725. fg use normal foreground color
  3726. foreground use normal foreground color
  3727. To use a color name with an embedded space or other special character,
  3728. put it in single quotes. The single quote cannot be used then.
  3729. Example: >
  3730. :hi comment guifg='salmon pink'
  3731. <
  3732. *gui-colors*
  3733. Suggested color names (these are available on most systems):
  3734. Red LightRed DarkRed
  3735. Green LightGreen DarkGreen SeaGreen
  3736. Blue LightBlue DarkBlue SlateBlue
  3737. Cyan LightCyan DarkCyan
  3738. Magenta LightMagenta DarkMagenta
  3739. Yellow LightYellow Brown DarkYellow
  3740. Gray LightGray DarkGray
  3741. Black White
  3742. Orange Purple Violet
  3743. You can also specify a color by its RGB (red, green, blue) values.
  3744. The format is "#rrggbb", where
  3745. "rr" is the Red value
  3746. "gg" is the Green value
  3747. "bb" is the Blue value
  3748. All values are hexadecimal, range from "00" to "ff". Examples: >
  3749. :highlight Comment guifg=#11f0c3 guibg=#ff00ff
  3750. <
  3751. blend={integer} *highlight-blend*
  3752. Override the blend level for a highlight group within the popupmenu
  3753. or floating windows. Only takes effect if 'pumblend' or 'winblend'
  3754. is set for the menu or window. See the help at the respective option.
  3755. *highlight-groups* *highlight-default*
  3756. These are the builtin highlighting groups. Note that the highlighting depends
  3757. on the value of 'background'. You can see the current settings with the
  3758. ":highlight" command.
  3759. *hl-ColorColumn*
  3760. ColorColumn used for the columns set with 'colorcolumn'
  3761. *hl-Conceal*
  3762. Conceal placeholder characters substituted for concealed
  3763. text (see 'conceallevel')
  3764. *hl-Cursor*
  3765. Cursor character under the cursor
  3766. *hl-CursorIM*
  3767. CursorIM like Cursor, but used when in IME mode |CursorIM|
  3768. *hl-CursorColumn*
  3769. CursorColumn Screen-column at the cursor, when 'cursorcolumn' is set.
  3770. *hl-CursorLine*
  3771. CursorLine Screen-line at the cursor, when 'cursorline' is set.
  3772. Low-priority if foreground (ctermfg OR guifg) is not set.
  3773. *hl-Directory*
  3774. Directory directory names (and other special names in listings)
  3775. *hl-DiffAdd*
  3776. DiffAdd diff mode: Added line |diff.txt|
  3777. *hl-DiffChange*
  3778. DiffChange diff mode: Changed line |diff.txt|
  3779. *hl-DiffDelete*
  3780. DiffDelete diff mode: Deleted line |diff.txt|
  3781. *hl-DiffText*
  3782. DiffText diff mode: Changed text within a changed line |diff.txt|
  3783. *hl-EndOfBuffer*
  3784. EndOfBuffer filler lines (~) after the end of the buffer.
  3785. By default, this is highlighted like |hl-NonText|.
  3786. *hl-TermCursor*
  3787. TermCursor cursor in a focused terminal
  3788. *hl-TermCursorNC*
  3789. TermCursorNC cursor in an unfocused terminal
  3790. *hl-ErrorMsg*
  3791. ErrorMsg error messages on the command line
  3792. *hl-VertSplit*
  3793. VertSplit the column separating vertically split windows
  3794. *hl-Folded*
  3795. Folded line used for closed folds
  3796. *hl-FoldColumn*
  3797. FoldColumn 'foldcolumn'
  3798. *hl-SignColumn*
  3799. SignColumn column where |signs| are displayed
  3800. *hl-IncSearch*
  3801. IncSearch 'incsearch' highlighting; also used for the text replaced with
  3802. ":s///c"
  3803. *hl-Substitute*
  3804. Substitute |:substitute| replacement text highlighting
  3805. *hl-LineNr*
  3806. LineNr Line number for ":number" and ":#" commands, and when 'number'
  3807. or 'relativenumber' option is set.
  3808. *hl-CursorLineNr*
  3809. CursorLineNr Like LineNr when 'cursorline' or 'relativenumber' is set for
  3810. the cursor line.
  3811. *hl-MatchParen*
  3812. MatchParen The character under the cursor or just before it, if it
  3813. is a paired bracket, and its match. |pi_paren.txt|
  3814. *hl-ModeMsg*
  3815. ModeMsg 'showmode' message (e.g., "-- INSERT --")
  3816. *hl-MsgArea*
  3817. MsgArea Area for messages and cmdline
  3818. *hl-MsgSeparator*
  3819. MsgSeparator Separator for scrolled messages, `msgsep` flag of 'display'
  3820. *hl-MoreMsg*
  3821. MoreMsg |more-prompt|
  3822. *hl-NonText*
  3823. NonText '@' at the end of the window, characters from 'showbreak'
  3824. and other characters that do not really exist in the text
  3825. (e.g., ">" displayed when a double-wide character doesn't
  3826. fit at the end of the line). See also |hl-EndOfBuffer|.
  3827. *hl-Normal*
  3828. Normal normal text
  3829. *hl-NormalFloat*
  3830. NormalFloat Normal text in floating windows.
  3831. *hl-NormalNC*
  3832. NormalNC normal text in non-current windows
  3833. *hl-Pmenu*
  3834. Pmenu Popup menu: normal item.
  3835. *hl-PmenuSel*
  3836. PmenuSel Popup menu: selected item.
  3837. *hl-PmenuSbar*
  3838. PmenuSbar Popup menu: scrollbar.
  3839. *hl-PmenuThumb*
  3840. PmenuThumb Popup menu: Thumb of the scrollbar.
  3841. *hl-Question*
  3842. Question |hit-enter| prompt and yes/no questions
  3843. *hl-QuickFixLine*
  3844. QuickFixLine Current |quickfix| item in the quickfix window. Combined with
  3845. |hl-CursorLine| when the cursor is there.
  3846. *hl-Search*
  3847. Search Last search pattern highlighting (see 'hlsearch').
  3848. Also used for similar items that need to stand out.
  3849. *hl-SpecialKey*
  3850. SpecialKey Unprintable characters: text displayed differently from what
  3851. it really is. But not 'listchars' whitespace. |hl-Whitespace|
  3852. *hl-SpellBad*
  3853. SpellBad Word that is not recognized by the spellchecker. |spell|
  3854. Combined with the highlighting used otherwise.
  3855. *hl-SpellCap*
  3856. SpellCap Word that should start with a capital. |spell|
  3857. Combined with the highlighting used otherwise.
  3858. *hl-SpellLocal*
  3859. SpellLocal Word that is recognized by the spellchecker as one that is
  3860. used in another region. |spell|
  3861. Combined with the highlighting used otherwise.
  3862. *hl-SpellRare*
  3863. SpellRare Word that is recognized by the spellchecker as one that is
  3864. hardly ever used. |spell|
  3865. Combined with the highlighting used otherwise.
  3866. *hl-StatusLine*
  3867. StatusLine status line of current window
  3868. *hl-StatusLineNC*
  3869. StatusLineNC status lines of not-current windows
  3870. Note: if this is equal to "StatusLine" Vim will use "^^^" in
  3871. the status line of the current window.
  3872. *hl-TabLine*
  3873. TabLine tab pages line, not active tab page label
  3874. *hl-TabLineFill*
  3875. TabLineFill tab pages line, where there are no labels
  3876. *hl-TabLineSel*
  3877. TabLineSel tab pages line, active tab page label
  3878. *hl-Title*
  3879. Title titles for output from ":set all", ":autocmd" etc.
  3880. *hl-Visual*
  3881. Visual Visual mode selection
  3882. *hl-VisualNOS*
  3883. VisualNOS Visual mode selection when vim is "Not Owning the Selection".
  3884. *hl-WarningMsg*
  3885. WarningMsg warning messages
  3886. *hl-Whitespace*
  3887. Whitespace "nbsp", "space", "tab" and "trail" in 'listchars'
  3888. *hl-WildMenu*
  3889. WildMenu current match in 'wildmenu' completion
  3890. *hl-User1* *hl-User1..9* *hl-User9*
  3891. The 'statusline' syntax allows the use of 9 different highlights in the
  3892. statusline and ruler (via 'rulerformat'). The names are User1 to User9.
  3893. For the GUI you can use the following groups to set the colors for the menu,
  3894. scrollbars and tooltips. They don't have defaults. This doesn't work for the
  3895. Win32 GUI. Only three highlight arguments have any effect here: font, guibg,
  3896. and guifg.
  3897. *hl-Menu*
  3898. Menu Current font, background and foreground colors of the menus.
  3899. Also used for the toolbar.
  3900. Applicable highlight arguments: font, guibg, guifg.
  3901. *hl-Scrollbar*
  3902. Scrollbar Current background and foreground of the main window's
  3903. scrollbars.
  3904. Applicable highlight arguments: guibg, guifg.
  3905. *hl-Tooltip*
  3906. Tooltip Current font, background and foreground of the tooltips.
  3907. Applicable highlight arguments: font, guibg, guifg.
  3908. ==============================================================================
  3909. 13. Linking groups *:hi-link* *:highlight-link* *E412* *E413*
  3910. When you want to use the same highlighting for several syntax groups, you
  3911. can do this more easily by linking the groups into one common highlight
  3912. group, and give the color attributes only for that group.
  3913. To set a link:
  3914. :hi[ghlight][!] [default] link {from-group} {to-group}
  3915. To remove a link:
  3916. :hi[ghlight][!] [default] link {from-group} NONE
  3917. Notes: *E414*
  3918. - If the {from-group} and/or {to-group} doesn't exist, it is created. You
  3919. don't get an error message for a non-existing group.
  3920. - As soon as you use a ":highlight" command for a linked group, the link is
  3921. removed.
  3922. - If there are already highlight settings for the {from-group}, the link is
  3923. not made, unless the '!' is given. For a ":highlight link" command in a
  3924. sourced file, you don't get an error message. This can be used to skip
  3925. links for groups that already have settings.
  3926. *:hi-default* *:highlight-default*
  3927. The [default] argument is used for setting the default highlighting for a
  3928. group. If highlighting has already been specified for the group the command
  3929. will be ignored. Also when there is an existing link.
  3930. Using [default] is especially useful to overrule the highlighting of a
  3931. specific syntax file. For example, the C syntax file contains: >
  3932. :highlight default link cComment Comment
  3933. If you like Question highlighting for C comments, put this in your vimrc file: >
  3934. :highlight link cComment Question
  3935. Without the "default" in the C syntax file, the highlighting would be
  3936. overruled when the syntax file is loaded.
  3937. ==============================================================================
  3938. 15. Cleaning up *:syn-clear* *E391*
  3939. If you want to clear the syntax stuff for the current buffer, you can use this
  3940. command: >
  3941. :syntax clear
  3942. This command should be used when you want to switch off syntax highlighting,
  3943. or when you want to switch to using another syntax. It's normally not needed
  3944. in a syntax file itself, because syntax is cleared by the autocommands that
  3945. load the syntax file.
  3946. The command also deletes the "b:current_syntax" variable, since no syntax is
  3947. loaded after this command.
  3948. To clean up specific syntax groups for the current buffer: >
  3949. :syntax clear {group-name} ..
  3950. This removes all patterns and keywords for {group-name}.
  3951. To clean up specific syntax group lists for the current buffer: >
  3952. :syntax clear @{grouplist-name} ..
  3953. This sets {grouplist-name}'s contents to an empty list.
  3954. *:syntax-off* *:syn-off*
  3955. If you want to disable syntax highlighting for all buffers, you need to remove
  3956. the autocommands that load the syntax files: >
  3957. :syntax off
  3958. What this command actually does, is executing the command >
  3959. :source $VIMRUNTIME/syntax/nosyntax.vim
  3960. See the "nosyntax.vim" file for details. Note that for this to work
  3961. $VIMRUNTIME must be valid. See |$VIMRUNTIME|.
  3962. *:syntax-reset* *:syn-reset*
  3963. If you have changed the colors and messed them up, use this command to get the
  3964. defaults back: >
  3965. :syntax reset
  3966. It is a bit of a wrong name, since it does not reset any syntax items, it only
  3967. affects the highlighting.
  3968. Note that the syntax colors that you set in your vimrc file will also be reset
  3969. back to their Vim default.
  3970. Note that if you are using a color scheme, the colors defined by the color
  3971. scheme for syntax highlighting will be lost.
  3972. What this actually does is: >
  3973. let g:syntax_cmd = "reset"
  3974. runtime! syntax/syncolor.vim
  3975. Note that this uses the 'runtimepath' option.
  3976. *syncolor*
  3977. If you want to use different colors for syntax highlighting, you can add a Vim
  3978. script file to set these colors. Put this file in a directory in
  3979. 'runtimepath' which comes after $VIMRUNTIME, so that your settings overrule
  3980. the default colors. This way these colors will be used after the ":syntax
  3981. reset" command.
  3982. For Unix you can use the file ~/.config/nvim/after/syntax/syncolor.vim.
  3983. Example: >
  3984. if &background == "light"
  3985. highlight comment ctermfg=darkgreen guifg=darkgreen
  3986. else
  3987. highlight comment ctermfg=green guifg=green
  3988. endif
  3989. *E679*
  3990. Do make sure this syncolor.vim script does not use a "syntax on", set the
  3991. 'background' option or uses a "colorscheme" command, because it results in an
  3992. endless loop.
  3993. Note that when a color scheme is used, there might be some confusion whether
  3994. your defined colors are to be used or the colors from the scheme. This
  3995. depends on the color scheme file. See |:colorscheme|.
  3996. *syntax_cmd*
  3997. The "syntax_cmd" variable is set to one of these values when the
  3998. syntax/syncolor.vim files are loaded:
  3999. "on" ":syntax on" command. Highlight colors are overruled but
  4000. links are kept
  4001. "enable" ":syntax enable" command. Only define colors for groups that
  4002. don't have highlighting yet. Use ":syntax default".
  4003. "reset" ":syntax reset" command or loading a color scheme. Define all
  4004. the colors.
  4005. "skip" Don't define colors. Used to skip the default settings when a
  4006. syncolor.vim file earlier in 'runtimepath' has already set
  4007. them.
  4008. ==============================================================================
  4009. 16. Highlighting tags *tag-highlight*
  4010. If you want to highlight all the tags in your file, you can use the following
  4011. mappings.
  4012. <F11> -- Generate tags.vim file, and highlight tags.
  4013. <F12> -- Just highlight tags based on existing tags.vim file.
  4014. >
  4015. :map <F11> :sp tags<CR>:%s/^\([^ :]*:\)\=\([^ ]*\).*/syntax keyword Tag \2/<CR>:wq! tags.vim<CR>/^<CR><F12>
  4016. :map <F12> :so tags.vim<CR>
  4017. WARNING: The longer the tags file, the slower this will be, and the more
  4018. memory Vim will consume.
  4019. Only highlighting typedefs, unions and structs can be done too. For this you
  4020. must use Exuberant ctags (found at http://ctags.sf.net).
  4021. Put these lines in your Makefile:
  4022. # Make a highlight file for types. Requires Exuberant ctags and awk
  4023. types: types.vim
  4024. types.vim: *.[ch]
  4025. ctags --c-kinds=gstu -o- *.[ch] |\
  4026. awk 'BEGIN{printf("syntax keyword Type\t")}\
  4027. {printf("%s ", $$1)}END{print ""}' > $@
  4028. And put these lines in your vimrc: >
  4029. " load the types.vim highlighting file, if it exists
  4030. autocmd BufRead,BufNewFile *.[ch] let fname = expand('<afile>:p:h') . '/types.vim'
  4031. autocmd BufRead,BufNewFile *.[ch] if filereadable(fname)
  4032. autocmd BufRead,BufNewFile *.[ch] exe 'so ' . fname
  4033. autocmd BufRead,BufNewFile *.[ch] endif
  4034. ==============================================================================
  4035. 17. Window-local syntax *:ownsyntax*
  4036. Normally all windows on a buffer share the same syntax settings. It is
  4037. possible, however, to set a particular window on a file to have its own
  4038. private syntax setting. A possible example would be to edit LaTeX source
  4039. with conventional highlighting in one window, while seeing the same source
  4040. highlighted differently (so as to hide control sequences and indicate bold,
  4041. italic etc regions) in another. The 'scrollbind' option is useful here.
  4042. To set the current window to have the syntax "foo", separately from all other
  4043. windows on the buffer: >
  4044. :ownsyntax foo
  4045. < *w:current_syntax*
  4046. This will set the "w:current_syntax" variable to "foo". The value of
  4047. "b:current_syntax" does not change. This is implemented by saving and
  4048. restoring "b:current_syntax", since the syntax files do set
  4049. "b:current_syntax". The value set by the syntax file is assigned to
  4050. "w:current_syntax".
  4051. Note: This resets the 'spell', 'spellcapcheck' and 'spellfile' options.
  4052. Once a window has its own syntax, syntax commands executed from other windows
  4053. on the same buffer (including :syntax clear) have no effect. Conversely,
  4054. syntax commands executed from that window do not affect other windows on the
  4055. same buffer.
  4056. A window with its own syntax reverts to normal behavior when another buffer
  4057. is loaded into that window or the file is reloaded.
  4058. When splitting the window, the new window will use the original syntax.
  4059. ==============================================================================
  4060. 17. Color xterms *xterm-color* *color-xterm*
  4061. *colortest.vim*
  4062. To test your color setup, a file has been included in the Vim distribution.
  4063. To use it, execute this command: >
  4064. :runtime syntax/colortest.vim
  4065. Nvim uses 256-color and |true-color| terminal capabilities whereever possible.
  4066. ==============================================================================
  4067. 18. When syntax is slow *:syntime*
  4068. This is aimed at authors of a syntax file.
  4069. If your syntax causes redrawing to be slow, here are a few hints on making it
  4070. faster. To see slowness switch on some features that usually interfere, such
  4071. as 'relativenumber' and |folding|.
  4072. Note: this is only available when compiled with the |+profile| feature.
  4073. You many need to build Vim with "huge" features.
  4074. To find out what patterns are consuming most time, get an overview with this
  4075. sequence: >
  4076. :syntime on
  4077. [ redraw the text at least once with CTRL-L ]
  4078. :syntime report
  4079. This will display a list of syntax patterns that were used, sorted by the time
  4080. it took to match them against the text.
  4081. :syntime on Start measuring syntax times. This will add some
  4082. overhead to compute the time spent on syntax pattern
  4083. matching.
  4084. :syntime off Stop measuring syntax times.
  4085. :syntime clear Set all the counters to zero, restart measuring.
  4086. :syntime report Show the syntax items used since ":syntime on" in the
  4087. current window. Use a wider display to see more of
  4088. the output.
  4089. The list is sorted by total time. The columns are:
  4090. TOTAL Total time in seconds spent on
  4091. matching this pattern.
  4092. COUNT Number of times the pattern was used.
  4093. MATCH Number of times the pattern actually
  4094. matched
  4095. SLOWEST The longest time for one try.
  4096. AVERAGE The average time for one try.
  4097. NAME Name of the syntax item. Note that
  4098. this is not unique.
  4099. PATTERN The pattern being used.
  4100. Pattern matching gets slow when it has to try many alternatives. Try to
  4101. include as much literal text as possible to reduce the number of ways a
  4102. pattern does NOT match.
  4103. When using the "\@<=" and "\@<!" items, add a maximum size to avoid trying at
  4104. all positions in the current and previous line. For example, if the item is
  4105. literal text specify the size of that text (in bytes):
  4106. "<\@<=span" Matches "span" in "<span". This tries matching with "<" in
  4107. many places.
  4108. "<\@1<=span" Matches the same, but only tries one byte before "span".
  4109. vim:tw=78:sw=4:ts=8:noet:ft=help:norl: