기존 파일 형식의 파일 형식 구문과 강조 표시를 확장하고 싶습니다. 다음과 같이 나의 새로운 파일 구문의 기본 구조는 다음과 같습니다vim 파일 구문을 다른 파일 형식으로 확장하지 않음
" Some local (new) syntax that I want to match
syn match upfOperator "[&|~><!)(*#%@+/=?:;}{,.\^\-\[\]]"
syn match upfDefines "\$\S\+"
syn match upfDefines "\${\S\+}"
syn match upfParens "[)(}{\[\]]"
" load syntax that I want to extend. This contains it's own highlight commands
runtime syntax/dtcl.vim
" New highlight statements
hi link upfOperator Statement
hi link upfDefines Constant
hi link upfParens Constant
문제는 dtcl.vim 파일에 포함 된 모든 구문 강조되지 않는 것입니다. 나는 dctl 파일을 열 수 있으며 강조 표시가 작동합니다. 그러나 다른 파일 형식 (* .upf)을 열면 upf.vim이로드되지만 dtcl.vim은로드되지 않습니다.
dctl.vim에는 파일을로드하지 못하게하는 "if syntax defined"유형 명령이 없습니다.