mirror of
https://github.com/cp2k/cp2k.git
synced 2026-07-27 13:45:19 -04:00
Update vim syntax file generation
- Recognize XCTYPE macro keyword - Indent macro kewords like sections, keywords, and comments - Indent body of @IF/@ENDIF block like &SECTION/&END
This commit is contained in:
parent
47e8414d44
commit
472c987a54
1 changed files with 6 additions and 13 deletions
|
|
@ -75,6 +75,7 @@ syn keyword cp2kConstant <xsl:value-of select="NAME"/>
|
|||
syn keyword cp2kSection <xsl:value-of select="NAME"/>
|
||||
</xsl:for-each-group>
|
||||
syn keyword cp2kSection END
|
||||
syn keyword cp2kSection ENDIF
|
||||
syn match cp2kBegSection '^\s*&\w\+' contains=cp2kSection
|
||||
syn match cp2kEndSection '^\s*&END\s*\w\+' contains=cp2kSection
|
||||
|
||||
|
|
@ -92,7 +93,7 @@ syn keyword cp2kKeyword <xsl:value-of select="NAME"/>
|
|||
" CP2K preprocessing directives
|
||||
"-----------------------------------------------------------------/
|
||||
|
||||
syn keyword cp2kPreProc endif if include set
|
||||
syn keyword cp2kPreProc endif if include set xctype
|
||||
|
||||
"-----------------------------------------------------------------/
|
||||
" CP2K strings
|
||||
|
|
@ -119,7 +120,7 @@ endif
|
|||
let b:did_indent = 1
|
||||
|
||||
setlocal indentexpr=GetCp2kIndent()
|
||||
setlocal indentkeys+=0=~&END,0=#,0=@
|
||||
setlocal indentkeys+=0=~&END,0=~@ENDIF,0=#,0=@
|
||||
setlocal nosmartindent
|
||||
|
||||
if exists("*GetCp2kIndent")
|
||||
|
|
@ -133,23 +134,15 @@ function! GetCp2kIndent()
|
|||
endif
|
||||
let ind = indent(lnum)
|
||||
let line = getline(lnum)
|
||||
if line =~ '^\s*&'
|
||||
if line =~ '^\s*\c\%(&\|@IF\)'
|
||||
let ind += &shiftwidth
|
||||
if line =~ '^\s*\c\%(&END\)\>'
|
||||
if line =~ '^\s*\c\%(&END\|@ENDIF\)\>'
|
||||
let ind -= &shiftwidth
|
||||
endif
|
||||
elseif line =~ '^\s*\c\%(@if\|@endif\|@include\|@set\)\>'
|
||||
let plnum = lnum
|
||||
while getline(plnum) =~ '^\s*@'
|
||||
let plnum -= 1
|
||||
endwhile
|
||||
let ind = indent(plnum)
|
||||
endif
|
||||
let line = getline(v:lnum)
|
||||
if line =~ '^\s*\c\%(&END\)\>'
|
||||
if line =~ '^\s*\c\%(&END\|@ENDIF\)\>'
|
||||
let ind -= &shiftwidth
|
||||
elseif line =~ '^\s*@'
|
||||
let ind = 0
|
||||
endif
|
||||
return ind
|
||||
endfunction
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue