tutor.vim 3.0 KB

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