mirror of
https://github.com/sheerun/vim-polyglot.git
synced 2025-11-09 12:03:53 -05:00
Compare commits
2 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
d1e95cbc98 | ||
|
|
7ffa793f19 |
10
README.md
10
README.md
@@ -26,10 +26,9 @@ Optionally download one of the [releases](https://github.com/sheerun/vim-polyglo
|
||||
## Language packs
|
||||
|
||||
- [arduino](https://github.com/sudar/vim-arduino-syntax) (syntax, indent, ftdetect)
|
||||
- [blade](https://github.com/xsbeats/vim-blade) (syntax, ftdetect)
|
||||
- [blade](https://github.com/xsbeats/vim-blade) (syntax, indent, ftdetect)
|
||||
- [c++11](https://github.com/octol/vim-cpp-enhanced-highlight) (syntax)
|
||||
- [c/c++](https://github.com/vim-jp/cpp-vim) (syntax)
|
||||
- [c-extensions](https://github.com/kergoth/aftersyntaxc.vim) (syntax)
|
||||
- [clojure](https://github.com/guns/vim-clojure-static) (syntax, indent, autoload, ftplugin, ftdetect)
|
||||
- [coffee-script](https://github.com/kchmck/vim-coffee-script) (syntax, indent, compiler, autoload, ftplugin, ftdetect)
|
||||
- [css](https://github.com/JulesWang/css.vim) (syntax)
|
||||
@@ -49,7 +48,8 @@ Optionally download one of the [releases](https://github.com/sheerun/vim-polyglo
|
||||
- [jade](https://github.com/digitaltoad/vim-jade) (syntax, indent, ftplugin, ftdetect)
|
||||
- [jasmine](https://github.com/glanotte/vim-jasmine) (syntax, ftdetect)
|
||||
- [javascript](https://github.com/pangloss/vim-javascript) (syntax, indent, ftdetect)
|
||||
- [json](https://github.com/leshill/vim-json) (syntax, ftdetect)
|
||||
- [julia](https://github.com/dcjones/julia-minimalist-vim) (syntax, indent, ftdetect)
|
||||
- [json](https://github.com/sheerun/vim-json) (syntax, indent, ftdetect)
|
||||
- [jst](https://github.com/briancollins/vim-jst) (syntax, indent, ftdetect)
|
||||
- [latex](https://github.com/LaTeX-Box-Team/LaTeX-Box) (syntax, indent, ftplugin)
|
||||
- [less](https://github.com/groenewege/vim-less) (syntax, indent, ftplugin, ftdetect)
|
||||
@@ -70,7 +70,7 @@ Optionally download one of the [releases](https://github.com/sheerun/vim-polyglo
|
||||
- [ruby](https://github.com/vim-ruby/vim-ruby) (syntax, indent, compiler, autoload, ftplugin, ftdetect)
|
||||
- [rust](https://github.com/wting/rust.vim) (syntax, indent, compiler, autoload, ftplugin, ftdetect)
|
||||
- [sbt](https://github.com/derekwyatt/vim-sbt) (syntax, ftdetect)
|
||||
- [scala](https://github.com/derekwyatt/vim-scala) (syntax, indent, ftplugin, ftdetect)
|
||||
- [scala](https://github.com/derekwyatt/vim-scala) (syntax, indent, compiler, ftplugin, ftdetect)
|
||||
- [slim](https://github.com/slim-template/vim-slim) (syntax, indent, ftdetect)
|
||||
- [stylus](https://github.com/wavded/vim-stylus) (syntax, indent, ftplugin, ftdetect)
|
||||
- [systemd](https://github.com/kurayama/systemd-vim-syntax) (syntax, ftdetect)
|
||||
@@ -78,7 +78,7 @@ Optionally download one of the [releases](https://github.com/sheerun/vim-polyglo
|
||||
- [textile](https://github.com/timcharper/textile.vim) (syntax, ftplugin, ftdetect)
|
||||
- [tmux](https://github.com/tejr/vim-tmux) (syntax, ftdetect)
|
||||
- [tomdoc](https://github.com/duwanis/tomdoc.vim) (syntax)
|
||||
- [typescript](https://github.com/leafgarland/typescript-vim) (syntax, compiler, ftplugin, ftdetect)
|
||||
- [typescript](https://github.com/leafgarland/typescript-vim) (syntax, indent, compiler, ftplugin, ftdetect)
|
||||
- [vbnet](https://github.com/vim-scripts/vbnet.vim) (syntax)
|
||||
- [thrift](https://github.com/solarnz/thrift.vim) (syntax, ftdetect)
|
||||
- [toml](https://github.com/cespare/vim-toml) (syntax, ftplugin, ftdetect)
|
||||
|
||||
6
after/syntax/json.vim
Normal file
6
after/syntax/json.vim
Normal file
@@ -0,0 +1,6 @@
|
||||
" Language: Colorful CSS Color Preview
|
||||
" Author: Aristotle Pagaltzis <pagaltzis@gmx.de>
|
||||
|
||||
if !( has('gui_running') || &t_Co==256 ) | finish | endif
|
||||
|
||||
call css_color#init('css', 'none', 'jsonString')
|
||||
@@ -704,7 +704,9 @@ class VimRubyCompletion
|
||||
cv = eval("self.class.constants")
|
||||
vartype = get_var_type( receiver )
|
||||
dprint "vartype: %s" % vartype
|
||||
if vartype != ''
|
||||
|
||||
invalid_vartype = ['', "gets"]
|
||||
if !invalid_vartype.include?(vartype)
|
||||
load_buffer_class( vartype )
|
||||
|
||||
begin
|
||||
@@ -732,7 +734,7 @@ class VimRubyCompletion
|
||||
methods.concat m.instance_methods(false)
|
||||
}
|
||||
end
|
||||
variables += add_rails_columns( "#{vartype}" ) if vartype && vartype.length > 0
|
||||
variables += add_rails_columns( "#{vartype}" ) if vartype && !invalid_vartype.include?(vartype)
|
||||
|
||||
when /^\(?\s*[A-Za-z0-9:^@.%\/+*\(\)]+\.\.\.?[A-Za-z0-9:^@.%\/+*\(\)]+\s*\)?\.([^.]*)/
|
||||
message = $1
|
||||
|
||||
2
build
2
build
@@ -93,6 +93,7 @@ PACKS="
|
||||
jade:digitaltoad/vim-jade
|
||||
jasmine:glanotte/vim-jasmine
|
||||
javascript:pangloss/vim-javascript
|
||||
julia:dcjones/julia-minimalist-vim
|
||||
json:sheerun/vim-json
|
||||
jst:briancollins/vim-jst
|
||||
latex:LaTeX-Box-Team/LaTeX-Box
|
||||
@@ -110,6 +111,7 @@ PACKS="
|
||||
protobuf:uarun/vim-protobuf
|
||||
python:mitsuhiko/vim-python-combined
|
||||
r-lang:vim-scripts/R.vim
|
||||
ragel:jneen/ragel.vim
|
||||
rspec:sheerun/rspec.vim
|
||||
ruby:vim-ruby/vim-ruby
|
||||
rust:wting/rust.vim
|
||||
|
||||
@@ -83,6 +83,8 @@ au BufNewFile,BufRead *.jst set filetype=jst
|
||||
au BufNewFile,BufRead *.djs set filetype=jst
|
||||
au BufNewFile,BufRead *.hamljs set filetype=jst
|
||||
au BufNewFile,BufRead *.ect set filetype=jst
|
||||
au BufRead,BufNewFile *.jl let b:undo_ftplugin = "setlocal comments< define< formatoptions< iskeyword< lisp<"
|
||||
au BufRead,BufNewFile *.jl set filetype=julia
|
||||
autocmd BufNewFile,BufRead *.less setf less
|
||||
au BufNewFile,BufRead *.liquid set ft=liquid
|
||||
au BufNewFile,BufRead */_layouts/*.html,*/_includes/*.html set ft=liquid
|
||||
|
||||
@@ -13,12 +13,13 @@ let b:did_ftplugin = 1
|
||||
let b:undo_ftplugin = "setl cms< def< inc< inex< ofu< sua<"
|
||||
|
||||
setlocal iskeyword+=-
|
||||
setlocal commentstring=//\ %s
|
||||
setlocal commentstring=//%s
|
||||
setlocal define=^\\s*\\%(@mixin\\\|=\\)
|
||||
setlocal includeexpr=substitute(v:fname,'\\%(.*/\\\|^\\)\\zs','_','')
|
||||
setlocal omnifunc=csscomplete#CompleteCSS
|
||||
setlocal suffixesadd=.less
|
||||
setlocal comments=s1:/*,mb:*,ex:*/
|
||||
setlocal comments=sO:*\ -,mO:*\ \ ,exO:*/,://
|
||||
setlocal fo=jcroql
|
||||
|
||||
let &l:include = '^\s*@import\s\+\%(url(\)\=["'']\='
|
||||
|
||||
|
||||
198
indent/julia.vim
Normal file
198
indent/julia.vim
Normal file
@@ -0,0 +1,198 @@
|
||||
" Vim indent file
|
||||
" Language: Julia
|
||||
" Maintainer: Carlo Baldassi <carlobaldassi@gmail.com>
|
||||
" Last Change: 2011 dec 11
|
||||
" Notes: based on Bram Moneaar's indent file for vim
|
||||
|
||||
setlocal autoindent
|
||||
|
||||
setlocal indentexpr=GetJuliaIndent()
|
||||
setlocal indentkeys+==end,=else,=catch,=finally
|
||||
setlocal indentkeys-=0#
|
||||
setlocal indentkeys-=:
|
||||
setlocal indentkeys-=0{
|
||||
setlocal indentkeys-=0}
|
||||
setlocal nosmartindent
|
||||
|
||||
" Only define the function once.
|
||||
if exists("*GetJuliaIndent")
|
||||
finish
|
||||
endif
|
||||
|
||||
let s:skipPatterns = '\<julia\%(Comment\)\>'
|
||||
|
||||
function JuliaMatch(lnum, str, regex, st)
|
||||
let s = a:st
|
||||
while 1
|
||||
let f = match(a:str, a:regex, s)
|
||||
if f >= 0
|
||||
let attr = synIDattr(synID(a:lnum,f+1,1),"name")
|
||||
if attr =~ s:skipPatterns
|
||||
let s = f+1
|
||||
continue
|
||||
endif
|
||||
endif
|
||||
break
|
||||
endwhile
|
||||
return f
|
||||
endfunction
|
||||
|
||||
function GetJuliaNestingStruct(lnum)
|
||||
" Auxiliary function to inspect the block structure of a line
|
||||
let line = getline(a:lnum)
|
||||
let s = 0
|
||||
let blocks_stack = []
|
||||
let num_closed_blocks = 0
|
||||
while 1
|
||||
let fb = JuliaMatch(a:lnum, line, '@\@<!\<\%(if\|else\%(if\)\=\|while\|for\|try\|catch\|finally\|function\|macro\|begin\|type\|immutable\|let\|\%(bare\)\?module\|quote\|do\)\>', s)
|
||||
let fe = JuliaMatch(a:lnum, line, '@\@<!\<end\>', s)
|
||||
|
||||
if fb < 0 && fe < 0
|
||||
" No blocks found
|
||||
break
|
||||
end
|
||||
|
||||
if fb >= 0 && (fb < fe || fe < 0)
|
||||
" The first occurrence is an opening block keyword
|
||||
" Note: some keywords (elseif,else,catch,finally) are both
|
||||
" closing blocks and opening new ones
|
||||
|
||||
let i = JuliaMatch(a:lnum, line, '@\@<!\<if\>', s)
|
||||
if i >= 0 && i == fb
|
||||
let s = i+1
|
||||
call add(blocks_stack, 'if')
|
||||
continue
|
||||
endif
|
||||
let i = JuliaMatch(a:lnum, line, '@\@<!\<elseif\>', s)
|
||||
if i >= 0 && i == fb
|
||||
let s = i+1
|
||||
if len(blocks_stack) > 0 && blocks_stack[-1] == 'if'
|
||||
let blocks_stack[-1] = 'elseif'
|
||||
elseif (len(blocks_stack) > 0 && blocks_stack[-1] != 'elseif') || len(blocks_stack) == 0
|
||||
call add(blocks_stack, 'elseif')
|
||||
let num_closed_blocks += 1
|
||||
endif
|
||||
continue
|
||||
endif
|
||||
let i = JuliaMatch(a:lnum, line, '@\@<!\<else\>', s)
|
||||
if i >= 0 && i == fb
|
||||
let s = i+1
|
||||
if len(blocks_stack) > 0 && blocks_stack[-1] =~ '\<\%(else\)\=if\>'
|
||||
let blocks_stack[-1] = 'else'
|
||||
else
|
||||
call add(blocks_stack, 'else')
|
||||
let num_closed_blocks += 1
|
||||
endif
|
||||
continue
|
||||
endif
|
||||
|
||||
let i = JuliaMatch(a:lnum, line, '@\@<!\<try\>', s)
|
||||
if i >= 0 && i == fb
|
||||
let s = i+1
|
||||
call add(blocks_stack, 'try')
|
||||
continue
|
||||
endif
|
||||
let i = JuliaMatch(a:lnum, line, '@\@<!\<catch\>', s)
|
||||
if i >= 0 && i == fb
|
||||
let s = i+1
|
||||
if len(blocks_stack) > 0 && blocks_stack[-1] == 'try'
|
||||
let blocks_stack[-1] = 'catch'
|
||||
else
|
||||
call add(blocks_stack, 'catch')
|
||||
let num_closed_blocks += 1
|
||||
endif
|
||||
continue
|
||||
endif
|
||||
let i = JuliaMatch(a:lnum, line, '@\@<!\<finally\>', s)
|
||||
if i >= 0 && i == fb
|
||||
let s = i+1
|
||||
if len(blocks_stack) > 0 && (blocks_stack[-1] == 'try' || blocks_stack[-1] == 'catch')
|
||||
let blocks_stack[-1] = 'finally'
|
||||
else
|
||||
call add(blocks_stack, 'finally')
|
||||
let num_closed_blocks += 1
|
||||
endif
|
||||
continue
|
||||
endif
|
||||
|
||||
let i = JuliaMatch(a:lnum, line, '@\@<!\<\%(bare\)\?module\>', s)
|
||||
if i >= 0 && i == fb
|
||||
let s = i+1
|
||||
if i == 0
|
||||
call add(blocks_stack, 'col1module')
|
||||
else
|
||||
call add(blocks_stack, 'other')
|
||||
endif
|
||||
continue
|
||||
endif
|
||||
|
||||
let i = JuliaMatch(a:lnum, line, '@\@<!\<\%(while\|for\|function\|macro\|begin\|type\|immutable\|let\|quote\|do\)\>', s)
|
||||
if i >= 0 && i == fb
|
||||
let s = i+1
|
||||
call add(blocks_stack, 'other')
|
||||
continue
|
||||
endif
|
||||
|
||||
" Note: it should be impossible to get here
|
||||
break
|
||||
|
||||
else
|
||||
" The first occurrence is an 'end'
|
||||
|
||||
let s = fe+1
|
||||
if len(blocks_stack) == 0
|
||||
let num_closed_blocks += 1
|
||||
else
|
||||
call remove(blocks_stack, -1)
|
||||
endif
|
||||
continue
|
||||
|
||||
endif
|
||||
|
||||
" Note: it should be impossible to get here
|
||||
break
|
||||
endwhile
|
||||
let num_open_blocks = len(blocks_stack) - count(blocks_stack, 'col1module')
|
||||
return [num_open_blocks, num_closed_blocks]
|
||||
endfunction
|
||||
|
||||
function GetJuliaIndent()
|
||||
let s:save_ignorecase = &ignorecase
|
||||
set noignorecase
|
||||
|
||||
" Find a non-blank line above the current line.
|
||||
let lnum = prevnonblank(v:lnum - 1)
|
||||
|
||||
" At the start of the file use zero indent.
|
||||
if lnum == 0
|
||||
let &ignorecase = s:save_ignorecase
|
||||
unlet s:save_ignorecase
|
||||
return 0
|
||||
endif
|
||||
|
||||
let ind = indent(lnum)
|
||||
|
||||
" Analyse previous line
|
||||
let [num_open_blocks, num_closed_blocks] = GetJuliaNestingStruct(lnum)
|
||||
|
||||
" Increase indentation for each newly opened block
|
||||
" in the previous line
|
||||
while num_open_blocks > 0
|
||||
let ind += &sw
|
||||
let num_open_blocks -= 1
|
||||
endwhile
|
||||
|
||||
" Analyse current line
|
||||
let [num_open_blocks, num_closed_blocks] = GetJuliaNestingStruct(v:lnum)
|
||||
|
||||
" Decrease indentation for each closed block
|
||||
" in the current line
|
||||
while num_closed_blocks > 0
|
||||
let ind -= &sw
|
||||
let num_closed_blocks -= 1
|
||||
endwhile
|
||||
|
||||
let &ignorecase = s:save_ignorecase
|
||||
unlet s:save_ignorecase
|
||||
return ind
|
||||
endfunction
|
||||
@@ -147,7 +147,7 @@ hi def link goEscapeError Error
|
||||
syn cluster goStringGroup contains=goEscapeOctal,goEscapeC,goEscapeX,goEscapeU,goEscapeBigU,goEscapeError
|
||||
syn region goString start=+"+ skip=+\\\\\|\\"+ end=+"+ contains=@goStringGroup
|
||||
syn region goRawString start=+`+ end=+`+
|
||||
syn match goFormatSpecifier /%[#0\-\ \+\*]*[vTtbcdoqxXUeEfgGsp]/ contained containedin=goString
|
||||
syn match goFormatSpecifier /%[-#0 +]*\%(\*\|\d\+\)\=\%(\.\%(\*\|\d\+\)\)*[vTtbcdoqxXUeEfgGsp]/ contained containedin=goString
|
||||
|
||||
hi def link goString String
|
||||
hi def link goRawString String
|
||||
|
||||
@@ -53,7 +53,7 @@ syn region jadePipedText matchgroup=jadePipeChar start="|" end="$" contained co
|
||||
syn match jadeTagBlockChar "\.$" contained nextgroup=jadeTagBlockText,jadeTagBlockEnd skipnl
|
||||
syn region jadeTagBlockText start="\%(\s*\)\S" end="\ze\n" contained contains=jadeInterpolation,jadeTextInlineJade nextgroup=jadeTagBlockText,jadeTagBlockEnd skipnl
|
||||
syn region jadeTagBlockEnd start="\s*\S" end="$" contained contains=jadeInterpolation,jadeTextInlineJade nextgroup=jadeBegin skipnl
|
||||
syn region jadeTextInlineJade matchgroup=jadeInlineDelimiter start="#\[" end="]" contained contains=jadeTag keepend
|
||||
syn region jadeTextInlineJade matchgroup=jadeInlineDelimiter start="#\[" end="]" contains=jadeTag keepend
|
||||
|
||||
syn region jadeJavascriptFilter matchgroup=jadeFilter start="^\z(\s*\):javascript\s*$" end="^\%(\z1\s\|\s*$\)\@!" contains=@htmlJavascript
|
||||
syn region jadeCoffeescriptFilter matchgroup=jadeFilter start="^\z(\s*\):coffeescript\s*$" end="^\%(\z1\s\|\s*$\)\@!" contains=@htmlCoffeescript
|
||||
|
||||
149
syntax/julia.vim
Normal file
149
syntax/julia.vim
Normal file
@@ -0,0 +1,149 @@
|
||||
|
||||
if exists("b:current_syntax")
|
||||
finish
|
||||
endif
|
||||
|
||||
syn case match
|
||||
|
||||
|
||||
syn keyword juliaDirective import importall export using require include
|
||||
|
||||
hi def link juliaDirective Include
|
||||
|
||||
syn region juliaDeclTypeBlock transparent matchgroup=juliaDeclType start="\<\%(type\|immutable\)\>" end="\<end\>" contains=ALL
|
||||
syn keyword juliaTypeAlias typealias
|
||||
syn keyword juliaDeclAbstract abstract
|
||||
|
||||
hi def link juliaDeclType Structure
|
||||
hi def link juliaTypeAlias Typedef
|
||||
hi def link juliaDeclAbstract Structure
|
||||
|
||||
" Module
|
||||
syn region juliaModuleBlock transparent matchgroup=juliaModule start="\<module\>" end="\<end\>" contains=ALL
|
||||
|
||||
hi def link juliaModule Structure
|
||||
|
||||
|
||||
" Misc. blocks
|
||||
syn region juliaMiscBlockBlock transparent matchgroup=juliaMiscBlock start="\<\%(quote\|do\|begin\|let\)\>" end="\<end\>" contains=ALL
|
||||
|
||||
hi def link juliaMiscBlock Repeat
|
||||
|
||||
" Braces and Brackets
|
||||
syn region juliaBracketsBlock matchgroup=juliaBrackets start='\[' end='\]' contains=ALLBUT,juliaRepeatBlock contained
|
||||
syn region juliaBracesBlock matchgroup=juliaBraces start='{' end='}' contains=ALLBUT,juliaRepeatBlock contained
|
||||
|
||||
" Repeat
|
||||
syn region juliaRepeatBlock transparent matchgroup=juliaRepeat start="\<\%(while\|for\)\>" end="\<end\>" contains=@juliaTop
|
||||
|
||||
hi def link juliaRepeat Repeat
|
||||
|
||||
" Conditional
|
||||
syn keyword juliaElse else elseif
|
||||
syn region juliaIfBlock transparent matchgroup=juliaIf start="\<if\>" end="\<end\>" contains=@juliaTop
|
||||
|
||||
hi def link juliaElse Conditional
|
||||
hi def link juliaIf Conditional
|
||||
|
||||
|
||||
" try catch end
|
||||
syn keyword juliaCatch catch contained
|
||||
syn region juliaTryBlock transparent matchgroup=juliaTry start="\<try\>" end="\<end\>" contains=@juliaTop
|
||||
|
||||
hi def link juliaTry Exception
|
||||
hi def link juliaCatch Exception
|
||||
|
||||
|
||||
" one word statements
|
||||
syn keyword juliaStatement return continue break
|
||||
|
||||
hi def link juliaStatement Statement
|
||||
|
||||
" misc
|
||||
syn keyword juliaDeclaration const global local
|
||||
syn keyword juliaComprehensionFor for
|
||||
|
||||
hi def link juliaDeclaration Keyword
|
||||
hi def link juliaComprehensionFor Keyword
|
||||
|
||||
" Built in types
|
||||
syn keyword juliaType Uint Uint8 Uint16 Uint32 Uint64 Uint128
|
||||
syn keyword juliaType Int Int8 Int16 Int32 Int64 Int128
|
||||
syn keyword juliaType Float Float16 Float32 Float64
|
||||
syn keyword juliaType AbstractArray AbstractMatrix AbstractVector Array Vector Matrix
|
||||
syn keyword juliaType String ByteString UTF8String SubString
|
||||
syn keyword juliaType Bool Nothing Union Type
|
||||
|
||||
|
||||
hi def link juliaType Type
|
||||
|
||||
|
||||
" Comments
|
||||
syn keyword juliaTodo contained TODO FIXME XXX
|
||||
syn cluster juliaCommentGroup contains=juliaTodo
|
||||
syn region juliaComment start="#" end="$" contains=@juliaCommentGroup,@Spell
|
||||
|
||||
hi def link juliaComment Comment
|
||||
hi def link juliaTodo Todo
|
||||
|
||||
|
||||
" Strings
|
||||
syn region juliaString start=+"+ skip=+\\\\\|\\"+ end=+"+ contains=@juliaStringGroup,@Spell
|
||||
syn region juliaTripleString start=+"""+ end=+"""+
|
||||
syn region juliaCharacter start=+'+ skip=+\\\\\|\\'+ end=+'+ contains=@juliaCharacterGroup
|
||||
|
||||
hi def link juliaString String
|
||||
hi def link juliaTripleString String
|
||||
hi def link juliaCharacter Character
|
||||
|
||||
|
||||
" Functions
|
||||
syn region juliaFunctionBlock transparent matchgroup=juliaFunction start="\<\%\(function\|macro\)\>" end="\<end\>" contains=@juliaTop
|
||||
hi def link juliaFunction Function
|
||||
|
||||
|
||||
" Numbers
|
||||
syn match juliaNumber "\<\d\+\([Ee]\d\+\)\?\>"
|
||||
syn match juliaNumber "\<0x\x\+\>"
|
||||
syn match juliaNumber "\<0\o\+\>"
|
||||
|
||||
syn match juliaFloat "\<\d\+\.\d*\([Ee][-+]\d\+\)\?\>"
|
||||
syn match juliaFloat "\<\.\d\+\([Ee][-+]\d\+\)\?\>"
|
||||
syn match juliaFloat "\<\d\+[Ee][-+]\d\+\>"
|
||||
syn keyword juliaFloatSpecial NaN Inf
|
||||
|
||||
hi def link juliaNumber Number
|
||||
hi def link juliaFloat Float
|
||||
hi def link juliaFloatSpecial Float
|
||||
|
||||
|
||||
" Operators
|
||||
syn keyword juliaIn in
|
||||
hi def link juliaIn Operator
|
||||
|
||||
|
||||
" Constants
|
||||
syn keyword juliaBool true false nothing
|
||||
hi def link juliaBool Boolean
|
||||
|
||||
syn keyword juliaIdentifierSpecial STDOUT, STDIN, STDERR
|
||||
|
||||
hi def link juliaIdentifierSpecial Identifier
|
||||
|
||||
|
||||
" Macros
|
||||
syn match juliaMacro display "@[_[:alpha:]][_[:alnum:]!]*\%(\.[_[:alpha:]][_[:alnum:]!]*\)*"
|
||||
|
||||
hi def link juliaMacro Macro
|
||||
|
||||
|
||||
syn cluster juliaTop contains=ALLBUT,juliaComprehensionFor
|
||||
|
||||
" Ragel
|
||||
syn include @ragel syntax/ragel.vim
|
||||
syn region ragelLine start="%%" end="$" contains=@ragel
|
||||
|
||||
|
||||
let b:current_syntax = "julia"
|
||||
|
||||
|
||||
164
syntax/ragel.vim
Normal file
164
syntax/ragel.vim
Normal file
@@ -0,0 +1,164 @@
|
||||
" Vim syntax file
|
||||
"
|
||||
" Language: Ragel
|
||||
" Author: Adrian Thurston
|
||||
|
||||
syntax clear
|
||||
|
||||
if !exists("g:ragel_default_subtype")
|
||||
let g:ragel_default_subtype = 'c'
|
||||
endif
|
||||
|
||||
function! <SID>Split(path) abort " {{{1
|
||||
if type(a:path) == type([]) | return a:path | endif
|
||||
let split = split(a:path,'\\\@<!\%(\\\\\)*\zs,')
|
||||
return map(split,'substitute(v:val,''\\\([\\,]\)'',''\1'',"g")')
|
||||
endfunction " }}}1
|
||||
|
||||
fun! <SID>ReadOnPath(script)
|
||||
for dir in <SID>Split(&rtp)
|
||||
let filepath = dir.'/'.a:script
|
||||
if filereadable(filepath)
|
||||
return join(readfile(filepath), " | ")
|
||||
endif
|
||||
endfor
|
||||
endfun
|
||||
|
||||
" Try to detect the subtype. stolen from eruby.vim
|
||||
if !exists("b:ragel_subtype") || b:ragel_subtype == ''
|
||||
" first check for an annotation in the first 5 lines or on the last line
|
||||
let s:lines = getline(1)."\n".getline(2)."\n".getline(3)."\n".getline(4)."\n".getline(5)."\n".getline("$")
|
||||
let b:ragel_subtype = matchstr(s:lines, 'ragel_subtype=\zs\w\+')
|
||||
|
||||
" failing that, check the filename for .*.rl
|
||||
if b:ragel_subtype == ''
|
||||
let b:ragel_subtype = matchstr(substitute(expand("%:t"),'\c\%(\.rl\|\.ragel\)\+$','',''),'\.\zs\w\+$')
|
||||
|
||||
" ...and do a couple of transformations if necessary
|
||||
|
||||
" .rb -> ruby
|
||||
if b:ragel_subtype == 'rb'
|
||||
let b:ragel_subtype = 'ruby'
|
||||
|
||||
" .m -> objc
|
||||
elseif b:ragel_subtype == 'm'
|
||||
let b:ragel_subtype = 'objc'
|
||||
|
||||
" .cxx -> cpp
|
||||
elseif b:ragel_subtype == 'cxx'
|
||||
let b:ragel_subtype = 'cpp'
|
||||
endif
|
||||
endif
|
||||
|
||||
" default to g:ragel_default_subtype
|
||||
if b:ragel_subtype == ''
|
||||
let b:ragel_subtype = g:ragel_default_subtype
|
||||
endif
|
||||
endif
|
||||
|
||||
if exists('b:ragel_subtype') && b:ragel_subtype != ''
|
||||
exec 'runtime! syntax/'.b:ragel_subtype.'.vim'
|
||||
" source s:subtype_file
|
||||
unlet! b:current_syntax
|
||||
endif
|
||||
|
||||
" Identifiers
|
||||
syntax match anyId "[a-zA-Z_][a-zA-Z_0-9]*" contained
|
||||
|
||||
" Inline code only
|
||||
syntax keyword fsmType fpc fc fcurs fbuf fblen ftargs fstack contained
|
||||
syntax keyword fsmKeyword fhold fgoto fcall fret fentry fnext fexec fbreak contained
|
||||
|
||||
syntax cluster rlItems contains=rlComment,rlLiteral,rlAugmentOps,rlOtherOps,rlKeywords,rlWrite,rlCodeCurly,rlCodeSemi,rlNumber,anyId,rlLabelColon,rlExprKeywords
|
||||
|
||||
syntax region machineSpec1 matchgroup=beginRL start="%%{" end="}%%" contains=@rlItems
|
||||
syntax region machineSpec2 matchgroup=beginRL start="%%[^{]"rs=e-1 end="$" keepend contains=@rlItems
|
||||
syntax region machineSpec2 matchgroup=beginRL start="%%$" end="$" keepend contains=@rlItems
|
||||
|
||||
" Comments
|
||||
syntax match rlComment "#.*$" contained
|
||||
|
||||
" Literals
|
||||
" single quoted strings '...'
|
||||
syntax match rlLiteral "'\(\\.\|[^'\\]\)*'[i]*" contained
|
||||
" double quoted strings "..."
|
||||
syntax match rlLiteral "\"\(\\.\|[^\"\\]\)*\"[i]*" contained
|
||||
" simple regexes /.../
|
||||
syntax match rlLiteral /\/\(\\.\|[^\/\\]\)*\/[i]*/ contained
|
||||
" char unions [...]
|
||||
syntax match rlLiteral "\[\(\\.\|[^\]\\]\)*\]" contained
|
||||
|
||||
" Numbers
|
||||
syntax match rlNumber "[0-9][0-9]*" contained
|
||||
syntax match rlNumber "0x[0-9a-fA-F][0-9a-fA-F]*" contained
|
||||
|
||||
" Operators
|
||||
syntax match rlAugmentOps "[>$%@]" contained
|
||||
syntax match rlAugmentOps "<>\|<" contained
|
||||
syntax match rlAugmentOps "[>\<$%@][!\^/*~]" contained
|
||||
syntax match rlAugmentOps "[>$%]?" contained
|
||||
syntax match rlAugmentOps "<>[!\^/*~]" contained
|
||||
syntax match rlAugmentOps "=>" contained
|
||||
syntax match rlOtherOps "->" contained
|
||||
|
||||
syntax match rlOtherOps ":>" contained
|
||||
syntax match rlOtherOps ":>>" contained
|
||||
syntax match rlOtherOps "<:" contained
|
||||
|
||||
" Keywords
|
||||
" FIXME: Enable the range keyword post 5.17.
|
||||
" syntax keyword rlKeywords machine action context include range contained
|
||||
syntax keyword rlKeywords machine action context include import export prepush postpop contained
|
||||
syntax keyword rlExprKeywords when inwhen outwhen err lerr eof from to contained
|
||||
|
||||
" Case Labels
|
||||
syntax keyword caseLabelKeyword case contained
|
||||
syntax cluster caseLabelItems contains=caseLabelKeyword,anyId,fsmType,fsmKeyword
|
||||
syntax match caseLabelColon "case" contains=@caseLabelItems contained
|
||||
syntax match caseLabelColon "case[\t ]\+.*:$" contains=@caseLabelItems contained
|
||||
syntax match caseLabelColon "case[\t ]\+.*:[^=:]"me=e-1 contains=@caseLabelItems contained
|
||||
|
||||
syntax match rlLabelColon "[a-zA-Z_][a-zA-Z_0-9]*[ \t]*:$" contained contains=anyLabel
|
||||
syntax match rlLabelColon "[a-zA-Z_][a-zA-Z_0-9]*[ \t]*:[^=:>]"me=e-1 contained contains=anyLabel
|
||||
syntax match anyLabel "[a-zA-Z_][a-zA-Z_0-9]*" contained
|
||||
|
||||
" All items that can go in a code block.
|
||||
|
||||
syntax cluster inlineItems contains=TOP add=anyId,fsmType,fsmKeyword,caseLabelColon
|
||||
|
||||
" Blocks of code. rlCodeCurly is recursive.
|
||||
syntax region rlCodeCurly matchgroup=NONE start="{" end="}" keepend contained contains=TOP
|
||||
syntax region rlCodeSemi matchgroup=Type start="\<alphtype\>" start="\<getkey\>" start="\<access\>" start="\<variable\>" matchgroup=NONE end=";" contained contains=@inlineItems
|
||||
|
||||
syntax region rlWrite matchgroup=Type start="\<write\>" matchgroup=NONE end="[;)]" contained contains=rlWriteKeywords,rlWriteOptions
|
||||
|
||||
syntax keyword rlWriteKeywords init data exec exports start error first_final contained
|
||||
syntax keyword rlWriteOptions noerror nofinal noprefix noend nocs contained
|
||||
|
||||
"
|
||||
" Sync at the start of machine specs.
|
||||
"
|
||||
" Match The ragel delimiters only if there quotes no ahead on the same line.
|
||||
" On the open marker, use & to consume the leader.
|
||||
syntax sync match ragelSyncPat grouphere NONE "^[^\'\"%]*%%{&^[^\'\"%]*"
|
||||
syntax sync match ragelSyncPat grouphere NONE "^[^\'\"%]*%%[^{]&^[^\'\"%]*"
|
||||
syntax sync match ragelSyncPat grouphere NONE "^[^\'\"]*}%%"
|
||||
|
||||
"
|
||||
" Specifying Groups
|
||||
"
|
||||
hi link rlComment Comment
|
||||
hi link rlNumber Number
|
||||
hi link rlLiteral String
|
||||
hi link rlAugmentOps Keyword
|
||||
hi link rlExprKeywords Keyword
|
||||
hi link rlWriteKeywords Keyword
|
||||
hi link rlWriteOptions Keyword
|
||||
hi link rlKeywords Type
|
||||
hi link fsmType Type
|
||||
hi link fsmKeyword Keyword
|
||||
hi link anyLabel Label
|
||||
hi link caseLabelKeyword Keyword
|
||||
hi link beginRL Type
|
||||
|
||||
let b:current_syntax = "ragel"
|
||||
@@ -30,7 +30,7 @@ hi link shebang Comment
|
||||
"" typescript comments"{{{
|
||||
syn keyword typescriptCommentTodo TODO FIXME XXX TBD contained
|
||||
syn match typescriptLineComment "\/\/.*" contains=@Spell,typescriptCommentTodo,typescriptRef
|
||||
syn match typescriptRef /\/\/\/<reference\s\+.*\/>$/ contains=typescriptRefD,typescriptRefS
|
||||
syn match typescriptRefComment /\/\/\/<\(reference\|amd-\(dependency\|module\)\)\s\+.*\/>$/ contains=typescriptRefD,typescriptRefS
|
||||
syn region typescriptRefD start=+"+ skip=+\\\\\|\\"+ end=+"\|$+
|
||||
syn region typescriptRefS start=+'+ skip=+\\\\\|\\'+ end=+'\|$+
|
||||
|
||||
@@ -99,8 +99,8 @@ syntax keyword typescriptEventListenerKeywords contained blur click focus mouseo
|
||||
syntax keyword typescriptEventListenerMethods contained scrollIntoView addEventListener dispatchEvent removeEventListener preventDefault stopPropagation
|
||||
" }}}
|
||||
"" Programm Keywords"{{{
|
||||
syntax keyword typescriptSource import export
|
||||
syntax keyword typescriptIdentifier arguments this let var void yield
|
||||
syntax keyword typescriptSource import export from as
|
||||
syntax keyword typescriptIdentifier arguments this let var void yield const
|
||||
syntax keyword typescriptOperator delete new instanceof typeof
|
||||
syntax keyword typescriptBoolean true false
|
||||
syntax keyword typescriptNull null undefined
|
||||
@@ -110,7 +110,7 @@ syntax keyword typescriptDeprecated escape unescape all applets alinkColor bgCol
|
||||
"}}}
|
||||
"" Statement Keywords"{{{
|
||||
syntax keyword typescriptConditional if else switch
|
||||
syntax keyword typescriptRepeat do while for in
|
||||
syntax keyword typescriptRepeat do while for in of
|
||||
syntax keyword typescriptBranch break continue
|
||||
syntax keyword typescriptLabel case default
|
||||
syntax keyword typescriptStatement return with
|
||||
@@ -119,7 +119,7 @@ syntax keyword typescriptGlobalObjects Array Boolean Date Function Infinity Math
|
||||
|
||||
syntax keyword typescriptExceptions try catch throw finally Error EvalError RangeError ReferenceError SyntaxError TypeError URIError
|
||||
|
||||
syntax keyword typescriptReserved constructor declare as interface module abstract enum int short export interface static byte extends long super char final native synchronized class float package throws const goto private transient debugger implements protected volatile double import public type
|
||||
syntax keyword typescriptReserved constructor declare as interface module abstract enum int short export interface static byte extends long super char final native synchronized class float package throws const goto private transient debugger implements protected volatile double import public type namespace from
|
||||
"}}}
|
||||
"" typescript/DOM/HTML/CSS specified things"{{{
|
||||
|
||||
@@ -202,9 +202,11 @@ syn match typescriptLogicSymbols "\(&&\)\|\(||\)"
|
||||
" typescriptFold Function {{{
|
||||
|
||||
" function! typescriptFold()
|
||||
syn region foldBraces start=/{/ end=/}/ transparent fold keepend extend
|
||||
|
||||
setl foldtext=FoldText()
|
||||
" skip curly braces inside RegEx's and comments
|
||||
syn region foldBraces start=/{/ skip=/\(\/\/.*\)\|\(\/.*\/\)/ end=/}/ transparent fold keepend extend
|
||||
|
||||
" setl foldtext=FoldText()
|
||||
" endfunction
|
||||
|
||||
" au FileType typescript call typescriptFold()
|
||||
@@ -233,7 +235,7 @@ if version >= 508 || !exists("did_typescript_syn_inits")
|
||||
HiLink typescriptParens Operator
|
||||
HiLink typescriptComment Comment
|
||||
HiLink typescriptLineComment Comment
|
||||
HiLink typescriptRef Include
|
||||
HiLink typescriptRefComment Include
|
||||
HiLink typescriptRefS String
|
||||
HiLink typescriptRefD String
|
||||
HiLink typescriptDocComment Comment
|
||||
|
||||
Reference in New Issue
Block a user