2020-02-01 14:06:32 +01:00
|
|
|
|
" boxes - command line ASCII boxes unlimited!
|
|
|
|
|
" Copyright (C) 1999-2020 Thomas Jensen and the boxes contributors
|
2014-08-27 22:41:48 +02:00
|
|
|
|
"
|
2020-02-01 14:06:32 +01:00
|
|
|
|
" This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public
|
|
|
|
|
" License, version 2, as published by the Free Software Foundation.
|
|
|
|
|
" This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied
|
|
|
|
|
" warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
|
|
|
|
|
" You should have received a copy of the GNU General Public License along with this program; if not, write to the Free
|
|
|
|
|
" Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
2014-08-27 22:41:48 +02:00
|
|
|
|
"
|
2020-02-01 14:06:32 +01:00
|
|
|
|
" Vim syntax file
|
|
|
|
|
" ---------------
|
|
|
|
|
" Latest version available from:
|
|
|
|
|
" https://github.com/ascii-boxes/boxes/blob/master/boxes.vim
|
2021-03-24 16:03:29 +01:00
|
|
|
|
" Status: This syntax file is not officially part of a boxes release, and simply intended to be downloaded via the link
|
|
|
|
|
" above, but we think it's great when it gets packaged and installed with boxes!
|
2020-02-01 14:06:32 +01:00
|
|
|
|
" Known Issues:
|
|
|
|
|
" https://github.com/ascii-boxes/boxes/issues?q=is%3Aissue+is%3Aopen+Vim+Syntax
|
|
|
|
|
" _____________________________________________________________________________________________________________________
|
2014-08-27 22:41:48 +02:00
|
|
|
|
|
|
|
|
|
|
2021-03-17 13:04:32 +01:00
|
|
|
|
if exists("b:current_syntax")
|
|
|
|
|
finish
|
|
|
|
|
endif
|
|
|
|
|
|
|
|
|
|
|
2014-08-27 22:41:48 +02:00
|
|
|
|
" Removes any old syntax stuff hanging around
|
|
|
|
|
syntax clear
|
|
|
|
|
|
|
|
|
|
" ignore case
|
|
|
|
|
syntax case ignore
|
|
|
|
|
|
|
|
|
|
" Set the keyword characters
|
2021-03-24 16:03:29 +01:00
|
|
|
|
syntax iskeyword a-z,A-Z
|
|
|
|
|
|
|
|
|
|
" TODO foldlevel - It should be possible to fold box designs
|
|
|
|
|
" TODO spell checking - In a boxes config file, only comments should be spell checked.
|
2014-08-27 22:41:48 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"
|
|
|
|
|
" Key Words
|
|
|
|
|
"
|
2021-03-24 16:03:29 +01:00
|
|
|
|
syntax keyword boxesClassicKeywords author designer revision created revdate tags indent skipwhite skipempty nextgroup=boxesString
|
|
|
|
|
syntax keyword boxesBlocks elastic replace reverse padding shapes skipwhite skipempty
|
|
|
|
|
syntax keyword boxesRegStuff with to once global skipwhite skipempty
|
|
|
|
|
syntax keyword boxesParent parent skipwhite nextgroup=boxesParentPath,boxesParentGlobal
|
|
|
|
|
syntax keyword boxesEnd end skipwhite skipempty nextgroup=boxesNameAtEnd
|
2014-08-27 22:41:48 +02:00
|
|
|
|
|
|
|
|
|
" Shape Names
|
2021-03-24 16:03:29 +01:00
|
|
|
|
syntax keyword boxesShapes nw nnw n nne ne ene e ese
|
|
|
|
|
syntax keyword boxesShapes se sse s ssw sw wsw w wnw
|
2014-08-27 22:41:48 +02:00
|
|
|
|
|
|
|
|
|
" Padding Areas
|
2021-03-24 16:03:29 +01:00
|
|
|
|
syntax keyword boxesPads a[ll] l[eft] r[ight] t top
|
|
|
|
|
syntax keyword boxesPads b[ottom] h[orizontal] v[ertical]
|
2014-08-27 22:41:48 +02:00
|
|
|
|
|
|
|
|
|
" Delimiter statement
|
2021-03-24 16:03:29 +01:00
|
|
|
|
syntax keyword boxesDelim delim delimiter skipwhite skipempty nextgroup=boxesDelSpec
|
2014-08-27 22:41:48 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"
|
|
|
|
|
" Error - this is matched when the others don't match
|
|
|
|
|
"
|
|
|
|
|
syntax match boxesError /\S/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"
|
|
|
|
|
" Main syntax definition part
|
|
|
|
|
"
|
2021-03-24 16:03:29 +01:00
|
|
|
|
syntax match boxesComma contained display /,/
|
|
|
|
|
syntax match boxesBraces display /[{}]/
|
|
|
|
|
" TODO Introduce region between delim and delim|end which exists 361 times to cover all combinations
|
|
|
|
|
syntax match boxesDelSpec contained display /[^ \t\r]\+/
|
|
|
|
|
syntax match boxesNameAtEnd display /[a-zA-Z<><5A><EFBFBD><EFBFBD><EFBFBD><EFBFBD>][a-zA-Z0-9_\-<2D><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>]*/ skipwhite skipempty
|
|
|
|
|
syntax match boxesWord display /[a-zA-Z<><5A><EFBFBD><EFBFBD><EFBFBD><EFBFBD>][a-zA-Z0-9_\-<2D><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>]*/
|
|
|
|
|
syntax match boxesNumber display /[-+]\=\d\+/
|
2014-08-27 22:41:48 +02:00
|
|
|
|
|
|
|
|
|
" a list, used inside shape blocks and for the elastic list
|
2021-03-24 16:03:29 +01:00
|
|
|
|
syntax region boxesList matchgroup=Normal start="(" end=")" contains=boxesString,boxesShapes,boxesComma,boxesError,boxesComment
|
2014-08-27 22:41:48 +02:00
|
|
|
|
|
|
|
|
|
" Strings
|
2021-03-24 16:03:29 +01:00
|
|
|
|
" TODO the uncontained is normal, and contained ones belong to a delim region
|
|
|
|
|
syntax region boxesString display start=/"/ skip=/\\\\\|\\"/ end=/"/ oneline
|
2014-08-27 22:41:48 +02:00
|
|
|
|
|
2021-03-17 13:04:32 +01:00
|
|
|
|
" File path of a 'parent' definition
|
2021-03-24 16:03:29 +01:00
|
|
|
|
syntax match boxesParentGlobal display "\s:global:\s*$"
|
|
|
|
|
syntax match boxesParentPath contained display "[^:]\{-}$"
|
2014-08-27 22:41:48 +02:00
|
|
|
|
|
|
|
|
|
" The SAMPLE block
|
2021-03-24 16:03:29 +01:00
|
|
|
|
syntax region boxesSample matchgroup=boxesBlocks start="sample" end=+^[ \t]*ends[ \t\r]*$+ keepend
|
|
|
|
|
|
|
|
|
|
" a BOX definition with aliases
|
|
|
|
|
syntax region boxesNames matchgroup=boxesBoxStmt start=/\<box\s\+/ end=/\>[ \t\r\n]\+\</re=s,he=s keepend contains=boxesComma
|
2014-08-27 22:41:48 +02:00
|
|
|
|
|
|
|
|
|
" Comments may appear anywhere in the file
|
2021-03-24 16:03:29 +01:00
|
|
|
|
syntax match boxesComment display /#.*$/
|
2014-08-27 22:41:48 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"
|
|
|
|
|
" Synchronisation
|
|
|
|
|
"
|
|
|
|
|
syntax sync clear
|
2021-03-24 16:03:29 +01:00
|
|
|
|
syntax sync match boxesSync grouphere boxesNames "box"
|
2021-03-17 13:04:32 +01:00
|
|
|
|
syntax sync match boxesSync "parent"
|
2021-03-24 16:03:29 +01:00
|
|
|
|
syntax sync minlines=40 maxlines=200
|
2014-08-27 22:41:48 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"
|
|
|
|
|
" Highlighting
|
|
|
|
|
"
|
|
|
|
|
if !exists("did_boxes_syntax_inits")
|
|
|
|
|
let did_boxes_syntax_inits = 1
|
|
|
|
|
|
2021-03-24 16:03:29 +01:00
|
|
|
|
hi link boxesNames Special
|
|
|
|
|
hi link boxesNameAtEnd Special
|
2021-03-17 13:04:32 +01:00
|
|
|
|
hi link boxesBoxStmt PreProc
|
2021-03-24 16:03:29 +01:00
|
|
|
|
hi link boxesEnd PreProc
|
2014-08-27 22:41:48 +02:00
|
|
|
|
hi link boxesNumber Number
|
|
|
|
|
hi link boxesString String
|
|
|
|
|
hi link boxesDelSpec boxesString
|
|
|
|
|
hi link boxesComment Comment
|
|
|
|
|
hi link boxesError Error
|
|
|
|
|
hi link boxesClassicKeywords Keyword
|
2021-03-17 13:04:32 +01:00
|
|
|
|
hi link boxesParent PreProc
|
|
|
|
|
hi link boxesParentGlobal PreProc
|
|
|
|
|
hi link boxesParentPath String
|
2014-08-27 22:41:48 +02:00
|
|
|
|
hi link boxesBlocks Statement
|
|
|
|
|
hi link boxesDelim boxesBlocks
|
|
|
|
|
hi link boxesRegStuff Label
|
|
|
|
|
hi link boxesShapes Type
|
|
|
|
|
hi link boxesPads Type
|
|
|
|
|
hi clear boxesSample
|
|
|
|
|
hi clear boxesWord
|
|
|
|
|
hi clear boxesBraces
|
|
|
|
|
hi clear boxesComma
|
|
|
|
|
endif
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"
|
|
|
|
|
" The current buffer now uses "boxes" syntax highlighting
|
|
|
|
|
"
|
|
|
|
|
let b:current_syntax = "boxes"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"EOF vim: sw=4
|