[Thread Prev][Thread Next][Index]

Re: Syntax Highlighting

In a similar vain to those who wanted an emacs mode for ferret, I wonder
if anyone has developed a file for ferret to be used with the Syntax
highlighting included in the VIM (Vi IMproved) package. Any help

Ask and ye shall receive! I'll also place it on our ftp site at
ftp.hba.marine.csiro.au under pub/fiedler/ferret

I haven't spent a lot of time on it but it does a pretty reasonable job.

Any changes/enhancements that people wish to submit will be gratefully


" Vim syntax file
" Language:	Ferret
" Maintainer:	Russell Fiedler

" Remove any old syntax stuff hanging around
syn clear

syn case ignore

" Main plotting commands
syn keyword ferretStatement		plot contour fill shade vector wire 
" Other commands
syn keyword ferretStatement		alias cancel can define def exit file frame
syn keyword ferretStatement		help label let list load message palette pal 
syn keyword ferretStatement		pattern pause polygon poly pplus ppl quit
syn keyword ferretStatement		save set show spawn sp statistics stat use user
" Keywords associated with define,set,show
syn keyword ferretStatement		ascii_font ascii axis calendar cal commands data
syn keyword ferretStatement		data_set depth_label desperate expression grid
syn keyword ferretStatement		ignore_error interpolate journal latit_label 
syn keyword ferretStatement		long_label
syn keyword ferretStatement		memory mem metafile meta mode movie polish ppllist
syn keyword ferretStatement		refresh region reg segments stupid
syn keyword ferretStatement		transform trans variables variable var verify
syn keyword ferretStatement		viewport view wait windows window win
" Conditionals
syn keyword ferretConditional		else elseif end if otherwise
" Looping
syn keyword ferretRepeat		repeat

syn match ferretPaste 			"yes\?"

" If you do want these operators lit, uncomment them and the "hi link" below
"syn match ferretArithmeticOperator	"[-+]"
"syn match ferretArithmeticOperator	"\.\=[*/\\^]"

"syn match ferretIdentifier		"\<[a-zA-Z_][a-zA-Z0-9_]*\>"

" String
syn region ferretString			start=+"+ end=+"+	oneline

" Standard numbers
syn match ferretNumber		"\<[0-9]\+[ij]\=\>"
" floating point number, with dot, optional exponent
syn match ferretFloat		"\<[0-9]\+\.[0-9]*\([edED][-+]\=[0-9]\+\)\=[ij]\=\>"
" floating point number, starting with a dot, optional exponent
syn match ferretFloat		"\.[0-9]\+\([edED][-+]\=[0-9]\+\)\=[ij]\=\>"
" floating point number, without dot, with exponent
syn match ferretFloat		"\<[0-9]\+[edED][-+]\=[0-9]\+[ij]\=\>"

" Delimiters:

syn match  ferretDelimiter		"[][()/]"

syn match ferretComment		"\!.*$"	contains=ferretTodo,ferretTab

" match go and script name
syn match ferretGo		"go\s\S\+"

"Ferret functions

syn keyword ferretFunction		abs acos asin atan atan2 cos days1900 exp ignore0 
syn keyword ferretFunction		int ln log
syn keyword ferretFunction		max min missing mod reshape randu randn rho_un 
syn keyword ferretFunction		sin tan theta_fo tsequence xsequence ysequence
syn keyword ferretFunction		zsequence zaxreplace

" Match symbols

syn match ferretSymbol	"\$[1-9]"
syn region ferretSymbol start=+(\$+ end=+)+

if !exists("did_ferret_syntax_inits")
  let did_ferret_syntax_inits = 1
  " The default methods for highlighting.  Can be overridden later
  hi link ferretOperator		Operator
  hi link ferretConditional		Conditional
  hi link ferretRepeat			Repeat
  hi link ferretPaste			Todo
  hi link ferretString			String
  hi link ferretSymbol			Special
  hi link ferretDelimiter		Identifier
  hi link ferretNumber			Number
  hi link ferretFloat			Float
  hi link ferretGo			Todo
  hi link ferretFunction		Function
  hi link ferretStatement		Statement
  hi link ferretComment			Comment

"  hi link ferretArithmeticOperator	ferretOperator
  hi link ferretRelationalOperator	ferretOperator
  hi link ferretLogicalOperator		ferretOperator


let b:current_syntax = "ferret"

"EOF	vim: ts=8 noet tw=100 sw=8 sts=0

[Thread Prev][Thread Next][Index]

Dept of Commerce / NOAA / OAR / PMEL / TMAP

Contact Us | Privacy Policy | Disclaimer | Accessibility Statement