Skip to content

Instantly share code, notes, and snippets.

@daniellivingston
Created November 16, 2017 21:55
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save daniellivingston/42c75f39b6fdd342f1ffe3fd73193311 to your computer and use it in GitHub Desktop.
Save daniellivingston/42c75f39b6fdd342f1ffe3fd73193311 to your computer and use it in GitHub Desktop.
LaGriT Syntax file for ViM
" Vim syntax file
" Language: LaGriT
" Maintainer: Daniel Livingston
" Latest Revision: 16 November 2017
" To install: copy to ~/.vim/syntax/lagrit.vim
" ---------------------------------------------------- "
" if exists("b:current_syntax")
" finish
" endif
" Match floating point or integers
syn match LGNumbers '\d\+'
syn match LGNumbers '[-+]\d\+'
syn match LGNumbers '[-+]\d\+\.\d*'
" Capture words with numbers appended, i.e. mo1, to avoid number highlighting
syn match LGNull '[A-Za-z]\+[0-9]\+'
" syn match LGNull '[,/=" "]\+'
" For a command line, first and second entries
syn match argOne '^\zs[^\/]\+\ze' contained
syn match argTwo '\/\zs[^\/]\+\ze\/' contained
syn match argOneTwo '^\zs[^\/]\+\/[^\/]\+\ze\/' contains=argOne,argTwo
" Select keywords that should be highlighted differently
syn keyword argFinish finish
syn keyword argSingle setpts settets connect geniee triangulate quality and
syn keyword argQualifiers rtp xyz all brief seq nod minmax list value node element both le gt ge eq lt imt itetclr
syn keyword argLast minmax quad plane box hex tet tri ascii binary def inclusive
syn keyword argOneShort rmpoint resetpts
syn keyword argTwoShort compress itp status
" Comments
syn match LGComment "[#*].*$"
" Link matches to highlighting classes
hi def link argQualifiers Identifier
hi def link argTwo Statement
hi def link argOne Type
hi def link argTwoShort Statement
hi def link argOneShort Type
hi def link argFinish PreProc
hi def link argSingle Type
hi def link LGComment Comment
hi def link LGNumbers Constant
hi def link argLast Statement
let b:current_syntax = "lagrit"
" IMPORTANT NOTE:
" MUST be renamed 'lagrit.vim'
" Copy into ~/.vim/ftdetect/lagrit.vim
autocmd BufRead,BufNewFile *.lgi set filetype=lagrit
@daniellivingston
Copy link
Author

Copy lagrit.vim to ~/.vim/syntax/lagrit.vim.
Rename lagrit_2.vim to lagrit.vim and copy to ~/.vim/ftdetect/lagrit.vim.

May have to create syntax and ftdetect folders if you don't have any other syntax files installed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment