From d47497950f3e2cb49137cc76e6881a849c59bd71 Mon Sep 17 00:00:00 2001 From: Matthias Krack Date: Tue, 10 Dec 2013 14:31:19 +0000 Subject: [PATCH] Syntax highlighting for CP2K input preprocessor keywords; refactoring svn-origin-rev: 13434 --- web/manual/vim.xsl | 75 +++++++++++++++++++++++----------------------- 1 file changed, 37 insertions(+), 38 deletions(-) diff --git a/web/manual/vim.xsl b/web/manual/vim.xsl index 0f48ce036b..9076a23a1c 100644 --- a/web/manual/vim.xsl +++ b/web/manual/vim.xsl @@ -4,7 +4,9 @@ " Vim syntax file " Language: cp2k input files " Maintainer: based on work by Alin M Elena available at https://gitorious.org/cp2k-vim -" Latest Revision: 13th of September 2010 +" Revision: 13th of September 2010 +" History: +" - XSLT dump and improved syntax highlighting (10.12.2013, Matthias Krack) if exists("b:current_syntax") finish @@ -12,37 +14,6 @@ endif syn case ignore -"----------------------------------------------------------------/ -" CP2K predefined constants -"----------------------------------------------------------------/ - - -syn keyword cp2kConstant - - -"----------------------------------------------------------------/ -" CP2K sections -"----------------------------------------------------------------/ - - -syn keyword cp2kSection - -syn keyword cp2kSection END - -"----------------------------------------------------------------/ -" CP2K keywords -"----------------------------------------------------------------/ - - -syn keyword cp2kKeyword - - -"----------------------------------------------------------------/ -" fun stuff folding -"----------------------------------------------------------------/ - -syn region cp2kFold start="^\s*&\z(\w*\)" end="^\s*&End\s\+\z1\>" contains=cp2kFold fold keepend - "----------------------------------------------------------------/ " CP2K numbers used in blocks "----------------------------------------------------------------/ @@ -70,6 +41,10 @@ syn match cp2kNumber '\d[[:digit:]]*[eE][\-+]\=\d\+' syn match cp2kNumber '[-+]\=\d[[:digit:]]*\.\d*[eE][\-+]\=\d\+' syn match cp2kNumber '\d[[:digit:]]*\.\d*[eE][\-+]\=\d\+' +"----------------------------------------------------------------/ +" CP2K Boolean entities +"----------------------------------------------------------------/ + syn keyword cp2kBool true false T F yes no "-----------------------------------------------------------------/ @@ -80,23 +55,47 @@ syn keyword cp2kTodo TODO FIXME NOTE REMARK syn match cp2kComment "#.*$" contains=cp2kTodo syn match cp2kComment "!.*$" contains=cp2kTodo +"----------------------------------------------------------------/ +" CP2K predefined constants +"----------------------------------------------------------------/ + + +syn keyword cp2kConstant + + +"----------------------------------------------------------------/ +" CP2K sections +"----------------------------------------------------------------/ + + +syn keyword cp2kSection + +syn keyword cp2kSection END +syn match cp2kBegSection "^\s*&\w\+" contains=cp2kSection nextgroup=test +syn match test ".*[^!#]" contains=cp2kConstant,cp2kNumber,cp2kBool,cp2kComment,cp2kSection + +"----------------------------------------------------------------/ +" CP2K keywords +"----------------------------------------------------------------/ + + +syn keyword cp2kKeyword + +syn match cp2kBegKeyword "^\s*\w\+" contains=cp2kKeyword + "-----------------------------------------------------------------/ " CP2K preprocessing directives "-----------------------------------------------------------------/ syn keyword cp2kPreProc endif if include set - -syn match cp2kBegSection "^\s*&\w\+" contains=cp2kSection nextgroup=test -syn match test ".*[^!#]" contains=cp2kConstant,cp2kNumber,cp2kBool,cp2kComment,cp2kSection - -syn match cp2kBegKeyword "^\s*\w\+" contains=cp2kKeyword +syn match cp2kBegPreProc "^\s*@\w\+" contains=cp2kPreProc "----------------------------------------------------------------------------/ " Final setup "----------------------------------------------------------------------------/ let b:current_syntax="cp2k" -set fdm=syntax +set fdm=manual set foldlevel=3 "----------------------------------------------------------------------------/