forked from xnning/vim-f2j-highlight
-
Notifications
You must be signed in to change notification settings - Fork 0
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
0 parents
commit 662cf53
Showing
2 changed files
with
98 additions
and
0 deletions.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
# vim syntax highlight for f2j | ||
|
||
Highlight the f2j code in Vim editor. | ||
|
||
## Usage | ||
|
||
1. Make sure Vim can idenfity the \*.sf file type. | ||
|
||
find `$VIMRUNTIME/filetype.vim` | ||
|
||
add | ||
|
||
``` | ||
" f2j | ||
au BufNewFile,BufRead *sf setf f2j | ||
``` | ||
For more details, type `:help filetype` in vim. | ||
2. Put `f2j.vim` to `$VIMRUNTIME/syntax/` |
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,77 @@ | ||
" Vim syntax file | ||
" Language: f2j | ||
" Maintainer: Ningning Xie <[email protected]> | ||
" Last Change: 2015 Mar 18 | ||
|
||
" For vim-version 5.x: Clear all syntax items | ||
" For other vim-version : Quit when a syntax file was already loaded | ||
if version < 600 | ||
syntax clear | ||
elseif exists("b:current_syntax") | ||
finish | ||
endif | ||
|
||
" (Qualified) identifiers (no default highlighting) | ||
syn match ConId "\(\<\u[a-zA-Z0-9_']*\.\)\=\<\u[a-zA-Z0-9_']*\>" | ||
syn match VarId "\(\<\u[a-zA-Z0-9_']*\.\)\=\<\l[a-zA-Z0-9_']*\>" | ||
|
||
" Keywords | ||
syn keyword f2jBoolean True False | ||
syn keyword f2jConditional if then else | ||
syn keyword f2jStatement case of \| let and rec | ||
syn keyword f2jModule module | ||
syn keyword f2jStructure data | ||
syn keyword f2jTypedef type | ||
syn keyword f2jType Int String Bool Char Float Double | ||
|
||
" Infix operation | ||
syn match f2jVarSym "\(\<\u[a-zA-Z0-9_']*\.\)\=[-!#$%&\*\+/<=>\?@\\^|~:.][-!#$%&\*\+/<=>\?@\\^|~:.]*" | ||
|
||
" Strings and Constants | ||
syn match f2jInteger "\<-\=\d\+\>" | ||
syn match f2jReal "\<-\=\d\+\.\d*\([eE][-+]\=\d\+\)\=\>" | ||
syn match f2jCharacter "'[^']'" | ||
syn match f2jCharacter "'\\''" | ||
syn match f2jCharacter "'[^\\]'" | ||
syn region f2jString start=+"+ skip=+\\\\\|\\"+ end=+"+ | ||
|
||
syn match f2jDelimiter "(\|)\|\[\|\]\|,\|;\|{\|}" | ||
|
||
" Comments | ||
syn region f2jComment start="--" end="$" contains=f2jTodo | ||
syn keyword f2jTodo contained TODO FIXME XXX | ||
|
||
|
||
" 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_f2j_syntax_inits") | ||
if version < 508 | ||
let did_f2j_syntax_inits = 1 | ||
command -nargs=+ HiLink hi link <args> | ||
else | ||
command -nargs=+ HiLink hi def link <args> | ||
endif | ||
|
||
HiLink f2jModule f2jStructure | ||
HiLink f2jVarSym f2jOperator | ||
|
||
HiLink f2jConditional Conditional | ||
HiLink f2jStatement Statement | ||
HiLink f2jInteger Number | ||
HiLink f2jReal Float | ||
HiLink f2jCharacter Character | ||
HiLink f2jBoolean Boolean | ||
HiLink f2jType Type | ||
HiLink f2jString String | ||
HiLink f2jComment Comment | ||
HiLink f2jTodo Todo | ||
HiLink f2jStructure Structure | ||
HiLink f2jOperator Operator | ||
HiLink f2jTypedef Typedef | ||
HiLink f2jDelimiter Delimiter | ||
|
||
delcommand HiLink | ||
endif | ||
|
||
let b:current_syntax = "f2j" |