我有以下Vim的語法文件:Vim的語法:比賽僅在該區域的開始 - 而不是後續各個
" Vim syntax file
" Language: ScreenplayText - the textual source of ScreenplayXML
" Maintainer: Shlomi Fish <[email protected]>
" Home: http://search.cpan.org/dist/XML-Grammar-Screenplay/
"
" Author: Shlomi Fish
" Filenames: *.screenplay-text.txt
" Last Change: Thu Jul 3 00:59:42 IDT 2008
" Version: 0.0.1
" Thanks to Andy Wokula for his help on:
" https://groups.google.com/group/vim_use/browse_thread/thread/6c0906617d67864e/a21938c5df1d15cb?show_docid=a21938c5df1d15cb
" Quit if syntax file is already loaded
if version < 600
syntax clear
elseif exists("b:current_syntax")
finish
endif
syntax sync minlines=50
" syntax match screenplayTextComment /<!--\_.\{-0,}-->/
" syntax match screenplayTextDescription /^ *\[\_.\{-0,}\]/
syntax region screenplayTextComment start="<!--" end="-->"
syntax region screenplayTextDescription start="^ *\[" end="]"
" syntax region screenplayTextSaying start=/\(^\s*\n\)\@<=\_^\(+\{2,\}\|[^[:+]*\):/ end=/^\s*$/ contains=screenplayTextAddress,screenplayTextInnerDesc
syntax region screenplayTextSaying start=/\(^\s*\n\)\@<=\_^\(+\{2,\}\|[^[:+]*\):/ end=/^\s*$/ contains=screenplayTextAddress
" syntax match screenplayTextAddress /\%^\(+\{2,\}\|[^[:+]*\):/ contained nextgroup=screenplayTextInnerDesc
syntax match screenplayTextAddress /[^:]\+:/ contained nextgroup=screenplayTextSayingAfterAddress
syntax region screenplayTextSayingAfterAddress contained
" syntax match screenplayTextInnerDesc /\[\_.\{-0,}\]/ contained nextgroup=screenplayTextInnerDesc
" For debugging - remove.
" hi def link screenplayTextSaying Statement
hi def link screenplayTextComment Comment
hi def link screenplayTextDescription PreProc
hi def link screenplayTextInnerDesc PreProc
hi def screenplayTextAddress term=bold cterm=bold gui=bold
其目的是爲XML-Grammar-Screenplay,但screenplayTextAddress仍然突出的東西,在後續行以「: 「,如:
Kate: Of course! See, my obsession with the Bible continued throughout my
life, and later on I became a scholar: first as a married woman who just
hanged around universities and learned things from the male professors
and students, later on as someone who helped some professors with their
research and eventually got credited, and as time progressed,
I got a B.A., and then a Ph.D., and am now a professor.
帶」:「冒號的第二行仍然被突出顯示。我如何防止突出顯示?
感謝您的任何見解。
問候,
- 施洛米魚
P.S:這裏是the repository for the vim-screenplay-text highlighting(上一到位桶水銀之一),這裏是the screenplay I use to test it(在GitHub上的Git倉庫)。
謝謝!我用Freenode的#vim上的一些人的幫助來實現我所需要的變體。我應該注意matchgroup = ...必須在開始和結束之前出現。下次,請測試您的代碼。 – 2013-02-20 13:25:35
我明確地將'matchgroup ='_after_' end ='放在''start ='後面,我測試了這個。下一次,請仔細閱讀文檔;-) – 2013-02-20 13:35:02