Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8 changed files
with
217 additions
and
1 deletion.
There are no files selected for viewing
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
vim-minizinc | ||
============ | ||
|
||
Simple vim-Bundle for syntax highlighting for minizinc files and Gringo ASP files. Detects .mzn, .fzn and lp files. | ||
The definition of the syntax for vim is taken from the official minizinc-1.6 distribution. | ||
|
||
Ensure you have [Vundle](https://github.com/gmarik/Vundle.vim) installed | ||
Ensure your ~/.vimrc file contains the following plugin line | ||
|
||
``` | ||
Plugin 'vale1410/vim-minizinc' | ||
``` | ||
|
||
Then to install issue | ||
|
||
``` | ||
$ vim +PluginInstall +qall | ||
``` | ||
|
||
see for the original highlighting sources: | ||
|
||
* http://www.minizinc.org/ | ||
* http://potassco.sourceforge.net/ |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
autocmd BufNewFile,BufRead *.lp set filetype=gringo | ||
autocmd BufNewFile,BufRead *.pl set filetype=gringo | ||
autocmd BufNewFile,BufRead *.gringo set filetype=gringo |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
autocmd BufNewFile,BufRead *.mzn set filetype=zinc | ||
autocmd BufNewFile,BufRead *.fzn set filetype=zinc |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,90 @@ | ||
if version < 600 | ||
syntax clear | ||
elseif exists("b:current_syntax") | ||
finish | ||
endif | ||
|
||
let b:current_syntax = '' | ||
unlet b:current_syntax | ||
syn include @Lua syntax/lua.vim | ||
|
||
let b:current_syntax = '' | ||
unlet b:current_syntax | ||
syn include @Python syntax/python.vim | ||
|
||
syn case match | ||
|
||
syn match gringoKeyword "\*%" | ||
syn match gringoComment +%.*+ | ||
syn region gringoBlockComment start="%\*" end="\*%" | ||
|
||
syn match gringoError "#.*" | ||
|
||
syn region luaCode matchgroup=gringoKeyword start="#begin_lua" keepend end="#end_lua" contains=@Lua | ||
syn region luaCode matchgroup=gringoKeyword start="#script[ ]*([ ]*lua[ ]*)" keepend end="#end" contains=@Lua | ||
syn region pythonCode matchgroup=gringoKeyword start="#script[ ]*([ ]*python[ ]*)" keepend end="#end" contains=@Python | ||
syn match gringoKeyword "#ishift" | ||
syn match gringoKeyword "#base" | ||
syn match gringoKeyword "#domain" | ||
syn match gringoKeyword "#hide" | ||
syn match gringoKeyword "#show" | ||
syn match gringoKeyword "#cumulative" | ||
syn match gringoKeyword "#volatile" | ||
syn match gringoKeyword "#const" | ||
syn match gringoKeyword "#include" | ||
syn match gringoKeyword "#incremental" | ||
syn match gringoKeyword "#sup" | ||
syn match gringoKeyword "#inf" | ||
syn match gringoKeyword "#supremum" | ||
syn match gringoKeyword "#infimum" | ||
syn match gringoKeyword "#undef" | ||
|
||
syn match gringoFunction "#min" | ||
syn match gringoFunction "#max" | ||
syn match gringoFunction "#minimise" | ||
syn match gringoFunction "#maximise" | ||
syn match gringoFunction "#minimize" | ||
syn match gringoFunction "#maximize" | ||
syn match gringoFunction "#external" | ||
syn match gringoFunction "#count" | ||
syn match gringoFunction "#sum" | ||
syn match gringoFunction "#times" | ||
syn match gringoFunction "#abs" | ||
syn match gringoFunction "#avg" | ||
syn match gringoFunction "#mod" | ||
syn match gringoFunction "#odd" | ||
syn match gringoFunction "#even" | ||
syn match gringoFunction "#pow" | ||
syn match gringoFunction "#program" | ||
|
||
syn region gringoString start=+"+ skip=+\\"+ end=+"+ | ||
syn match gringoKey "\<not\>" | ||
syn match gringoKey "#false" | ||
syn match gringoKey "#true" | ||
syn match gringoFunction "#compute" | ||
syn match gringoVar "\<_*[A-Z]['a-zA-Z0-9_]*\>'*" | ||
syn match gringoOperator "=\|<\|<=\|>\|>=\|=\|==\|!=" | ||
syn match gringoNumber "\<[0123456789]*\>" | ||
syn match gringoRule ":-" | ||
|
||
syn sync maxlines=500 | ||
|
||
command! -nargs=+ HiLink hi def link <args> | ||
|
||
HiLink gringoComment Comment | ||
HiLink gringoBlockComment Comment | ||
|
||
HiLink gringoKeyword Type | ||
HiLink gringoFunction PreProc | ||
HiLink gringoNumber Number | ||
HiLink gringoString String | ||
HiLink gringoOperator Special | ||
HiLink gringoRule Special | ||
HiLink gringoVar Identifier | ||
HiLink gringoError Error | ||
HiLink gringoKey Keyword | ||
|
||
delcommand HiLink | ||
|
||
let b:current_syntax = "gringo" | ||
|
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,87 @@ | ||
" Vim syntax file | ||
" Language: Zinc | ||
" Author: Nicholas Nethercote <njn@csse.unimelb.edu.au> | ||
" Based on Ralph Becket's mercury.vim. | ||
" vim: ts=2 sw=2 et | ||
|
||
if exists("b:current_syntax") | ||
finish | ||
endif | ||
let b:current_syntax = "zinc" | ||
|
||
" Zinc is case sensitive. | ||
" | ||
syn case match | ||
|
||
" The default highlighting for Zinc comments is to highlight | ||
" everything including the comment text. To only highlight the | ||
" initial `%' and subsequent `line' punctuation characters, put: | ||
" | ||
" let zinc_only_highlight_comment_start = 1 | ||
" | ||
" somewhere in your `.vimrc' file. | ||
" | ||
" By default, parts of lines that extend over 80 characters will be | ||
" highlighted. To avoid this behaviour, add | ||
" | ||
" let zinc_no_highlight_overlong = 1 | ||
" | ||
" somewhere in your `.vimrc' file. | ||
" | ||
if exists("zinc_only_highlight_comment_start") && zinc_only_highlight_comment_start | ||
syn region zincComment start=+%[-=%*_]*+ end=+.*$+he=s-1 contains=zincToDo | ||
else | ||
syn region zincComment start=+%+ end=+.*$+ contains=zincToDo | ||
endif | ||
|
||
syn keyword zincType ann any array bool enum float int list of record | ||
syn keyword zincType set string tuple par var | ||
|
||
syn keyword zincKeyword annotation assert case constraint | ||
syn keyword zincKeyword else elseif endif function if in include let | ||
syn keyword zincKeyword minimize maximize op output predicate satisfy | ||
syn keyword zincKeyword solve test then type where | ||
|
||
syn match zincInt "\<[0-9]\+\>\|\<0[xX][0-9a-fA-F]\+\>\|\<0[oO][0-7]\+\>" | ||
syn match zincFloat "\<[0-9]\+\.[0-9]\+\([eE][-+]\=[0-9]\+\)\=\>" | ||
syn match zincFloat "\<[0-9]\+\([eE][-+]\=[0-9]\+\)\=\>" | ||
|
||
syn keyword zincOp not xor subset superset | ||
syn keyword zincOp union diff symdiff intersect div mod | ||
syn match zincOp &\.\.\|+\|-\|\*\|\/\|++& | ||
syn match zincOp +<->\|<-\|->\|/\\\|\\/+ | ||
" Although '=' can be an operator, don't highlight it because it's mostly | ||
" used in definitions. Likewise, 'in' can be an operator, but we treat it | ||
" as a keyword because it's mostly used in generators. | ||
syn match zincOp +==\|!=\|<>\|=<\|<=\|<\|>=\|=>\|>\|>+ | ||
syn match zincOp +\.\.\.+ | ||
|
||
syn keyword zincToDo XXX TODO NOTE | ||
syn region zincString start=+"+ skip=+\\.+ end=+"+ contains=zincStringFmt | ||
syn match zincStringFmt +\\[abfnrtv]\|\\x[0-9a-fA-F]*\\\|%[-+# *.0-9]*[dioxXucsfeEgGp]+ contained | ||
|
||
if !exists("zinc_no_highlight_overlong") || !zinc_no_highlight_overlong | ||
" The complicated regexp here matches an 80-column string, | ||
" with proper treatment of tabs (assuming the tab size is 8): | ||
" each row consists of 10 columns, and each column consists of either 8 | ||
" non-tab characters, or 0-7 non-tab characters followed by a tab. | ||
syn match zincFirst80 +^\([^ ]\{8}\|[^ ]\{0,7} \)\{10}+ contains=ALL | ||
syn match zincTooLong +^\([^ ]\{8}\|[^ ]\{0,7} \)\{10}..*+ contains=zincFirst80 | ||
endif | ||
|
||
syn region cComment start="/\*" end=".*\*/" contains=zincToDo | ||
|
||
syn sync fromstart | ||
|
||
hi link zincComment Comment | ||
hi link cComment Comment | ||
hi link zincType Type | ||
hi link zincInt Number | ||
hi link zincFloat Number | ||
hi link zincKeyword Keyword | ||
hi link zincToDo Todo | ||
hi link zincOp Special | ||
hi link zincString String | ||
hi link zincStringFmt Special | ||
hi link zincAtom Constant | ||
hi link zincTooLong ErrorMsg |
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