diff options
author | buraq <buraq@epfl.ch> | 2005-03-29 13:15:56 +0000 |
---|---|---|
committer | buraq <buraq@epfl.ch> | 2005-03-29 13:15:56 +0000 |
commit | a95c0558aae283ebc337255413956a8f61cc746b (patch) | |
tree | 045c28f0a525cf5d1919bcf801d32acc320c3d44 /support/vim | |
parent | 2e064cb5740198a9a8f6fbcabc590b9874800032 (diff) | |
download | scala-a95c0558aae283ebc337255413956a8f61cc746b.tar.gz scala-a95c0558aae283ebc337255413956a8f61cc746b.tar.bz2 scala-a95c0558aae283ebc337255413956a8f61cc746b.zip |
vim mode by Raphael Haberer-Proust
Diffstat (limited to 'support/vim')
-rw-r--r-- | support/vim/README | 32 | ||||
-rw-r--r-- | support/vim/scala.vim | 87 |
2 files changed, 119 insertions, 0 deletions
diff --git a/support/vim/README b/support/vim/README new file mode 100644 index 0000000000..b13c2a9009 --- /dev/null +++ b/support/vim/README @@ -0,0 +1,32 @@ +From Raphael Haberer-Proust's website (http://diwww.epfl.ch/~haberer/syntax/scala_en.html): + +Disclaimer + + * This is an absolutly basic version + * Only keywords and simple constructs like comments are recognized + * It is by far not finished + * For comments and changes, please send me a mail to raphael.haberer-proust<at>epfl.ch + (replace <at> with the apropriate symbol) + +Known bugs + + * automatic indentation does not work properly when using the syntaxic possibilities of scala (for example when omitting the ; after the return value) + +How to use it + +In order to make vim find that file, add this line anywhere in your .vimrc configuration file: +let mysyntaxfile = "folder_path/scala.vim" + + * under Linux, Solaris, etc. usualy /home/username/.vimrc + * under Mac OS X : /Users/username/.vimrc + +If you want all the users of the system to access it by default, the best is to copy the file in vim's syntax folder +(usualy /usr/share/vim/vim62/syntax/ or similar) and to add the line in the global configuration file (usualy /etc/vimrc) + +If you do not have an own configuration file for vim, here[link removed] is mine, rename it to .vimrc and put it in your +home folder + +Of course, syntaxic coloring must be switched on under vim. You can do this with +syntax on + + * For the users of the "operating system" from Redmond, as that system is said to be so easy to use, I'm sure they will get it by themselves ;-)
\ No newline at end of file diff --git a/support/vim/scala.vim b/support/vim/scala.vim new file mode 100644 index 0000000000..7f7d9e2806 --- /dev/null +++ b/support/vim/scala.vim @@ -0,0 +1,87 @@ +" Vim syntax file +" Language: Scala +" Version: 0.1 +" Maintainer: Raphael Haberer-Proust <raphael.haberer-proust at epfl.ch> +" URL: http://diwww.epfl.ch/~haberer/syntax/scala.html +" Last Change: 2004 April 18 +" Disclaimer: It's an absolut basic, very simple and by far not finished +" syntax file! It only recognizes basic keywords and constructs like comments +" any help is welcome + +" Remove any old syntax stuff +syn clear + +" syntax highlighting for words that are not identifiers: +" int unit double String Array byte short char long float +syn keyword scalaExternal import package +syn keyword scalaConditional if then else +syn keyword scalaRepeat while for do +syn keyword scalaType boolean int double byte short char long float +syn keyword scalaType unit +syn keyword scalaType val with type var yield + +syn keyword scalaStatement return +syn keyword scalaBoolean true false +syn keyword scalaConstant null +syn keyword scalaTypedef this super +syn keyword scalaLangClass String Array +syn keyword scalaScopeDecl private protected override +syn keyword scalaStorageClass abstract final sealed +syn keyword scalaExceptions throw try catch finally +syn keyword scalaClassDecl extends +" TODO differentiate the keyword class from MyClass.class -> use a match here +syn keyword scalaTypedef class +syn keyword scalaTypedef case +syn keyword scalaTypedef trait + +syn match scalaTypedef "\s*\<object\>" + +syn keyword scalaOperator new + +" same number definition as in java.vim +syn match scalaNumber "\<\(0[0-7]*\|0[xX]\x\+\|\d\+\)[lL]\=\>" +syn match scalaNumber "\(\<\d\+\.\d*\|\.\d\+\)\([eE][-+]\=\d\+\)\=[fFdD]\=" +syn match scalaNumber "\<\d\+[eE][-+]\=\d\+[fFdD]\=\>" +syn match scalaNumber "\<\d\+\([eE][-+]\=\d\+\)\=[fFdD]\>" + +syn region scalaString start=+"+ end=+"+ + +" Functions +" def [name] [(prototype)] { +" +syn match scalaFunction "\s*\<def\>" + +" Comments +syn region scalaComment start="/\*" end="\*/" +syn match scalaLineComment "//.*" + + +if !exists("did_scala_syntax_inits") + let did_scala_syntax_inits = 1 + + " The default methods for highlighting. Can be overridden later + hi link scalaExternal Include + hi link scalaStatement Statement + hi link scalaConditional Conditional + hi link scalaRepeat Repeat + hi link scalaType Type + hi link scalaTypedef Typedef + hi link scalaBoolean Boolean + hi link scalaFunction Function + hi link scalaLangClass Constant + hi link scalaConstant Constant + hi link scalaScopeDecl scalaStorageClass + hi link scalaClassDecl scalaStorageClass + hi link scalaStorageClass StorageClass + hi link scalaExceptions Exception + hi link scalaOperator Operator + hi link scalaNumber Number + hi link scalaString String + hi link scalaComment Comment + hi link scalaLineComment Comment +endif + +let b:current_syntax = "scala" + +" if you want to override default methods for highlighting +"hi Conditional term=bold ctermfg=Cyan guifg=#80a0ff |