diff --git a/README.mkd b/README.mkd index 919c3a3..5c2d8bb 100644 --- a/README.mkd +++ b/README.mkd @@ -1,8 +1,20 @@ # vim-cpp -This is Vim syntax files with C++11 support. `c.vim` is based on Bram Moolenaar +This is Vim syntax files with C++11 support. They are forked from vim-jp/vim-cpp +and have support fo syntax highlighting of embeded ChaiScript. + +To enable syntax highlighting wrap your embedded script in raw string literals as such: + +```cpp +std::string = R"chaiscript( + // some script +)chaiscript"; +``` + +`c.vim` is based on Bram Moolenaar and `cpp.vim` is based on Ken Shan . + ## License License of original files conform to author of them. Enhancement of changes diff --git a/syntax/cpp.vim b/syntax/cpp.vim index aa66cef..b85148f 100644 --- a/syntax/cpp.vim +++ b/syntax/cpp.vim @@ -84,6 +84,37 @@ if version >= 508 || !exists("did_cpp_syntax_inits") delcommand HiLink endif + +function! RawStringEnableCodeSnip(filetype,start,end,textSnipHl) abort + let ft=toupper(a:filetype) + let group='textGroup'.ft + if exists('b:current_syntax') + let s:current_syntax=b:current_syntax + " Remove current syntax definition, as some syntax files (e.g. cpp.vim) + " do nothing if b:current_syntax is defined. + unlet b:current_syntax + endif + execute 'syntax include @'.group.' syntax/'.a:filetype.'.vim' + try + execute 'syntax include @'.group.' after/syntax/'.a:filetype.'.vim' + catch + endtry + if exists('s:current_syntax') + let b:current_syntax=s:current_syntax + else + unlet b:current_syntax + endif + execute 'syntax region textSnip'.ft.' + \ matchgroup='.a:textSnipHl.' + \ start=+'.a:start.'+ end=+'.a:end.'+ + \ contains=@'.group +endfunction + + +call RawStringEnableCodeSnip("chaiscript", 'R"chaiscript(', ')chaiscript"', 'cppRawString') + + + let b:current_syntax = "cpp" " vim: ts=8 pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy