Created
June 22, 2022 21:34
-
-
Save ewquon/56c6dbdbff555dd6549a5ded831d18c0 to your computer and use it in GitHub Desktop.
Vim syntax highlighting for amrex input files
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
" Vim syntax file | |
" Language: Input file for AMReX codes, based on "dosini" syntax v2.1 | |
" Version: 2.1 | |
" Homepage: | |
" Last Change: 2022 June 22 | |
" For version 5.x: Clear all syntax items | |
" For version 6.x: Quit when a syntax file was already loaded | |
if version < 600 | |
syntax clear | |
elseif exists("b:current_syntax") | |
finish | |
endif | |
" shut case off | |
syn case ignore | |
syn match dosiniNumber "\<\d\+\>" | |
syn match dosiniNumber "\<\d*\.\d\+\>" | |
syn match dosiniNumber "\<\d\+e[+-]\=\d\+\>" | |
syn match dosiniLabel "^.\{-}=" | |
syn region dosiniHeader start="^\s*\[" end="\]" | |
syn match dosiniComment "^[#;].*$" | |
" Additional tweaks for numerical values | |
" see: https://vim.fandom.com/wiki/Creating_your_own_syntax_files#Matches_(and_addendum_to_keywords) | |
" - Integer with - + or nothing in front | |
syn match dosiniNumber '\d\+' | |
syn match dosiniNumber '[-+]\d\+' | |
" - Floating point number with decimal no E or e | |
syn match dosiniNumber '[-+]\d\+\.\d*' | |
" - Floating point like number with E and no decimal point (+,-) | |
syn match dosiniNumber '[-+]\=\d[[:digit:]]*[eE][\-+]\=\d\+' | |
syn match dosiniNumber '\d[[:digit:]]*[eE][\-+]\=\d\+' | |
" - Floating point like number with E and decimal point (+,-) | |
syn match dosiniNumber '[-+]\=\d[[:digit:]]*\.\d*[eE][\-+]\=\d\+' | |
syn match dosiniNumber '\d[[:digit:]]*\.\d*[eE][\-+]\=\d\+' | |
" Define the default highlighting. | |
" For version 5.7 and earlier: only when not done already | |
" For version 5.8 and later: only when an item doesn't have highlighting yet | |
if version >= 508 || !exists("did_dosini_syntax_inits") | |
if version < 508 | |
let did_dosini_syntax_inits = 1 | |
command -nargs=+ HiLink hi link <args> | |
else | |
command -nargs=+ HiLink hi def link <args> | |
endif | |
HiLink dosiniNumber Number | |
HiLink dosiniHeader Special | |
HiLink dosiniComment Comment | |
HiLink dosiniLabel Type | |
delcommand HiLink | |
endif | |
let b:current_syntax = "dosini" | |
" vim: sts=2 sw=2 et |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment