Browse Source

rudimentary support for syntax highlighting in vim

tags/v2019.9.0
adam j hartz 4 months ago
parent
commit
1a2e1978e7
4 changed files with 31 additions and 1 deletions
  1. +4
    -1
      CHANGELOG
  2. +1
    -0
      MANIFEST.in
  3. +1
    -0
      vim/plugin/catsoop.vim
  4. +25
    -0
      vim/syntax/catsoop.vim

+ 4
- 1
CHANGELOG View File

@@ -9,6 +9,9 @@ ADDED:
* Added `.catsoop` as a content file extension, parsed using the same parser
as content files with the `.md` extension.

* Added rudimentary support for syntax highlighting of `.catsoop` files in
Vim.

* Added `cs_ui_config_flags`, including option to automatically view
explanations when viewing answers, and to highlight the 'view explanation'
button.
@@ -89,7 +92,7 @@ FIXED:
be marked as 'running' if they experienced an error during page load or
when looking up the question to submit.

* Fixed the lack of decompression of uploaded files when downloaded via the
* Fixed the lack of decompression of uploaded files when downloaded via the
'Download Most Recent Submission' link.

SECURITY:

+ 1
- 0
MANIFEST.in View File

@@ -3,6 +3,7 @@ recursive-include catsoop/__HANDLERS__ *
recursive-include catsoop/__QTYPES__ *
recursive-include catsoop/__STATIC__ *
recursive-include catsoop/__UTIL__ *
recursive-include vim *
include README
include LICENSE
include requirements.txt

+ 1
- 0
vim/plugin/catsoop.vim View File

@@ -0,0 +1 @@
au BufRead *.catsoop setf catsoop

+ 25
- 0
vim/syntax/catsoop.vim View File

@@ -0,0 +1,25 @@
" syntax highlighting for catsoop files
" based on https://stackoverflow.com/questions/5176972/trouble-using-vims-syn-include-and-syn-region-to-embed-syntax-highlighting

let b:current_syntax=''
unlet b:current_syntax
runtime! syntax/markdown.vim

let b:current_syntax=''
unlet b:current_syntax
syntax include @Markdown syntax/markdown.vim

let b:current_syntax=''
unlet b:current_syntax
syntax include @Python syntax/python.vim
syntax region pythonCode matchgroup=pythonTag start="<python>" end="</python>" containedin=@Markdown contains=@Python
syntax region pythonCodeQuestion matchgroup=questionTag start="<question [^>]*>" end="</question>" containedin=@Markdown contains=@Python

let b:current_syntax=''
unlet b:current_syntax
syntax include @TeX syntax/tex.vim
syntax region latexDisplayMath start="\$\$" end="\$\$" keepend containedin=@Markdown contains=@TeX

hi link pythonTag htmlTag
hi link questionTag htmlTag
let b:current_syntax = 'catsoop'

Loading…
Cancel
Save