syntax.txt 210 KB

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