" Vim syntax file " Language: Portable Game Notation (*.pgn) " Maintainer: Ryan Sarson " Last Change: 2016-09-13 " Original Author: Charles Ford " http://www.vim.org/scripts/script.php?script_id=677 " References: Portable Game Notation " https://en.wikipedia.org/wiki/Portable_Game_Notation " FIDE Laws of Chess Appendix C. Algebraic notation " https://www.fide.com/fide/handbook.html?id=171&view=article " ***************** " *** Tag pairs *** " ***************** syntax region pgnTagName start=/\[/ end=/\]/ contains=pgnTagValue syntax region pgnTagValue start=/"/ skip=/\\"/ end=/"/ contained " **************** " *** Movetext *** " **************** " move number syntax match pgnMoveNumber /[0-9]*\./ " piece, promotion piece syntax match pgnPiece /[KQRBN]/ " file and/or rank of departure syntax match pgnDeparture /\([a-h]\|[1-8]\|[a-h][1-8]\)\zex\?[a-h][1-8]\([!?+#=]\+\|\(ep\|e\.p\.\)\|\s\|$\)/ " square of arrival syntax match pgnArrival /[a-h][1-8]\ze\([!?+#=]\+\|\(ep\|e\.p\.\)\|\s\|$\)/ " draw offer, castling, optional abbreviations, promotion, null move syntax match pgnAbbreviation /(=)\|[-Ox+#=]\|\(ep\|e\.p\.\)/ " variations (excludes draw offer; thanks to 'lopid' at #vim) syntax region pgnVariation start=/\((=)\)\@!(\_.\{-}/ end=/)/ contains=pgnVariation " annotation glyphs (from scid) syntax match pgnMoveEvaluation /[!?]\|\(^\|\s\)\zsN\ze\(\s\|$\)/ syntax match pgnPositionEvaluation /\(^\|\s\)\zs\(\~\|+--\|+-\|+\/-\|+=\|=\|=+\|-\/+\|-+\|--+\)\ze\(\s\|$\)/ syntax match pgnDiagram /\(^\|\s\)\zsD\ze\(\s\|$\)/ " result syntax match pgnResult /1-0\|0-1\|1\/2-1\/2\|\*/ " **************** " *** Comments *** " **************** syntax region pgnCommentBlock start=/{/ end=/}/ syntax region pgnCommentSingleLine start=/;/ end=/$/ highlight link pgnTagName Title highlight link pgnTagValue Comment highlight link pgnMoveNumber LineNr highlight link pgnPiece ModeMsg highlight link pgnDeparture VisualNOS highlight link pgnArrival Normal highlight link pgnAbbreviation Identifier "highlight pgnVariation term=italic cterm=italic gui=italic highlight link pgnVariation NonText highlight link pgnMoveEvaluation Constant highlight link pgnPositionEvaluation Special highlight link pgnResult Special highlight link pgnCommentBlock Type highlight link pgnCommentSingleLine Type highlight link pgnDiagram Error