Yegappan Lakshmanan | a54816b | 2024-11-03 10:49:23 +0100 | [diff] [blame] | 1 | if exists("b:current_syntax") |
| 2 | finish |
| 3 | endif |
| 4 | |
| 5 | syn include @VIM syntax/vim.vim |
| 6 | unlet b:current_syntax |
| 7 | syn include @TUTORSHELL syntax/sh.vim |
| 8 | unlet b:current_syntax |
| 9 | syn include @VIMNORMAL syntax/vimnormal.vim |
| 10 | |
| 11 | syn match tutorLink /\[.\{-}\](.\{-})/ contains=tutorInlineNormal |
| 12 | syn match tutorLinkBands /\[\|\]\|(\|)/ contained containedin=tutorLink,tutorLinkAnchor conceal |
| 13 | syn match tutorLinkAnchor /(.\{-})/ contained containedin=tutorLink conceal |
| 14 | syn match tutorURL /\(https\?\|file\):\/\/[[:graph:]]\+\>\/\?/ |
| 15 | syn match tutorEmail /\<[[:graph:]]\+@[[:graph:]]\+\>/ |
| 16 | syn match tutorInternalAnchor /\*[[:alnum:]-]\+\*/ contained conceal containedin=tutorSection |
| 17 | |
| 18 | syn match tutorSection /^#\{1,6}\s.\+$/ fold contains=tutorInlineNormal |
| 19 | syn match tutorSectionBullet /#/ contained containedin=tutorSection |
| 20 | |
| 21 | syn match tutorTOC /\ctable of contents:/ |
| 22 | |
| 23 | syn match tutorConcealedEscapes /\\[`*!\[\]():$-]\@=/ conceal |
| 24 | |
| 25 | syn region tutorEmphasis matchgroup=Delimiter start=/[\*]\@<!\*\*\@!/ end=/[\*]\@<!\*\*\@!/ |
| 26 | \ concealends contains=tutorInlineCommand,tutorInlineNormal |
| 27 | syn region tutorBold matchgroup=Delimiter start=/\*\{2}/ end=/\*\{2}/ |
| 28 | \ concealends contains=tutorInlineCommand,tutorInlineNormal |
| 29 | |
| 30 | syn keyword tutorMarks TODO NOTE IMPORTANT TIP ATTENTION EXERCISE |
| 31 | syn keyword tutorMarks todo note tip attention exercise |
| 32 | syn keyword tutorMarks Todo Note Tip Excersise |
| 33 | |
| 34 | syn region tutorCodeblock matchgroup=Delimiter start=/^\~\{3}.*$/ end=/^\~\{3}/ |
| 35 | |
| 36 | syn region tutorShell matchgroup=Delimiter start=/^\~\{3} sh\s*$/ end=/^\~\{3}/ keepend contains=@TUTORSHELL concealends |
| 37 | syn match tutorShellPrompt /\(^\s*\)\@<=[$#]/ contained containedin=tutorShell |
| 38 | |
| 39 | syn region tutorInlineCode matchgroup=Delimiter start=/\\\@<!`/ end=/\\\@<!\(`{\@!\|`\s\)/ concealends |
| 40 | |
| 41 | syn region tutorCommand matchgroup=Delimiter start=/^\~\{3} cmd\( :\)\?\s*$/ end=/^\~\{3}/ keepend contains=@VIM concealends |
| 42 | syn region tutorInlineCommand matchgroup=Delimiter start=/\\\@<!`\(.*`{vim}\)\@=/ end=/\\\@<!`\({vim}\)\@=/ nextgroup=tutorInlineType contains=@VIM concealends keepend |
| 43 | |
| 44 | syn region tutorNormal matchgroup=Delimiter start=/^\~\{3} norm\(al\?\)\?\s*$/ end=/^\~\{3}/ contains=@VIMNORMAL concealends |
| 45 | syn region tutorInlineNormal matchgroup=Delimiter start=/\\\@<!`\(\S*`{normal}\)\@=/ end=/\\\@<!`\({normal}\)\@=/ nextgroup=tutorInlineType contains=@VIMNORMAL concealends keepend |
| 46 | |
| 47 | syn match tutorInlineType /{\(normal\|vim\)}/ contained conceal |
| 48 | |
| 49 | syn match tutorInlineOK /✓/ |
| 50 | syn match tutorInlineX /✗/ |
| 51 | |
| 52 | hi def tutorLink cterm=underline gui=underline ctermfg=lightblue guifg=#0088ff |
| 53 | hi def link tutorLinkBands Delimiter |
| 54 | hi def link tutorLinkAnchor Underlined |
| 55 | hi def link tutorInternalAnchor Underlined |
| 56 | hi def link tutorURL tutorLink |
| 57 | hi def link tutorEmail tutorLink |
| 58 | |
| 59 | hi def link tutorSection Title |
| 60 | hi def link tutorSectionBullet Delimiter |
| 61 | |
| 62 | hi def link tutorTOC Directory |
| 63 | |
| 64 | hi def tutorMarks cterm=bold gui=bold |
| 65 | |
| 66 | hi def tutorEmphasis gui=italic cterm=italic |
| 67 | hi def tutorBold gui=bold cterm=bold |
| 68 | |
| 69 | hi def link tutorExpect Special |
| 70 | hi def tutorOK ctermfg=green guifg=#00ff88 cterm=bold gui=bold |
| 71 | hi def tutorX ctermfg=red guifg=#ff2000 cterm=bold gui=bold |
| 72 | hi def link tutorInlineOK tutorOK |
| 73 | hi def link tutorInlineX tutorX |
| 74 | |
| 75 | hi def link tutorShellPrompt Delimiter |
| 76 | |
| 77 | let b:current_syntax = "tutor" |