mirror of
https://github.com/sheerun/vim-polyglot.git
synced 2025-11-08 11:33:52 -05:00
Compare commits
9 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
30c87b73de | ||
|
|
1713d35f06 | ||
|
|
5ddfa1ac28 | ||
|
|
dbe9bc927f | ||
|
|
d219055bc8 | ||
|
|
0e9041f29a | ||
|
|
a0b8a6e77f | ||
|
|
a61ab44810 | ||
|
|
dd4b5cbdd6 |
10
README.md
10
README.md
@@ -8,13 +8,13 @@ A collection of language packs for Vim.
|
||||
> One to rule them all, one to find them, one to bring them all and in the darkness bind them.
|
||||
|
||||
- It **won't affect your startup time**, as scripts are loaded only on demand\*.
|
||||
- It **installs and updates 100+ times faster** than 100+ packages it consist of.
|
||||
- Solid syntax and indentation support. Only the best language packs.
|
||||
- It **installs and updates 100+ times faster** than 100+ packages it consists of.
|
||||
- Solid syntax and indentation support (other features skipped). Only the best language packs.
|
||||
- All unnecessary files are ignored (like enormous documentation from php support).
|
||||
- No support for esoteric languages, only most popular ones (modern too, like `slim`).
|
||||
- Each build is tested by automated vimrunner script on CI. See `spec` directory.
|
||||
|
||||
\*To be completely honest, concatenated `ftdetect` script takes around `3ms` to load.
|
||||
\*To be completely honest, concatenated `ftdetect` script takes up to `17ms` to load.
|
||||
|
||||
## Installation
|
||||
|
||||
@@ -48,6 +48,7 @@ If you need full functionality of any plugin, please use it directly with your p
|
||||
- [caddyfile](https://github.com/isobit/vim-caddyfile) (syntax, indent, ftplugin)
|
||||
- [cjsx](https://github.com/mtscout6/vim-cjsx) (syntax, ftplugin)
|
||||
- [clojure](https://github.com/guns/vim-clojure-static) (syntax, indent, autoload, ftplugin)
|
||||
- [cmake](https://github.com/pboettch/vim-cmake-syntax) (syntax, indent)
|
||||
- [coffee-script](https://github.com/kchmck/vim-coffee-script) (syntax, indent, compiler, autoload, ftplugin)
|
||||
- [cql](https://github.com/elubow/cql-vim) (syntax)
|
||||
- [cryptol](https://github.com/victoredwardocallaghan/cryptol.vim) (syntax, compiler, ftplugin)
|
||||
@@ -92,12 +93,11 @@ If you need full functionality of any plugin, please use it directly with your p
|
||||
- [mathematica](https://github.com/rsmenon/vim-mathematica) (syntax, ftplugin)
|
||||
- [nginx](https://github.com/chr4/nginx.vim) (syntax, indent, ftplugin)
|
||||
- [nim](https://github.com/zah/nim.vim) (syntax, compiler, indent)
|
||||
- [nix](https://github.com/spwhitt/vim-nix) (syntax, ftplugin)
|
||||
- [nix](https://github.com/LnL7/vim-nix) (syntax, indent, ftplugin)
|
||||
- [objc](https://github.com/b4winckler/vim-objc) (ftplugin, syntax, indent)
|
||||
- [ocaml](https://github.com/jrk/vim-ocaml) (syntax, indent, ftplugin)
|
||||
- [octave](https://github.com/vim-scripts/octave.vim--) (syntax)
|
||||
- [opencl](https://github.com/petRUShka/vim-opencl) (syntax, indent, ftplugin)
|
||||
- [openscad](https://github.com/sirtaj/vim-openscad) (syntax, ftplugin)
|
||||
- [perl](https://github.com/vim-perl/vim-perl) (syntax, indent, ftplugin)
|
||||
- [pgsql](https://github.com/exu/pgsql.vim) (syntax)
|
||||
- [php](https://github.com/StanAngeloff/php.vim) (syntax)
|
||||
|
||||
@@ -39,6 +39,8 @@ function! TerraformFolds()
|
||||
return ">1"
|
||||
elseif match(thisline, '^terraform') >= 0
|
||||
return ">1"
|
||||
elseif match(thisline, '^locals') >= 0
|
||||
return ">1"
|
||||
else
|
||||
return "="
|
||||
endif
|
||||
|
||||
@@ -49,7 +49,7 @@ syn region jsxChild contained start=+{+ end=++ contains=jsBlock,javascriptBlock
|
||||
" and generic Flow type annotations (http://flowtype.org/).
|
||||
syn region jsxRegion
|
||||
\ contains=@Spell,@XMLSyntax,jsxRegion,jsxChild,jsBlock,javascriptBlock
|
||||
\ start=+\%(<\|\w\)\@<!<\z([a-zA-Z][a-zA-Z0-9:\-.]*\)+
|
||||
\ start=+\%(<\|\w\)\@<!<\z([a-zA-Z][a-zA-Z0-9:\-.]*\>[:,]\@!\)\([^>]*>(\)\@!+
|
||||
\ skip=+<!--\_.\{-}-->+
|
||||
\ end=+</\z1\_\s\{-}>+
|
||||
\ end=+/>+
|
||||
|
||||
4
build
4
build
@@ -120,6 +120,7 @@ PACKS="
|
||||
caddyfile:isobit/vim-caddyfile
|
||||
cjsx:mtscout6/vim-cjsx
|
||||
clojure:guns/vim-clojure-static
|
||||
cmake:pboettch/vim-cmake-syntax
|
||||
coffee-script:kchmck/vim-coffee-script
|
||||
cryptol:victoredwardocallaghan/cryptol.vim
|
||||
crystal:rhysd/vim-crystal
|
||||
@@ -136,7 +137,6 @@ PACKS="
|
||||
fsharp:fsharp/vim-fsharp:_BASIC
|
||||
git:tpope/vim-git
|
||||
gmpl:maelvalais/gmpl.vim
|
||||
openscad:sirtaj/vim-openscad
|
||||
glsl:tikhomirov/vim-glsl
|
||||
gnuplot:vim-scripts/gnuplot-syntax-highlighting
|
||||
go:fatih/vim-go:_BASIC
|
||||
@@ -165,7 +165,7 @@ PACKS="
|
||||
mathematica:rsmenon/vim-mathematica
|
||||
nginx:chr4/nginx.vim
|
||||
nim:zah/nim.vim:_BASIC
|
||||
nix:spwhitt/vim-nix
|
||||
nix:LnL7/vim-nix
|
||||
objc:b4winckler/vim-objc
|
||||
ocaml:jrk/vim-ocaml
|
||||
octave:vim-scripts/octave.vim--
|
||||
|
||||
@@ -6,10 +6,10 @@ if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'go') == -1
|
||||
"
|
||||
" compiler/go.vim: Vim compiler file for Go.
|
||||
|
||||
if exists("current_compiler")
|
||||
if exists("g:current_compiler")
|
||||
finish
|
||||
endif
|
||||
let current_compiler = "go"
|
||||
let g:current_compiler = "go"
|
||||
|
||||
if exists(":CompilerSet") != 2
|
||||
command -nargs=* CompilerSet setlocal <args>
|
||||
|
||||
@@ -9,3 +9,7 @@ if !exists('g:vim_json_syntax_conceal')
|
||||
endif
|
||||
|
||||
let g:filetype_euphoria = 'elixir'
|
||||
|
||||
augroup filetypedetect
|
||||
autocmd BufNewFile,BufReadPost *.vb setlocal filetype=vbnet
|
||||
augroup END
|
||||
|
||||
@@ -9,6 +9,10 @@ if !exists('g:vim_json_syntax_conceal')
|
||||
endif
|
||||
|
||||
let g:filetype_euphoria = 'elixir'
|
||||
|
||||
augroup filetypedetect
|
||||
autocmd BufNewFile,BufReadPost *.vb setlocal filetype=vbnet
|
||||
augroup END
|
||||
augroup filetypedetect
|
||||
" apiblueprint:sheerun/apiblueprint.vim
|
||||
autocmd BufReadPost,BufNewFile *.apib set filetype=apiblueprint
|
||||
@@ -91,6 +95,10 @@ augroup filetypedetect
|
||||
autocmd BufNewFile,BufRead *.clj,*.cljs,*.edn,*.cljx,*.cljc,{build,profile}.boot setlocal filetype=clojure
|
||||
augroup END
|
||||
|
||||
augroup filetypedetect
|
||||
" cmake:pboettch/vim-cmake-syntax
|
||||
augroup END
|
||||
|
||||
augroup filetypedetect
|
||||
" coffee-script:kchmck/vim-coffee-script
|
||||
" Language: CoffeeScript
|
||||
@@ -295,12 +303,6 @@ augroup filetypedetect
|
||||
au BufRead,BufNewFile *.mod set filetype=gmpl
|
||||
augroup END
|
||||
|
||||
augroup filetypedetect
|
||||
" openscad:sirtaj/vim-openscad
|
||||
au BufRead,BufNewFile *.scad setfiletype openscad
|
||||
an 50.80.265 &Syntax.NO.OpenSCAD :cal SetSyn("openscad")<CR>
|
||||
augroup END
|
||||
|
||||
augroup filetypedetect
|
||||
" glsl:tikhomirov/vim-glsl
|
||||
" Language: OpenGL Shading Language
|
||||
@@ -339,15 +341,18 @@ function! s:gofiletype_post()
|
||||
let &g:fileencodings = s:current_fileencodings
|
||||
endfunction
|
||||
|
||||
au BufNewFile *.go setfiletype go | setlocal fileencoding=utf-8 fileformat=unix
|
||||
au BufRead *.go call s:gofiletype_pre("go")
|
||||
au BufReadPost *.go call s:gofiletype_post()
|
||||
augroup vim-go-filetype
|
||||
autocmd!
|
||||
au BufNewFile *.go setfiletype go | setlocal fileencoding=utf-8 fileformat=unix
|
||||
au BufRead *.go call s:gofiletype_pre("go")
|
||||
au BufReadPost *.go call s:gofiletype_post()
|
||||
|
||||
au BufNewFile *.s setfiletype asm | setlocal fileencoding=utf-8 fileformat=unix
|
||||
au BufRead *.s call s:gofiletype_pre("asm")
|
||||
au BufReadPost *.s call s:gofiletype_post()
|
||||
au BufNewFile *.s setfiletype asm | setlocal fileencoding=utf-8 fileformat=unix
|
||||
au BufRead *.s call s:gofiletype_pre("asm")
|
||||
au BufReadPost *.s call s:gofiletype_post()
|
||||
|
||||
au BufRead,BufNewFile *.tmpl set filetype=gohtmltmpl
|
||||
au BufRead,BufNewFile *.tmpl set filetype=gohtmltmpl
|
||||
augroup end
|
||||
|
||||
" vim: sw=2 ts=2 et
|
||||
augroup END
|
||||
@@ -588,8 +593,14 @@ au BufNewFile,BufRead *.nim,*.nims set filetype=nim
|
||||
augroup END
|
||||
|
||||
augroup filetypedetect
|
||||
" nix:spwhitt/vim-nix
|
||||
autocmd BufNewFile,BufRead *.nix setfiletype nix
|
||||
" nix:LnL7/vim-nix
|
||||
" Vim filetype detect
|
||||
" Language: Nix
|
||||
" Maintainer: Daiderd Jordan <daiderd@gmail.com>
|
||||
" URL: https://github.com/LnL7/vim-nix
|
||||
|
||||
au BufRead,BufNewFile *.nix set filetype=nix
|
||||
au FileType nix setl sw=2 sts=2 et iskeyword+=-
|
||||
augroup END
|
||||
|
||||
augroup filetypedetect
|
||||
@@ -919,7 +930,7 @@ fun! s:DetectScala()
|
||||
endif
|
||||
endfun
|
||||
|
||||
au BufRead,BufNewFile *.scala set filetype=scala
|
||||
au BufRead,BufNewFile *.scala,*.sc set filetype=scala
|
||||
au BufRead,BufNewFile * call s:DetectScala()
|
||||
|
||||
" Install vim-sbt for additional syntax highlighting.
|
||||
@@ -1021,8 +1032,8 @@ augroup END
|
||||
|
||||
augroup filetypedetect
|
||||
" toml:cespare/vim-toml
|
||||
" Rust uses several TOML config files that are not named with .toml.
|
||||
autocmd BufNewFile,BufRead *.toml,Cargo.lock,*/.cargo/config set filetype=toml
|
||||
" Go dep and Rust use several TOML config files that are not named with .toml.
|
||||
autocmd BufNewFile,BufRead *.toml,Gopkg.lock,Cargo.lock,*/.cargo/config set filetype=toml
|
||||
augroup END
|
||||
|
||||
augroup filetypedetect
|
||||
|
||||
@@ -1,17 +1,17 @@
|
||||
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'nix') == -1
|
||||
|
||||
if exists("b:did_ftplugin")
|
||||
finish
|
||||
endif
|
||||
let b:did_ftplugin=1
|
||||
" Vim filetype plugin
|
||||
" Language: Nix
|
||||
" Maintainer: Daiderd Jordan <daiderd@gmail.com>
|
||||
" URL: https://github.com/LnL7/vim-nix
|
||||
|
||||
setlocal comments=
|
||||
if (exists("b:did_ftplugin"))
|
||||
finish
|
||||
endif
|
||||
let b:did_ftplugin = 1
|
||||
|
||||
|
||||
setlocal comments=:#
|
||||
setlocal commentstring=#\ %s
|
||||
|
||||
" Nixpkgs indent settings
|
||||
setlocal tabstop=2
|
||||
setlocal softtabstop=2
|
||||
setlocal shiftwidth=2
|
||||
setlocal expandtab
|
||||
|
||||
endif
|
||||
|
||||
@@ -1,18 +0,0 @@
|
||||
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'openscad') == -1
|
||||
|
||||
" Blatantly stolen from vim74\ftplugin\c.vim
|
||||
|
||||
" Set 'formatoptions' to break comment lines but not other lines,
|
||||
" and insert the comment leader when hitting <CR> or using "o".
|
||||
setlocal fo-=t fo+=croql
|
||||
|
||||
" Set 'comments' to format dashed lists in comments.
|
||||
setlocal comments=sO:*\ -,mO:*\ \ ,exO:*/,s1:/*,mb:*,ex:*/,://
|
||||
|
||||
" Win32 can filter files in the browse dialog
|
||||
if (has("gui_win32") || has("gui_gtk")) && !exists("b:browsefilter")
|
||||
let b:browsefilter = "OpenSCAD Source Files (*.scad)\t*.scad\n" .
|
||||
\ "All Files (*.*)\t*.*\n"
|
||||
endif
|
||||
|
||||
endif
|
||||
@@ -15,7 +15,7 @@ setlocal commentstring=//\ %s
|
||||
" " and insert the comment leader when hitting <CR> or using "o".
|
||||
setlocal formatoptions-=t formatoptions+=croql
|
||||
|
||||
setlocal suffixesadd+=.ts
|
||||
setlocal suffixesadd+=.ts,.tsx
|
||||
|
||||
let b:undo_ftplugin = "setl fo< ofu< com< cms<"
|
||||
|
||||
|
||||
@@ -19,7 +19,7 @@ let b:did_indent = 1
|
||||
|
||||
" Doesn't include 'foreach' and 'forelse' because these already get matched by 'for'.
|
||||
let s:directives_start = 'if\|else\|unless\|for\|while\|empty\|push\|section\|can\|hasSection\|verbatim\|php\|' .
|
||||
\ 'component\|slot\|prepend'
|
||||
\ 'component\|slot\|prepend\|auth\|guest'
|
||||
let s:directives_end = 'else\|end\|empty\|show\|stop\|append\|overwrite'
|
||||
|
||||
if exists('g:blade_custom_directives_pairs')
|
||||
|
||||
@@ -192,11 +192,7 @@ if exists("*searchpairpos")
|
||||
" Check if form is a reader conditional, that is, it is prefixed by #?
|
||||
" or @#?
|
||||
function! s:is_reader_conditional_special_case(position)
|
||||
if getline(a:position[0])[a:position[1] - 3 : a:position[1] - 2] == "#?"
|
||||
return 1
|
||||
endif
|
||||
|
||||
return 0
|
||||
return getline(a:position[0])[a:position[1] - 3 : a:position[1] - 2] == "#?"
|
||||
endfunction
|
||||
|
||||
" Returns 1 for opening brackets, -1 for _anything else_.
|
||||
@@ -294,6 +290,19 @@ if exists("*searchpairpos")
|
||||
return paren
|
||||
endif
|
||||
|
||||
" If the keyword begins with #, check if it is an anonymous
|
||||
" function or set, in which case we indent by the shiftwidth
|
||||
" (minus one if g:clojure_align_subforms = 1), or if it is
|
||||
" ignored, in which case we use the ( position for indent.
|
||||
if w[0] == "#"
|
||||
" TODO: Handle #=() and other rare reader invocations?
|
||||
if w[1] == '(' || w[1] == '{'
|
||||
return [paren[0], paren[1] + (g:clojure_align_subforms ? 0 : &shiftwidth - 1)]
|
||||
elseif w[1] == '_'
|
||||
return paren
|
||||
endif
|
||||
endif
|
||||
|
||||
" Test words without namespace qualifiers and leading reader macro
|
||||
" metacharacters.
|
||||
"
|
||||
|
||||
93
indent/cmake.vim
Normal file
93
indent/cmake.vim
Normal file
@@ -0,0 +1,93 @@
|
||||
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'cmake') == -1
|
||||
|
||||
" Vim indent file
|
||||
" Language: CMake (ft=cmake)
|
||||
" Author: Andy Cedilnik <andy.cedilnik@kitware.com>
|
||||
" Maintainer: Dimitri Merejkowsky <d.merej@gmail.com>
|
||||
" Former Maintainer: Karthik Krishnan <karthik.krishnan@kitware.com>
|
||||
" Last Change: 2017 Aug 30
|
||||
"
|
||||
" Licence: The CMake license applies to this file. See
|
||||
" https://cmake.org/licensing
|
||||
" This implies that distribution with Vim is allowed
|
||||
|
||||
if exists("b:did_indent")
|
||||
finish
|
||||
endif
|
||||
let b:did_indent = 1
|
||||
|
||||
let s:keepcpo= &cpo
|
||||
set cpo&vim
|
||||
|
||||
setlocal indentexpr=CMakeGetIndent(v:lnum)
|
||||
setlocal indentkeys+==ENDIF(,ENDFOREACH(,ENDMACRO(,ELSE(,ELSEIF(,ENDWHILE(
|
||||
|
||||
" Only define the function once.
|
||||
if exists("*CMakeGetIndent")
|
||||
finish
|
||||
endif
|
||||
|
||||
fun! CMakeGetIndent(lnum)
|
||||
let this_line = getline(a:lnum)
|
||||
|
||||
" Find a non-blank line above the current line.
|
||||
let lnum = a:lnum
|
||||
let lnum = prevnonblank(lnum - 1)
|
||||
let previous_line = getline(lnum)
|
||||
|
||||
" Hit the start of the file, use zero indent.
|
||||
if lnum == 0
|
||||
return 0
|
||||
endif
|
||||
|
||||
let ind = indent(lnum)
|
||||
|
||||
let or = '\|'
|
||||
" Regular expressions used by line indentation function.
|
||||
let cmake_regex_comment = '#.*'
|
||||
let cmake_regex_identifier = '[A-Za-z][A-Za-z0-9_]*'
|
||||
let cmake_regex_quoted = '"\([^"\\]\|\\.\)*"'
|
||||
let cmake_regex_arguments = '\(' . cmake_regex_quoted .
|
||||
\ or . '\$(' . cmake_regex_identifier . ')' .
|
||||
\ or . '[^()\\#"]' . or . '\\.' . '\)*'
|
||||
|
||||
let cmake_indent_comment_line = '^\s*' . cmake_regex_comment
|
||||
let cmake_indent_blank_regex = '^\s*$'
|
||||
let cmake_indent_open_regex = '^\s*' . cmake_regex_identifier .
|
||||
\ '\s*(' . cmake_regex_arguments .
|
||||
\ '\(' . cmake_regex_comment . '\)\?$'
|
||||
|
||||
let cmake_indent_close_regex = '^' . cmake_regex_arguments .
|
||||
\ ')\s*' .
|
||||
\ '\(' . cmake_regex_comment . '\)\?$'
|
||||
|
||||
let cmake_indent_begin_regex = '^\s*\(IF\|MACRO\|FOREACH\|ELSE\|ELSEIF\|WHILE\|FUNCTION\)\s*('
|
||||
let cmake_indent_end_regex = '^\s*\(ENDIF\|ENDFOREACH\|ENDMACRO\|ELSE\|ELSEIF\|ENDWHILE\|ENDFUNCTION\)\s*('
|
||||
|
||||
" Add
|
||||
if previous_line =~? cmake_indent_comment_line " Handle comments
|
||||
let ind = ind
|
||||
else
|
||||
if previous_line =~? cmake_indent_begin_regex
|
||||
let ind = ind + shiftwidth()
|
||||
endif
|
||||
if previous_line =~? cmake_indent_open_regex
|
||||
let ind = ind + shiftwidth()
|
||||
endif
|
||||
endif
|
||||
|
||||
" Subtract
|
||||
if this_line =~? cmake_indent_end_regex
|
||||
let ind = ind - shiftwidth()
|
||||
endif
|
||||
if previous_line =~? cmake_indent_close_regex
|
||||
let ind = ind - shiftwidth()
|
||||
endif
|
||||
|
||||
return ind
|
||||
endfun
|
||||
|
||||
let &cpo = s:keepcpo
|
||||
unlet s:keepcpo
|
||||
|
||||
endif
|
||||
@@ -8,6 +8,7 @@ if exists("b:did_indent")
|
||||
endif
|
||||
|
||||
setlocal autoindent cindent
|
||||
setlocal formatoptions+=roq
|
||||
|
||||
" vim:set sts=2 sw=2 :
|
||||
|
||||
|
||||
@@ -12,10 +12,6 @@ if exists('b:did_indent')
|
||||
endif
|
||||
let b:did_indent = 1
|
||||
|
||||
" indent correctly if inside <script>
|
||||
" vim/vim@690afe1 for the switch from cindent
|
||||
let b:html_indent_script1 = 'inc'
|
||||
|
||||
" Now, set up our indentation expression and keys that trigger it.
|
||||
setlocal indentexpr=GetJavascriptIndent()
|
||||
setlocal autoindent nolisp nosmartindent
|
||||
@@ -27,13 +23,6 @@ setlocal indentkeys+=0],0)
|
||||
|
||||
let b:undo_indent = 'setlocal indentexpr< smartindent< autoindent< indentkeys<'
|
||||
|
||||
" Regex of syntax group names that are or delimit string or are comments.
|
||||
let b:syng_strcom = get(b:,'syng_strcom','string\|comment\|regex\|special\|doc\|template\%(braces\)\@!')
|
||||
let b:syng_str = get(b:,'syng_str','string\|template\|special')
|
||||
" template strings may want to be excluded when editing graphql:
|
||||
" au! Filetype javascript let b:syng_str = '^\%(.*template\)\@!.*string\|special'
|
||||
" au! Filetype javascript let b:syng_strcom = '^\%(.*template\)\@!.*string\|comment\|regex\|special\|doc'
|
||||
|
||||
" Only define the function once.
|
||||
if exists('*GetJavascriptIndent')
|
||||
finish
|
||||
@@ -42,6 +31,23 @@ endif
|
||||
let s:cpo_save = &cpo
|
||||
set cpo&vim
|
||||
|
||||
" indent correctly if inside <script>
|
||||
" vim/vim@690afe1 for the switch from cindent
|
||||
" overridden with b:html_indent_script1
|
||||
call extend(g:,{'html_indent_script1': 'inc'},'keep')
|
||||
|
||||
" Regex of syntax group names that are or delimit string or are comments.
|
||||
let s:bvars = {
|
||||
\ 'syng_strcom': 'string\|comment\|regex\|special\|doc\|template\%(braces\)\@!',
|
||||
\ 'syng_str': 'string\|template\|special' }
|
||||
" template strings may want to be excluded when editing graphql:
|
||||
" au! Filetype javascript let b:syng_str = '^\%(.*template\)\@!.*string\|special'
|
||||
" au! Filetype javascript let b:syng_strcom = '^\%(.*template\)\@!.*string\|comment\|regex\|special\|doc'
|
||||
|
||||
function s:GetVars()
|
||||
call extend(b:,extend(s:bvars,{'js_cache': [0,0,0]}),'keep')
|
||||
endfunction
|
||||
|
||||
" Get shiftwidth value
|
||||
if exists('*shiftwidth')
|
||||
function s:sw()
|
||||
@@ -106,9 +112,7 @@ endfunction
|
||||
function s:SkipFunc()
|
||||
if s:top_col == 1
|
||||
throw 'out of bounds'
|
||||
endif
|
||||
let s:top_col = 0
|
||||
if s:check_in
|
||||
elseif s:check_in
|
||||
if eval(s:skip_expr)
|
||||
return 1
|
||||
endif
|
||||
@@ -161,19 +165,29 @@ function s:Token()
|
||||
return s:LookingAt() =~ '\k' ? expand('<cword>') : s:LookingAt()
|
||||
endfunction
|
||||
|
||||
function s:PreviousToken()
|
||||
let l:col = col('.')
|
||||
function s:PreviousToken(...)
|
||||
let [l:pos, tok] = [getpos('.'), '']
|
||||
if search('\m\k\{1,}\|\S','ebW')
|
||||
if search('\m\*\%#\/\|\/\/\%<'.a:firstline.'l','nbW',line('.')) && eval(s:in_comm)
|
||||
if s:SearchLoop('\S\ze\_s*\/[/*]','bW',s:in_comm)
|
||||
return s:Token()
|
||||
if getline('.')[col('.')-2:col('.')-1] == '*/'
|
||||
if eval(s:in_comm) && !s:SearchLoop('\S\ze\_s*\/[/*]','bW',s:in_comm)
|
||||
call setpos('.',l:pos)
|
||||
else
|
||||
let tok = s:Token()
|
||||
endif
|
||||
call cursor(a:firstline, l:col)
|
||||
else
|
||||
return s:Token()
|
||||
let two = a:0 || line('.') != l:pos[1] ? strridx(getline('.')[:col('.')],'//') + 1 : 0
|
||||
if two && eval(s:in_comm)
|
||||
call cursor(0,two)
|
||||
let tok = s:PreviousToken(1)
|
||||
if tok is ''
|
||||
call setpos('.',l:pos)
|
||||
endif
|
||||
else
|
||||
let tok = s:Token()
|
||||
endif
|
||||
endif
|
||||
endif
|
||||
return ''
|
||||
return tok
|
||||
endfunction
|
||||
|
||||
function s:Pure(f,...)
|
||||
@@ -217,15 +231,14 @@ let s:opfirst = '^' . get(g:,'javascript_opfirst',
|
||||
let s:continuation = get(g:,'javascript_continuation',
|
||||
\ '\C\%([<=,.~!?/*^%|&:]\|+\@<!+\|-\@<!-\|=\@<!>\|\<\%(typeof\|new\|delete\|void\|in\|instanceof\|await\)\)') . '$'
|
||||
|
||||
function s:Continues(ln,con)
|
||||
let tok = matchstr(a:con[-15:],s:continuation)
|
||||
function s:Continues()
|
||||
let tok = matchstr(strpart(getline('.'),col('.')-15,15),s:continuation)
|
||||
if tok =~ '[a-z:]'
|
||||
call cursor(a:ln, len(a:con))
|
||||
return tok == ':' ? s:ExprCol() : s:PreviousToken() != '.'
|
||||
elseif tok !~ '[/>]'
|
||||
return tok isnot ''
|
||||
endif
|
||||
return s:SynAt(a:ln, len(a:con)) !~? (tok == '>' ? 'jsflow\|^html' : 'regex')
|
||||
return s:SynAt(line('.'),col('.')) !~? (tok == '>' ? 'jsflow\|^html' : 'regex')
|
||||
endfunction
|
||||
|
||||
" Check if line 'lnum' has a balanced amount of parentheses.
|
||||
@@ -259,21 +272,27 @@ endfunction
|
||||
|
||||
function s:DoWhile()
|
||||
let cpos = searchpos('\m\<','cbW')
|
||||
if s:SearchLoop('\C[{}]\|\<\%(do\|while\)\>','bW',s:skip_expr)
|
||||
if s:{s:LookingAt() == '}' && s:GetPair('{','}','bW',s:skip_expr) ?
|
||||
\ 'Previous' : ''}Token() ==# 'do' && s:IsBlock()
|
||||
return 1
|
||||
while s:SearchLoop('\C[{}]\|\<\%(do\|while\)\>','bW',s:skip_expr)
|
||||
if s:LookingAt() =~ '\a'
|
||||
if s:Pure('s:IsBlock')
|
||||
if s:LookingAt() ==# 'd'
|
||||
return 1
|
||||
endif
|
||||
break
|
||||
endif
|
||||
elseif s:LookingAt() != '}' || !s:GetPair('{','}','bW',s:skip_expr)
|
||||
break
|
||||
endif
|
||||
call call('cursor',cpos)
|
||||
endif
|
||||
endwhile
|
||||
call call('cursor',cpos)
|
||||
endfunction
|
||||
|
||||
" returns total offset from braceless contexts. 'num' is the lineNr which
|
||||
" encloses the entire context, 'cont' if whether a:firstline is a continued
|
||||
" expression, which could have started in a braceless context
|
||||
function s:IsContOne(num,cont)
|
||||
let [l:num, b_l] = [a:num + !a:num, 0]
|
||||
let pind = a:num ? indent(a:num) + s:sw() : 0
|
||||
function s:IsContOne(cont)
|
||||
let [l:num, b_l] = [b:js_cache[1] + !b:js_cache[1], 0]
|
||||
let pind = b:js_cache[1] ? indent(b:js_cache[1]) + s:sw() : 0
|
||||
let ind = indent('.') + !a:cont
|
||||
while line('.') > l:num && ind > pind || line('.') == l:num
|
||||
if indent('.') < ind && s:OneScope()
|
||||
@@ -300,6 +319,7 @@ endfunction
|
||||
function s:IsBlock()
|
||||
let tok = s:PreviousToken()
|
||||
if join(s:stack) =~? 'xml\|jsx' && s:SynAt(line('.'),col('.')-1) =~? 'xml\|jsx'
|
||||
let s:in_jsx = 1
|
||||
return tok != '{'
|
||||
elseif tok =~ '\k'
|
||||
if tok ==# 'type'
|
||||
@@ -324,7 +344,7 @@ function s:IsBlock()
|
||||
endfunction
|
||||
|
||||
function GetJavascriptIndent()
|
||||
let b:js_cache = get(b:,'js_cache',[0,0,0])
|
||||
call s:GetVars()
|
||||
let s:synid_cache = [[],[]]
|
||||
let l:line = getline(v:lnum)
|
||||
" use synstack as it validates syn state and works in an empty line
|
||||
@@ -386,10 +406,10 @@ function GetJavascriptIndent()
|
||||
|
||||
let [b:js_cache[0], num] = [v:lnum, b:js_cache[1]]
|
||||
|
||||
let [num_ind, is_op, b_l, l:switch_offset] = [s:Nat(indent(num)),0,0,0]
|
||||
let [num_ind, is_op, b_l, l:switch_offset, s:in_jsx] = [s:Nat(indent(num)),0,0,0,0]
|
||||
if !num || s:LookingAt() == '{' && s:IsBlock()
|
||||
let ilnum = line('.')
|
||||
if num && s:LookingAt() == ')' && s:GetPair('(',')','bW',s:skip_expr)
|
||||
if num && !s:in_jsx && s:LookingAt() == ')' && s:GetPair('(',')','bW',s:skip_expr)
|
||||
if ilnum == num
|
||||
let [num, num_ind] = [line('.'), indent('.')]
|
||||
endif
|
||||
@@ -403,26 +423,24 @@ function GetJavascriptIndent()
|
||||
endif
|
||||
endif
|
||||
if idx == -1 && pline[-1:] !~ '[{;]'
|
||||
call cursor(l:lnum, len(pline))
|
||||
let sol = matchstr(l:line,s:opfirst)
|
||||
if sol is '' || sol == '/' && s:SynAt(v:lnum,
|
||||
\ 1 + len(getline(v:lnum)) - len(l:line)) =~? 'regex'
|
||||
if s:Continues(l:lnum,pline)
|
||||
if s:Continues()
|
||||
let is_op = s:sw()
|
||||
endif
|
||||
elseif num && sol =~# '^\%(in\%(stanceof\)\=\|\*\)$'
|
||||
call cursor(l:lnum, len(pline))
|
||||
if s:LookingAt() == '}' && s:GetPair('{','}','bW',s:skip_expr) &&
|
||||
\ s:PreviousToken() == ')' && s:GetPair('(',')','bW',s:skip_expr) &&
|
||||
\ (s:PreviousToken() == ']' || s:Token() =~ '\k' &&
|
||||
\ s:{s:PreviousToken() == '*' ? 'Previous' : ''}Token() !=# 'function')
|
||||
return num_ind + s:sw()
|
||||
endif
|
||||
let is_op = s:sw()
|
||||
elseif num && sol =~# '^\%(in\%(stanceof\)\=\|\*\)$' &&
|
||||
\ s:LookingAt() == '}' && s:GetPair('{','}','bW',s:skip_expr) &&
|
||||
\ s:PreviousToken() == ')' && s:GetPair('(',')','bW',s:skip_expr) &&
|
||||
\ (s:PreviousToken() == ']' || s:LookingAt() =~ '\k' &&
|
||||
\ s:{s:PreviousToken() == '*' ? 'Previous' : ''}Token() !=# 'function')
|
||||
return num_ind + s:sw()
|
||||
else
|
||||
let is_op = s:sw()
|
||||
endif
|
||||
call cursor(l:lnum, len(pline))
|
||||
let b_l = s:Nat(s:IsContOne(b:js_cache[1],is_op) - (!is_op && l:line =~ '^{')) * s:sw()
|
||||
let b_l = s:Nat(s:IsContOne(is_op) - (!is_op && l:line =~ '^{')) * s:sw()
|
||||
endif
|
||||
elseif idx.s:LookingAt().&cino =~ '^-1(.*(' && (search('\m\S','nbW',num) || s:ParseCino('U'))
|
||||
let pval = s:ParseCino('(')
|
||||
@@ -438,10 +456,10 @@ function GetJavascriptIndent()
|
||||
|
||||
" main return
|
||||
if l:line =~ '^[])}]\|^|}'
|
||||
if l:line_raw[0] == ')' && getline(num)[b:js_cache[2]-1] == '('
|
||||
if l:line_raw[0] == ')'
|
||||
if s:ParseCino('M')
|
||||
return indent(l:lnum)
|
||||
elseif &cino =~# 'm' && !s:ParseCino('m')
|
||||
elseif num && &cino =~# 'm' && !s:ParseCino('m')
|
||||
return virtcol('.') - 1
|
||||
endif
|
||||
endif
|
||||
|
||||
@@ -74,48 +74,42 @@ function GetLuaIndent()
|
||||
|
||||
let original_cursor_pos = getpos(".")
|
||||
|
||||
let i = 0
|
||||
|
||||
" check if the previous line opens blocks
|
||||
" count how many blocks the previous line opens
|
||||
call cursor(v:lnum, 1)
|
||||
let num_pairs = searchpair(s:open_patt, s:middle_patt, s:close_patt,
|
||||
let num_prev_opens = searchpair(s:open_patt, s:middle_patt, s:close_patt,
|
||||
\ 'mrb', s:skip_expr, prev_line)
|
||||
if num_pairs > 0
|
||||
let i += num_pairs
|
||||
endif
|
||||
|
||||
" special case: call(with, {anon = function() -- should indent only once
|
||||
if num_pairs > 1 && contents_prev =~# s:anon_func_start
|
||||
let i = 1
|
||||
endif
|
||||
|
||||
" check if current line closes blocks
|
||||
" count how many blocks the current line closes
|
||||
call cursor(prev_line, col([prev_line,'$']))
|
||||
let num_pairs = searchpair(s:open_patt, s:middle_patt, s:close_patt,
|
||||
let num_cur_closes = searchpair(s:open_patt, s:middle_patt, s:close_patt,
|
||||
\ 'mr', s:skip_expr, v:lnum)
|
||||
if num_pairs > 0
|
||||
let i -= num_pairs
|
||||
endif
|
||||
|
||||
" special case: end}) -- end of call with anon func should unindent once
|
||||
if num_pairs > 1 && contents_cur =~# s:anon_func_end
|
||||
let i = -1
|
||||
endif
|
||||
let i = num_prev_opens - num_cur_closes
|
||||
|
||||
" if the previous line closed a paren, unindent (except with anon funcs)
|
||||
" if the previous line closed a paren, outdent (except with anon funcs)
|
||||
call cursor(prev_line - 1, col([prev_line - 1, '$']))
|
||||
let num_pairs = searchpair('(', '', ')', 'mr', s:skip_expr, prev_line)
|
||||
if num_pairs > 0 && contents_prev !~ s:anon_func_end
|
||||
let num_prev_closed_parens = searchpair('(', '', ')', 'mr', s:skip_expr, prev_line)
|
||||
if num_prev_closed_parens > 0 && contents_prev !~# s:anon_func_end
|
||||
let i -= 1
|
||||
endif
|
||||
|
||||
" if this line closed a paren, indent (except with anon funcs)
|
||||
call cursor(prev_line, col([prev_line, '$']))
|
||||
let num_pairs = searchpair('(', '', ')', 'mr', s:skip_expr, v:lnum)
|
||||
if num_pairs > 0 && contents_cur !~ s:anon_func_end
|
||||
let num_cur_closed_parens = searchpair('(', '', ')', 'mr', s:skip_expr, v:lnum)
|
||||
if num_cur_closed_parens > 0 && contents_cur !~# s:anon_func_end
|
||||
let i += 1
|
||||
endif
|
||||
|
||||
" special case: call(with, {anon = function() -- should indent only once
|
||||
if i > 1 && contents_prev =~# s:anon_func_start
|
||||
let i = 1
|
||||
endif
|
||||
|
||||
" special case: end}) -- end of call w/ anon func should outdent only once
|
||||
if i < -1 && contents_cur =~# s:anon_func_end
|
||||
let i = -1
|
||||
endif
|
||||
|
||||
" restore cursor
|
||||
call setpos(".", original_cursor_pos)
|
||||
|
||||
|
||||
86
indent/nix.vim
Normal file
86
indent/nix.vim
Normal file
@@ -0,0 +1,86 @@
|
||||
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'nix') == -1
|
||||
|
||||
" Vim indent file
|
||||
" Language: Nix
|
||||
" Maintainer: Daiderd Jordan <daiderd@gmail.com>
|
||||
" URL: https://github.com/LnL7/vim-nix
|
||||
|
||||
if exists("b:did_indent")
|
||||
finish
|
||||
endif
|
||||
let b:did_indent = 1
|
||||
|
||||
setlocal indentexpr=GetNixIndent()
|
||||
setlocal indentkeys+=0=then,0=else,0=inherit,*<Return>
|
||||
|
||||
if exists("*GetNixIndent")
|
||||
finish
|
||||
endif
|
||||
|
||||
let s:cpo_save = &cpo
|
||||
set cpo&vim
|
||||
|
||||
let s:skip_syntax = '\%(Comment\|String\)$'
|
||||
let s:block_open = '\%({\|[\)'
|
||||
let s:block_close = '\%(}\|]\)'
|
||||
|
||||
function! GetNixIndent()
|
||||
let lnum = prevnonblank(v:lnum - 1)
|
||||
let ind = indent(lnum)
|
||||
|
||||
" At the start of the file use zero indent.
|
||||
if lnum == 0
|
||||
return 0
|
||||
endif
|
||||
|
||||
if synIDattr(synID(v:lnum, 1, 1), "name") !~ s:skip_syntax
|
||||
let current_line = getline(v:lnum)
|
||||
let last_line = getline(lnum)
|
||||
|
||||
if last_line =~ s:block_open . '\s*$'
|
||||
let ind += &sw
|
||||
endif
|
||||
|
||||
if current_line =~ '^\s*' . s:block_close
|
||||
let ind -= &sw
|
||||
endif
|
||||
|
||||
if last_line =~ '\<let\s*$'
|
||||
let ind += &sw
|
||||
endif
|
||||
|
||||
if getline(v:lnum - 1) =~ '^\<in\s*$'
|
||||
let ind += &sw
|
||||
endif
|
||||
|
||||
if current_line =~ '^\s*in\>'
|
||||
let ind -= &sw
|
||||
endif
|
||||
endif
|
||||
|
||||
if synIDattr(synID(v:lnum, 1, 1), "name") =~ '^nixString'
|
||||
let current_line = getline(v:lnum)
|
||||
|
||||
let ind = indent(v:lnum)
|
||||
let bslnum = searchpair('''''', '', '''''', 'bnW',
|
||||
\ 'synIDattr(synID(line("."), col("."), 0), "name") =~? "InterpolationSpecial$"')
|
||||
|
||||
if ind <= indent(bslnum)
|
||||
let ind = indent(bslnum) + &sw
|
||||
endif
|
||||
|
||||
if current_line =~ '^\s*''''[^''\$]'
|
||||
let ind = indent(bslnum)
|
||||
endif
|
||||
if current_line =~ '^\s*''''$'
|
||||
let ind = indent(bslnum)
|
||||
endif
|
||||
endif
|
||||
|
||||
return ind
|
||||
endfunction
|
||||
|
||||
let &cpo = s:cpo_save
|
||||
unlet s:cpo_save
|
||||
|
||||
endif
|
||||
@@ -136,9 +136,9 @@ function! GetPerlIndent()
|
||||
\ || synid =~ '^perl\(Sub\|Block\|Package\)Fold'
|
||||
let brace = strpart(line, bracepos, 1)
|
||||
if brace == '(' || brace == '{' || brace == '['
|
||||
let ind = ind + &sw
|
||||
let ind = ind + shiftwidth()
|
||||
else
|
||||
let ind = ind - &sw
|
||||
let ind = ind - shiftwidth()
|
||||
endif
|
||||
endif
|
||||
let bracepos = match(line, braceclass, bracepos + 1)
|
||||
@@ -151,25 +151,25 @@ function! GetPerlIndent()
|
||||
\ || synid == "perlBraces"
|
||||
\ || synid == "perlStatementIndirObj"
|
||||
\ || synid =~ '^perl\(Sub\|Block\|Package\)Fold'
|
||||
let ind = ind - &sw
|
||||
let ind = ind - shiftwidth()
|
||||
endif
|
||||
endif
|
||||
else
|
||||
if line =~ '[{[(]\s*\(#[^])}]*\)\=$'
|
||||
let ind = ind + &sw
|
||||
let ind = ind + shiftwidth()
|
||||
endif
|
||||
if cline =~ '^\s*[])}]'
|
||||
let ind = ind - &sw
|
||||
let ind = ind - shiftwidth()
|
||||
endif
|
||||
endif
|
||||
|
||||
" Indent lines that begin with 'or' or 'and'
|
||||
if cline =~ '^\s*\(or\|and\)\>'
|
||||
if line !~ '^\s*\(or\|and\)\>'
|
||||
let ind = ind + &sw
|
||||
let ind = ind + shiftwidth()
|
||||
endif
|
||||
elseif line =~ '^\s*\(or\|and\)\>'
|
||||
let ind = ind - &sw
|
||||
let ind = ind - shiftwidth()
|
||||
endif
|
||||
|
||||
return ind
|
||||
|
||||
@@ -16,7 +16,7 @@ let b:did_indent = 1
|
||||
" smartindent is good enough for powershell
|
||||
setlocal smartindent
|
||||
" disable the indent removal for # marks
|
||||
inoremap # X#
|
||||
inoremap <buffer> # X#
|
||||
|
||||
let b:undo_indent = "setl si<"
|
||||
|
||||
|
||||
@@ -4,7 +4,7 @@ if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'qml') == -1
|
||||
" Language: QML
|
||||
" Author: Robert Kieffer
|
||||
" URL:
|
||||
" Last Change: 2010-03-27 (Happy Birthday, Dash!)
|
||||
" Last Change: 2017-10-27
|
||||
"
|
||||
" Improved JavaScript indent script.
|
||||
|
||||
@@ -22,10 +22,10 @@ if exists("*GetJsIndent")
|
||||
finish
|
||||
endif
|
||||
|
||||
" Clean up a line of code by removing trailing '//' comments, and trimming
|
||||
" Clean up a line of code by removing trailing '//' and '/* */' comments, and trimming
|
||||
" whitespace
|
||||
function! Trim(line)
|
||||
return substitute(substitute(a:line, '// .*', '', ''), '^\s*\|\s*$', '', 'g')
|
||||
return substitute(substitute(substitute(a:line, '// .*', '', ''), '/\* .* \*/', '', ''), '^\s*\|\s*$', '', 'g')
|
||||
endfunction
|
||||
|
||||
function! GetJsIndent()
|
||||
|
||||
481
syntax/cmake.vim
Normal file
481
syntax/cmake.vim
Normal file
File diff suppressed because one or more lines are too long
@@ -11,17 +11,17 @@ endif
|
||||
|
||||
syn cluster crystalNotTop contains=@crystalExtendedStringSpecial,@crystalRegexpSpecial,@crystalDeclaration,crystalConditional,crystalExceptional,crystalMethodExceptional,crystalTodo,crystalLinkAttr
|
||||
|
||||
if exists('crystal_space_errors')
|
||||
if !exists('crystal_no_trail_space_error')
|
||||
if exists('g:crystal_space_errors')
|
||||
if !exists('g:crystal_no_trail_space_error')
|
||||
syn match crystalSpaceError display excludenl "\s\+$"
|
||||
endif
|
||||
if !exists('crystal_no_tab_space_error')
|
||||
if !exists('g:crystal_no_tab_space_error')
|
||||
syn match crystalSpaceError display " \+\t"me=e-1
|
||||
endif
|
||||
endif
|
||||
|
||||
" Operators
|
||||
if exists('crystal_operators')
|
||||
if exists('g:crystal_operators')
|
||||
syn match crystalOperator "[~!^&|*/%+-]\|\%(class\s*\)\@<!<<\|<=>\|<=\|\%(<\|\<class\s\+\u\w*\s*\)\@<!<[^<]\@=\|===\|==\|=\~\|>>\|>=\|=\@<!>\|\*\*\|\.\.\.\|\.\.\|::"
|
||||
syn match crystalOperator "->\|-=\|/=\|\*\*=\|\*=\|&&=\|&=\|&&\|||=\||=\|||\|%=\|+=\|!\~\|!="
|
||||
syn region crystalBracketOperator matchgroup=crystalOperator start="\%(\w[?!]\=\|[]})]\)\@<=\[\s*" end="\s*]" contains=ALLBUT,@crystalNotTop
|
||||
@@ -170,39 +170,39 @@ syn region crystalString start=+\%(\%(class\|::\)\_s*\|\%([]}).]\)\s\|\w\)\@<!<<
|
||||
syn region crystalString start=+\%(\%(class\|::\)\_s*\|\%([]}).]\)\s\|\w\)\@<!<<-'\z([^']*\)'\ze\%(.*<<-\=['`"]\=\h\)\@!+hs=s+3 matchgroup=crystalStringDelimiter end=+^\s*\zs\z1$+ contains=crystalHeredocStart fold keepend
|
||||
syn region crystalString start=+\%(\%(class\|::\)\_s*\|\%([]}).]\)\s\|\w\)\@<!<<-`\z([^`]*\)`\ze\%(.*<<-\=['`"]\=\h\)\@!+hs=s+3 matchgroup=crystalStringDelimiter end=+^\s*\zs\z1$+ contains=crystalHeredocStart,@crystalStringSpecial fold keepend
|
||||
|
||||
if exists('main_syntax') && g:main_syntax ==# 'ecrystal'
|
||||
if exists('g:main_syntax') && g:main_syntax ==# 'ecrystal'
|
||||
let b:crystal_no_expensive = 1
|
||||
end
|
||||
|
||||
syn match crystalAliasDeclaration "[^[:space:];#.()]\+" contained contains=crystalSymbol,crystalGlobalVariable,crystalPredefinedVariable nextgroup=crystalAliasDeclaration2 skipwhite
|
||||
syn match crystalAliasDeclaration2 "[^[:space:];#.()]\+" contained contains=crystalSymbol,crystalGlobalVariable,crystalPredefinedVariable
|
||||
syn match crystalMethodDeclaration "[^[:space:];#(]\+" contained contains=crystalConstant,crystalBoolean,crystalPseudoVariable,crystalInstanceVariable,crystalClassVariable,crystalGlobalVariable
|
||||
syn match crystalFunctionDeclaration "[^[:space:];#(=]\+" contained contains=crystalConstant
|
||||
syn match crystalTypeDeclaration "[^[:space:];#=]\+" contained contains=crystalConstant
|
||||
syn match crystalClassDeclaration "[^[:space:];#<]\+" contained contains=crystalConstant,crystalOperator
|
||||
syn match crystalModuleDeclaration "[^[:space:];#<]\+" contained contains=crystalConstant,crystalOperator
|
||||
syn match crystalStructDeclaration "[^[:space:];#<]\+" contained contains=crystalConstant,crystalOperator
|
||||
syn match crystalLibDeclaration "[^[:space:];#<]\+" contained contains=crystalConstant,crystalOperator
|
||||
syn match crystalMacroDeclaration "[^[:space:];#<\"]\+" contained contains=crystalConstant,crystalOperator
|
||||
syn match crystalEnumDeclaration "[^[:space:];#<\"]\+" contained contains=crystalConstant
|
||||
syn match crystalFunction "\<[_[:alpha:]][_[:alnum:]]*[?!=]\=[[:alnum:]_.:?!=]\@!" contained containedin=crystalMethodDeclaration,crystalFunctionDeclaration
|
||||
syn match crystalFunction "\%(\s\|^\)\@<=[_[:alpha:]][_[:alnum:]]*[?!=]\=\%(\s\|$\)\@=" contained containedin=crystalAliasDeclaration,crystalAliasDeclaration2
|
||||
syn match crystalFunction "\%([[:space:].]\|^\)\@<=\%(\[\][=?]\=\|\*\*\|[+-]@\=\|[*/%|&^~]\|<<\|>>\|[<>]=\=\|<=>\|===\|[=!]=\|[=!]\~\|!\|`\)\%([[:space:];#(]\|$\)\@=" contained containedin=crystalAliasDeclaration,crystalAliasDeclaration2,crystalMethodDeclaration,crystalFunctionDeclaration
|
||||
syn match crystalAliasDeclaration "[^[:space:];#.()]\+" contained contains=crystalSymbol,crystalGlobalVariable,crystalPredefinedVariable nextgroup=crystalAliasDeclaration2 skipwhite
|
||||
syn match crystalAliasDeclaration2 "[^[:space:];#.()]\+" contained contains=crystalSymbol,crystalGlobalVariable,crystalPredefinedVariable
|
||||
syn match crystalMethodDeclaration "[^[:space:];#(]\+" contained contains=crystalConstant,crystalBoolean,crystalPseudoVariable,crystalInstanceVariable,crystalClassVariable,crystalGlobalVariable
|
||||
syn match crystalFunctionDeclaration "[^[:space:];#(=]\+" contained contains=crystalConstant
|
||||
syn match crystalTypeDeclaration "[^[:space:];#=]\+" contained contains=crystalConstant
|
||||
syn match crystalClassDeclaration "[^[:space:];#<]\+" contained contains=crystalConstant,crystalOperator
|
||||
syn match crystalModuleDeclaration "[^[:space:];#<]\+" contained contains=crystalConstant,crystalOperator
|
||||
syn match crystalStructDeclaration "[^[:space:];#<]\+" contained contains=crystalConstant,crystalOperator
|
||||
syn match crystalLibDeclaration "[^[:space:];#<]\+" contained contains=crystalConstant,crystalOperator
|
||||
syn match crystalMacroDeclaration "[^[:space:];#<\"]\+" contained contains=crystalConstant,crystalOperator
|
||||
syn match crystalEnumDeclaration "[^[:space:];#<\"]\+" contained contains=crystalConstant
|
||||
syn match crystalFunction "\<[_[:alpha:]][_[:alnum:]]*[?!=]\=[[:alnum:]_.:?!=]\@!" contained containedin=crystalMethodDeclaration,crystalFunctionDeclaration
|
||||
syn match crystalFunction "\%(\s\|^\)\@<=[_[:alpha:]][_[:alnum:]]*[?!=]\=\%(\s\|$\)\@=" contained containedin=crystalAliasDeclaration,crystalAliasDeclaration2
|
||||
syn match crystalFunction "\%([[:space:].]\|^\)\@<=\%(\[\][=?]\=\|\*\*\|[+-]@\=\|[*/%|&^~]\|<<\|>>\|[<>]=\=\|<=>\|===\|[=!]=\|[=!]\~\|!\|`\)\%([[:space:];#(]\|$\)\@=" contained containedin=crystalAliasDeclaration,crystalAliasDeclaration2,crystalMethodDeclaration,crystalFunctionDeclaration
|
||||
|
||||
syn cluster crystalDeclaration contains=crystalAliasDeclaration,crystalAliasDeclaration2,crystalMethodDeclaration,crystalFunctionDeclaration,crystalModuleDeclaration,crystalClassDeclaration,crystalStructDeclaration,crystalLibDeclaration,crystalMacroDeclaration,crystalFunction,crystalBlockParameter,crystalTypeDeclaration,crystalEnumDeclaration
|
||||
|
||||
" Keywords
|
||||
" Note: the following keywords have already been defined:
|
||||
" begin case class def do end for if module unless until while
|
||||
syn match crystalControl "\<\%(break\|in\|next\|rescue\|return\)\>[?!]\@!"
|
||||
syn match crystalOperator "\<defined?" display
|
||||
syn match crystalKeyword "\<\%(super\|previous_def\|yield\|as\|of\|with\)\>[?!]\@!"
|
||||
syn match crystalBoolean "\<\%(true\|false\)\>[?!]\@!"
|
||||
syn match crystalPseudoVariable "\<\%(nil\|self\|__DIR__\|__FILE__\|__LINE__\)\>[?!]\@!" " TODO: reorganise
|
||||
syn match crystalControl "\<\%(break\|in\|next\|rescue\|return\)\>[?!]\@!"
|
||||
syn match crystalOperator "\<defined?" display
|
||||
syn match crystalKeyword "\<\%(super\|previous_def\|yield\|of\|with\|uninitialized\|union\)\>[?!]\@!"
|
||||
syn match crystalBoolean "\<\%(true\|false\)\>[?!]\@!"
|
||||
syn match crystalPseudoVariable "\<\%(nil\|self\|__DIR__\|__FILE__\|__LINE__\|__END_LINE__\)\>[?!]\@!" " TODO: reorganise
|
||||
|
||||
" Expensive Mode - match 'end' with the appropriate opening keyword for syntax
|
||||
" based folding and special highlighting of module/class/method definitions
|
||||
if !exists('b:crystal_no_expensive') && !exists('crystal_no_expensive')
|
||||
if !exists('b:crystal_no_expensive') && !exists('g:crystal_no_expensive')
|
||||
syn match crystalDefine "\<alias\>" nextgroup=crystalAliasDeclaration skipwhite skipnl
|
||||
syn match crystalDefine "\<def\>" nextgroup=crystalMethodDeclaration skipwhite skipnl
|
||||
syn match crystalDefine "\<fun\>" nextgroup=crystalFunctionDeclaration skipwhite skipnl
|
||||
@@ -246,10 +246,10 @@ if !exists('b:crystal_no_expensive') && !exists('crystal_no_expensive')
|
||||
syn region crystalOptionalDoLine matchgroup=crystalRepeat start="\<for\>[?!]\@!" start="\%(\%(^\|\.\.\.\=\|[{:,;([<>~\*/%&^|+-]\|\%(\<[_[:lower:]][_[:alnum:]]*\)\@<![!=?]\)\s*\)\@<=\<\%(until\|while\)\>" matchgroup=crystalOptionalDo end="\%(\<do\>\)" end="\ze\%(;\|$\)" oneline contains=ALLBUT,@crystalNotTop
|
||||
syn region crystalRepeatExpression start="\<for\>[?!]\@!" start="\%(\%(^\|\.\.\.\=\|[{:,;([<>~\*/%&^|+-]\|\%(\<[_[:lower:]][_[:alnum:]]*\)\@<![!=?]\)\s*\)\@<=\<\%(until\|while\)\>" matchgroup=crystalRepeat end="\<end\>" contains=ALLBUT,@crystalNotTop nextgroup=crystalOptionalDoLine fold
|
||||
|
||||
if !exists('crystal_minlines')
|
||||
let crystal_minlines = 500
|
||||
if !exists('g:crystal_minlines')
|
||||
let g:crystal_minlines = 500
|
||||
endif
|
||||
exec 'syn sync minlines=' . crystal_minlines
|
||||
exec 'syn sync minlines=' . g:crystal_minlines
|
||||
|
||||
else
|
||||
syn match crystalControl "\<def\>[?!]\@!" nextgroup=crystalMethodDeclaration skipwhite skipnl
|
||||
@@ -271,7 +271,7 @@ syn match crystalLinkAttr "@\[" contained containedin=crystalLinkAttrRegion disp
|
||||
syn match crystalLinkAttr "]" contained containedin=crystalLinkAttrRegion display
|
||||
|
||||
" Special Methods
|
||||
if !exists('crystal_no_special_methods')
|
||||
if !exists('g:crystal_no_special_methods')
|
||||
syn keyword crystalAccess protected private
|
||||
" attr is a common variable name
|
||||
syn keyword crystalAttribute getter setter property abstract
|
||||
@@ -293,7 +293,7 @@ syn match crystalMacro "\%({%\|%}\|{{\|}}\)" nextgroup=crystalMacroRegion skipwh
|
||||
syn match crystalSharpBang "\%^#!.*" display
|
||||
syn keyword crystalTodo FIXME NOTE TODO OPTIMIZE XXX todo contained
|
||||
syn match crystalComment "#.*" contains=crystalSharpBang,crystalSpaceError,crystalTodo,@Spell
|
||||
if !exists('crystal_no_comment_fold')
|
||||
if !exists('g:crystal_no_comment_fold')
|
||||
syn region crystalMultilineComment start="\%(\%(^\s*#.*\n\)\@<!\%(^\s*#.*\n\)\)\%(\(^\s*#.*\n\)\{1,}\)\@=" end="\%(^\s*#.*\n\)\@<=\%(^\s*#.*\n\)\%(^\s*#\)\@!" contains=crystalComment transparent fold keepend
|
||||
endif
|
||||
|
||||
@@ -307,7 +307,7 @@ syn match crystalKeywordAsMethod "\<\%(alias\|begin\|case\|class\|def\|do\|end\)
|
||||
syn match crystalKeywordAsMethod "\<\%(if\|ifdef\|module\|undef\|unless\|until\|while\)[?!]" transparent contains=NONE
|
||||
|
||||
syn match crystalKeywordAsMethod "\%(\%(\.\@<!\.\)\|::\)\_s*\%(abort\|at_exit\|caller\|exit\)\>" transparent contains=NONE
|
||||
syn match crystalKeywordAsMethod "\%(\%(\.\@<!\.\)\|::\)\_s*\%(extend\|fork\|include\)\>" transparent contains=NONE
|
||||
syn match crystalKeywordAsMethod "\%(\%(\.\@<!\.\)\|::\)\_s*\%(extend\|fork\|include\|asm\)\>" transparent contains=NONE
|
||||
syn match crystalKeywordAsMethod "\%(\%(\.\@<!\.\)\|::\)\_s*\%(loop\|private\|protected\)\>" transparent contains=NONE
|
||||
syn match crystalKeywordAsMethod "\%(\%(\.\@<!\.\)\|::\)\_s*\%(require\|raise\)\>" transparent contains=NONE
|
||||
syn match crystalKeywordAsMethod "\%(\%(\.\@<!\.\)\|::\)\_s*\%(typeof\|pointerof\|sizeof\|instance_sizeof\|\)\>" transparent contains=NONE
|
||||
@@ -335,7 +335,7 @@ hi def link crystalASCIICode Character
|
||||
hi def link crystalFloat Float
|
||||
hi def link crystalBoolean Boolean
|
||||
hi def link crystalException Exception
|
||||
if !exists('crystal_no_identifiers')
|
||||
if !exists('g:crystal_no_identifiers')
|
||||
hi def link crystalIdentifier Identifier
|
||||
else
|
||||
hi def link crystalIdentifier NONE
|
||||
|
||||
@@ -72,6 +72,7 @@ syntax keyword dartTodo contained TODO FIXME XXX
|
||||
syntax region dartComment start="/\*" end="\*/" contains=dartComment,dartTodo,dartDocLink,@Spell
|
||||
syntax match dartLineComment "//.*" contains=dartTodo,@Spell
|
||||
syntax match dartLineDocComment "///.*" contains=dartTodo,dartDocLink,@Spell
|
||||
syntax match dartShebangLine /^\%1l#!.*/
|
||||
syntax region dartDocLink oneline contained start=+\[+ end=+\]+
|
||||
|
||||
" Strings
|
||||
@@ -110,6 +111,7 @@ highlight default link dartOperator Operator
|
||||
highlight default link dartComment Comment
|
||||
highlight default link dartLineComment Comment
|
||||
highlight default link dartLineDocComment Comment
|
||||
highlight default link dartShebangLine Comment
|
||||
highlight default link dartConstant Constant
|
||||
highlight default link dartTypedef Typedef
|
||||
highlight default link dartTodo Todo
|
||||
|
||||
@@ -120,10 +120,10 @@ syn region elixirSigil matchgroup=elixirSigilDelimiter start=+\~\a\z('''\)+ end=
|
||||
" Documentation
|
||||
if exists('g:elixir_use_markdown_for_docs') && g:elixir_use_markdown_for_docs
|
||||
syn include @markdown syntax/markdown.vim
|
||||
syn cluster elixirDocStringContained contains=@markdown,@Spell
|
||||
syn cluster elixirDocStringContained contains=@markdown,@Spell,elixirInterpolation
|
||||
else
|
||||
let g:elixir_use_markdown_for_docs = 0
|
||||
syn cluster elixirDocStringContained contains=elixirDocTest,elixirTodo,@Spell
|
||||
syn cluster elixirDocStringContained contains=elixirDocTest,elixirTodo,@Spell,elixirInterpolation
|
||||
|
||||
" doctests
|
||||
syn region elixirDocTest start="^\s*\%(iex\|\.\.\.\)\%((\d*)\)\?>\s" end="^\s*$" contained
|
||||
|
||||
@@ -15,7 +15,7 @@ syn sync minlines=50
|
||||
syn include @gitDiff syntax/diff.vim
|
||||
|
||||
syn region gitHead start=/\%^/ end=/^$/
|
||||
syn region gitHead start=/\%(^commit \x\{40\}\%(\s*(.*)\)\=$\)\@=/ end=/^$/
|
||||
syn region gitHead start=/\%(^commit\%( \x\{40\}\)\{1,\}\%(\s*(.*)\)\=$\)\@=/ end=/^$/
|
||||
|
||||
" For git reflog and git show ...^{tree}, avoid sync issues
|
||||
syn match gitHead /^\d\{6\} \%(\w\{4} \)\=\x\{40\}\%( [0-3]\)\=\t.*/
|
||||
|
||||
@@ -4,8 +4,8 @@ if exists("b:current_syntax")
|
||||
finish
|
||||
endif
|
||||
|
||||
if !exists("main_syntax")
|
||||
let main_syntax = 'html'
|
||||
if !exists("g:main_syntax")
|
||||
let g:main_syntax = 'html'
|
||||
endif
|
||||
|
||||
runtime! syntax/gotexttmpl.vim
|
||||
|
||||
@@ -99,6 +99,7 @@ syn region haskellBlockComment start="{-" end="-}"
|
||||
\ haskellTodo,
|
||||
\ @Spell
|
||||
syn region haskellPragma start="{-#" end="#-}"
|
||||
syn region haskellLiquid start="{-@" end="@-}"
|
||||
syn match haskellPreProc "^#.*$"
|
||||
syn keyword haskellTodo TODO FIXME contained
|
||||
" Treat a shebang line at the start of the file as a comment
|
||||
@@ -147,6 +148,7 @@ highlight def link haskellShebang Comment
|
||||
highlight def link haskellLineComment Comment
|
||||
highlight def link haskellBlockComment Comment
|
||||
highlight def link haskellPragma SpecialComment
|
||||
highlight def link haskellLiquid SpecialComment
|
||||
highlight def link haskellString String
|
||||
highlight def link haskellChar String
|
||||
highlight def link haskellBacktick Operator
|
||||
|
||||
@@ -35,6 +35,8 @@ syn match i3NoStartupId '--no-startup-id' contained
|
||||
syn keyword i3WsSpecialParam next prev next_on_output prev_on_output back_and_forth current number
|
||||
syn keyword i3BordersSpecialParam none vertical horizontal both
|
||||
syn keyword i3ModeParam dock hide invisible skipwhite
|
||||
syn keyword i3GapsCommand gaps smart_gaps smart_borders
|
||||
syn keyword i3GapsParam inner outer current all set plus minus no_gaps
|
||||
|
||||
" these are not keywords but we add them for consistency
|
||||
syn keyword i3PseudoParam no false inactive
|
||||
@@ -99,6 +101,7 @@ highlight link i3ColorLast Constant
|
||||
highlight link i3WsSpecialParam Constant
|
||||
highlight link i3BordersSpecialParam Constant
|
||||
highlight link i3ModeParam Constant
|
||||
highlight link i3GapsParam Constant
|
||||
|
||||
highlight link i3Var Identifier
|
||||
highlight link i3SetVar Identifier
|
||||
@@ -115,6 +118,7 @@ highlight link i3Font String
|
||||
highlight link i3ExecKeyword Keyword
|
||||
highlight link i3Command Keyword
|
||||
highlight link i3WsKeyword Keyword
|
||||
highlight link i3GapsCommand Keyword
|
||||
|
||||
highlight link i3ColorDef1 Define
|
||||
highlight link i3ColorDef3 Define
|
||||
|
||||
@@ -26,17 +26,17 @@ syntax sync fromstart
|
||||
" syntax case ignore
|
||||
syntax case match
|
||||
|
||||
syntax match jsNoise /[:,\;]\{1}/
|
||||
syntax match jsNoise /[\.]\{1}/ skipwhite skipempty nextgroup=jsObjectProp,jsFuncCall,jsPrototype,jsTaggedTemplate
|
||||
syntax match jsObjectProp contained /\<[a-zA-Z_$][0-9a-zA-Z_$]*\>/
|
||||
syntax match jsFuncCall /\k\+\%(\s*(\)\@=/
|
||||
syntax match jsNoise /[:,;]/
|
||||
syntax match jsNoise /\./ skipwhite skipempty nextgroup=jsObjectProp,jsFuncCall,jsPrototype,jsTaggedTemplate
|
||||
syntax match jsObjectProp contained /\<\K\k*/
|
||||
syntax match jsFuncCall /\<\K\k*\ze\s*(/
|
||||
syntax match jsParensError /[)}\]]/
|
||||
|
||||
" Program Keywords
|
||||
syntax keyword jsStorageClass const var let skipwhite skipempty nextgroup=jsDestructuringBlock,jsDestructuringArray,jsVariableDef
|
||||
syntax match jsVariableDef contained /\k\+/ skipwhite skipempty nextgroup=jsFlowDefinition
|
||||
syntax match jsVariableDef contained /\<\K\k*/ skipwhite skipempty nextgroup=jsFlowDefinition
|
||||
syntax keyword jsOperator delete instanceof typeof void new in of skipwhite skipempty nextgroup=@jsExpression
|
||||
syntax match jsOperator /[\!\|\&\+\-\<\>\=\%\/\*\~\^]\{1}/ skipwhite skipempty nextgroup=@jsExpression
|
||||
syntax match jsOperator "[-!|&+<>=%/*~^]" skipwhite skipempty nextgroup=@jsExpression
|
||||
syntax match jsOperator /::/ skipwhite skipempty nextgroup=@jsExpression
|
||||
syntax keyword jsBooleanTrue true
|
||||
syntax keyword jsBooleanFalse false
|
||||
@@ -44,7 +44,7 @@ syntax keyword jsBooleanFalse false
|
||||
" Modules
|
||||
syntax keyword jsImport import skipwhite skipempty nextgroup=jsModuleAsterisk,jsModuleKeyword,jsModuleGroup,jsFlowImportType
|
||||
syntax keyword jsExport export skipwhite skipempty nextgroup=@jsAll,jsModuleGroup,jsExportDefault,jsModuleAsterisk,jsModuleKeyword,jsFlowTypeStatement
|
||||
syntax match jsModuleKeyword contained /\k\+/ skipwhite skipempty nextgroup=jsModuleAs,jsFrom,jsModuleComma
|
||||
syntax match jsModuleKeyword contained /\<\K\k*/ skipwhite skipempty nextgroup=jsModuleAs,jsFrom,jsModuleComma
|
||||
syntax keyword jsExportDefault contained default skipwhite skipempty nextgroup=@jsExpression
|
||||
syntax keyword jsExportDefaultGroup contained default skipwhite skipempty nextgroup=jsModuleAs,jsFrom,jsModuleComma
|
||||
syntax match jsModuleAsterisk contained /\*/ skipwhite skipempty nextgroup=jsModuleKeyword,jsModuleAs,jsFrom
|
||||
@@ -53,44 +53,37 @@ syntax keyword jsFrom contained from skipwhite skipempty nextgroup
|
||||
syntax match jsModuleComma contained /,/ skipwhite skipempty nextgroup=jsModuleKeyword,jsModuleAsterisk,jsModuleGroup,jsFlowTypeKeyword
|
||||
|
||||
" Strings, Templates, Numbers
|
||||
syntax region jsString start=+"+ skip=+\\\("\|$\)+ end=+"\|$+ contains=jsSpecial,@Spell extend
|
||||
syntax region jsString start=+'+ skip=+\\\('\|$\)+ end=+'\|$+ contains=jsSpecial,@Spell extend
|
||||
syntax region jsTemplateString start=+`+ skip=+\\\(`\|$\)+ end=+`+ contains=jsTemplateExpression,jsSpecial,@Spell extend
|
||||
syntax match jsTaggedTemplate /\k\+\%(`\)\@=/ nextgroup=jsTemplateString
|
||||
syntax match jsNumber /\<\d\+\%([eE][+-]\=\d\+\)\=\>\|\<0[bB][01]\+\>\|\<0[oO]\o\+\>\|\<0[xX]\x\+\>/
|
||||
syntax region jsString start=+\z(["']\)+ skip=+\\\%(\z1\|$\)+ end=+\z1\|$+ contains=jsSpecial,@Spell extend
|
||||
syntax region jsTemplateString start=+`+ skip=+\\`+ end=+`+ contains=jsTemplateExpression,jsSpecial,@Spell extend
|
||||
syntax match jsTaggedTemplate /\<\K\k*\ze`/ nextgroup=jsTemplateString
|
||||
syntax match jsNumber /\c\<\%(\d\+\%(e[+-]\=\d\+\)\=\|0b[01]\+\|0o\o\+\|0x\x\+\)\>/
|
||||
syntax keyword jsNumber Infinity
|
||||
syntax match jsFloat /\<\%(\d\+\.\d\+\|\d\+\.\|\.\d\+\)\%([eE][+-]\=\d\+\)\=\>/
|
||||
syntax match jsFloat /\c\<\%(\d\+\.\d\+\|\d\+\.\|\.\d\+\)\%(e[+-]\=\d\+\)\=\>/
|
||||
|
||||
" Regular Expressions
|
||||
syntax match jsSpecial contained "\v\\%(0|\\x\x\{2\}\|\\u\x\{4\}\|\c[A-Z]|.)"
|
||||
syntax match jsSpecial contained "\v\\%(x\x\x|u%(\x{4}|\{\x{4,5}})|c\u|.)"
|
||||
syntax region jsTemplateExpression contained matchgroup=jsTemplateBraces start=+${+ end=+}+ contains=@jsExpression keepend
|
||||
syntax region jsRegexpCharClass contained start=+\[+ skip=+\\.+ end=+\]+
|
||||
syntax match jsRegexpBoundary contained "\v%(\<@![\^$]|\\[bB])"
|
||||
syntax match jsRegexpBackRef contained "\v\\[1-9][0-9]*"
|
||||
syntax match jsRegexpQuantifier contained "\v\\@<!%([?*+]|\{\d+%(,|,\d+)?})\??"
|
||||
syntax match jsRegexpOr contained "\v\<@!\|"
|
||||
syntax match jsRegexpMod contained "\v\(@<=\?[:=!>]"
|
||||
syntax region jsRegexpGroup contained start="\\\@<!(" skip="\\.\|\[\(\\.\|[^]]\)*\]" end="\\\@<!)" contains=jsRegexpCharClass,@jsRegexpSpecial keepend
|
||||
if v:version > 703 || v:version == 603 && has("patch1088")
|
||||
syntax region jsRegexpString start=+\%(\%(\%(return\|case\)\s\+\)\@50<=\|\%(\%([)\]"']\|\d\|\w\)\s*\)\@50<!\)/\(\*\|/\)\@!+ skip=+\\.\|\[\%(\\.\|[^]]\)*\]+ end=+/[gimyu]\{,5}+ contains=jsRegexpCharClass,jsRegexpGroup,@jsRegexpSpecial oneline keepend extend
|
||||
else
|
||||
syntax region jsRegexpString start=+\%(\%(\%(return\|case\)\s\+\)\@<=\|\%(\%([)\]"']\|\d\|\w\)\s*\)\@<!\)/\(\*\|/\)\@!+ skip=+\\.\|\[\%(\\.\|[^]]\)*\]+ end=+/[gimyu]\{,5}+ contains=jsRegexpCharClass,jsRegexpGroup,@jsRegexpSpecial oneline keepend extend
|
||||
endif
|
||||
syntax region jsRegexpCharClass contained start=+\[+ skip=+\\.+ end=+\]+ contains=jsSpecial
|
||||
syntax match jsRegexpBoundary contained "\v\c[$^]|\\b"
|
||||
syntax match jsRegexpBackRef contained "\v\\[1-9]\d*"
|
||||
syntax match jsRegexpQuantifier contained "\v[^\\]%([?*+]|\{\d+%(,\d*)?})\??"lc=1
|
||||
syntax match jsRegexpOr contained "|"
|
||||
syntax match jsRegexpMod contained "\v\(\?[:=!>]"lc=1
|
||||
syntax region jsRegexpGroup contained start="[^\\]("lc=1 skip="\\.\|\[\(\\.\|[^]]\+\)\]" end=")" contains=jsRegexpCharClass,@jsRegexpSpecial keepend
|
||||
syntax region jsRegexpString start=+\%(\%(\<return\|\<typeof\|\_[^)\]'"[:blank:][:alnum:]_$]\)\s*\)\@<=/\ze[^*/]+ skip=+\\.\|\[[^]]\{1,}\]+ end=+/[gimyus]\{,6}+ contains=jsRegexpCharClass,jsRegexpGroup,@jsRegexpSpecial oneline keepend extend
|
||||
syntax cluster jsRegexpSpecial contains=jsSpecial,jsRegexpBoundary,jsRegexpBackRef,jsRegexpQuantifier,jsRegexpOr,jsRegexpMod
|
||||
|
||||
" Objects
|
||||
syntax match jsObjectKey contained /\<[0-9a-zA-Z_$]*\>\(\s*:\)\@=/ contains=jsFunctionKey skipwhite skipempty nextgroup=jsObjectValue
|
||||
syntax match jsObjectKey contained /\<\K\k*\ze\s*:/ contains=jsFunctionKey skipwhite skipempty nextgroup=jsObjectValue
|
||||
syntax match jsObjectColon contained /:/ skipwhite skipempty
|
||||
syntax region jsObjectKeyString contained start=+"+ skip=+\\\("\|$\)+ end=+"\|$+ contains=jsSpecial,@Spell skipwhite skipempty nextgroup=jsObjectValue
|
||||
syntax region jsObjectKeyString contained start=+'+ skip=+\\\('\|$\)+ end=+'\|$+ contains=jsSpecial,@Spell skipwhite skipempty nextgroup=jsObjectValue
|
||||
syntax region jsObjectKeyString contained start=+\z(["']\)+ skip=+\\\%(\z1\|$\)+ end=+\z1\|$+ contains=jsSpecial,@Spell skipwhite skipempty nextgroup=jsObjectValue
|
||||
syntax region jsObjectKeyComputed contained matchgroup=jsBrackets start=/\[/ end=/]/ contains=@jsExpression skipwhite skipempty nextgroup=jsObjectValue,jsFuncArgs extend
|
||||
syntax match jsObjectSeparator contained /,/
|
||||
syntax region jsObjectValue contained matchgroup=jsNoise start=/:/ end=/\%(,\|}\)\@=/ contains=@jsExpression extend
|
||||
syntax match jsObjectFuncName contained /\<[a-zA-Z_$][0-9a-zA-Z_$]*\>[\r\n\t ]*(\@=/ skipwhite skipempty nextgroup=jsFuncArgs
|
||||
syntax match jsFunctionKey contained /\<[a-zA-Z_$][0-9a-zA-Z_$]*\>\(\s*:\s*function\s*\)\@=/
|
||||
syntax match jsObjectMethodType contained /\%(get\|set\)\%( \k\+\)\@=/ skipwhite skipempty nextgroup=jsObjectFuncName
|
||||
syntax region jsObjectStringKey contained start=+"+ skip=+\\\("\|$\)+ end=+"\|$+ contains=jsSpecial,@Spell extend skipwhite skipempty nextgroup=jsFuncArgs,jsObjectValue
|
||||
syntax region jsObjectStringKey contained start=+'+ skip=+\\\('\|$\)+ end=+'\|$+ contains=jsSpecial,@Spell extend skipwhite skipempty nextgroup=jsFuncArgs,jsObjectValue
|
||||
syntax region jsObjectValue contained matchgroup=jsNoise start=/:/ end=/[,}]\@=/ contains=@jsExpression extend
|
||||
syntax match jsObjectFuncName contained /\<\K\k*\ze\_s*(/ skipwhite skipempty nextgroup=jsFuncArgs
|
||||
syntax match jsFunctionKey contained /\<\K\k*\ze\s*:\s*function\>/
|
||||
syntax match jsObjectMethodType contained /\<[gs]et\ze\s\+\K\k*/ skipwhite skipempty nextgroup=jsObjectFuncName
|
||||
syntax region jsObjectStringKey contained start=+\z(["']\)+ skip=+\\\%(\z1\|$\)+ end=+\z1\|$+ contains=jsSpecial,@Spell extend skipwhite skipempty nextgroup=jsFuncArgs,jsObjectValue
|
||||
|
||||
exe 'syntax keyword jsNull null '.(exists('g:javascript_conceal_null') ? 'conceal cchar='.g:javascript_conceal_null : '')
|
||||
exe 'syntax keyword jsReturn return contained '.(exists('g:javascript_conceal_return') ? 'conceal cchar='.g:javascript_conceal_return : '').' skipwhite skipempty nextgroup=@jsExpression'
|
||||
@@ -101,8 +94,8 @@ exe 'syntax keyword jsThis this '.(exists('g:javascript_conceal
|
||||
exe 'syntax keyword jsSuper super contained '.(exists('g:javascript_conceal_super') ? 'conceal cchar='.g:javascript_conceal_super : '')
|
||||
|
||||
" Statement Keywords
|
||||
syntax match jsBlockLabel /\<[a-zA-Z_$][0-9a-zA-Z_$]*\>\s*::\@!/ contains=jsNoise skipwhite skipempty nextgroup=jsBlock
|
||||
syntax match jsBlockLabelKey contained /\<[a-zA-Z_$][0-9a-zA-Z_$]*\>\%(\s*\%(;\|\n\)\)\@=/
|
||||
syntax match jsBlockLabel /\<\K\k*\s*::\@!/ contains=jsNoise skipwhite skipempty nextgroup=jsBlock
|
||||
syntax match jsBlockLabelKey contained /\<\K\k*\ze\s*\_[;]/
|
||||
syntax keyword jsStatement contained with yield debugger
|
||||
syntax keyword jsStatement contained break continue skipwhite skipempty nextgroup=jsBlockLabelKey
|
||||
syntax keyword jsConditional if skipwhite skipempty nextgroup=jsParenIfElse
|
||||
@@ -119,7 +112,7 @@ syntax keyword jsAsyncKeyword async await
|
||||
syntax match jsSwitchColon contained /::\@!/ skipwhite skipempty nextgroup=jsSwitchBlock
|
||||
|
||||
" Keywords
|
||||
syntax keyword jsGlobalObjects Array Boolean Date Function Iterator Number Object Symbol Map WeakMap Set RegExp String Proxy Promise Buffer ParallelArray ArrayBuffer DataView Float32Array Float64Array Int16Array Int32Array Int8Array Uint16Array Uint32Array Uint8Array Uint8ClampedArray JSON Math console document window Intl Collator DateTimeFormat NumberFormat fetch
|
||||
syntax keyword jsGlobalObjects Array Boolean Date Function Iterator Number Object Symbol Map WeakMap Set WeakSet RegExp String Proxy Promise Buffer ParallelArray ArrayBuffer DataView Float32Array Float64Array Int16Array Int32Array Int8Array Uint16Array Uint32Array Uint8Array Uint8ClampedArray JSON Math console document window Intl Collator DateTimeFormat NumberFormat fetch
|
||||
syntax keyword jsGlobalNodeObjects module exports global process __dirname __filename
|
||||
syntax match jsGlobalNodeObjects /\<require\>/ containedin=jsFuncCall
|
||||
syntax keyword jsExceptions Error EvalError InternalError RangeError ReferenceError StopIteration SyntaxError TypeError URIError
|
||||
@@ -164,68 +157,68 @@ syntax region jsBlock matchgroup=jsBraces s
|
||||
syntax region jsModuleGroup contained matchgroup=jsModuleBraces start=/{/ end=/}/ contains=jsModuleKeyword,jsModuleComma,jsModuleAs,jsComment,jsFlowTypeKeyword skipwhite skipempty nextgroup=jsFrom fold
|
||||
syntax region jsSpreadExpression contained matchgroup=jsSpreadOperator start=/\.\.\./ end=/[,}\]]\@=/ contains=@jsExpression
|
||||
syntax region jsRestExpression contained matchgroup=jsRestOperator start=/\.\.\./ end=/[,)]\@=/
|
||||
syntax region jsTernaryIf matchgroup=jsTernaryIfOperator start=/?/ end=/\%(:\|[\}]\@=\)/ contains=@jsExpression extend skipwhite skipempty nextgroup=@jsExpression
|
||||
syntax region jsTernaryIf matchgroup=jsTernaryIfOperator start=/?/ end=/\%(:\|}\@=\)/ contains=@jsExpression extend skipwhite skipempty nextgroup=@jsExpression
|
||||
syntax match jsOperator /?\.\ze\_D/
|
||||
|
||||
syntax match jsGenerator contained /\*/ skipwhite skipempty nextgroup=jsFuncName,jsFuncArgs,jsFlowFunctionGroup
|
||||
syntax match jsFuncName contained /\<[a-zA-Z_$][0-9a-zA-Z_$]*\>/ skipwhite skipempty nextgroup=jsFuncArgs,jsFlowFunctionGroup
|
||||
syntax match jsFuncName contained /\<\K\k*/ skipwhite skipempty nextgroup=jsFuncArgs,jsFlowFunctionGroup
|
||||
syntax region jsFuncArgExpression contained matchgroup=jsFuncArgOperator start=/=/ end=/[,)]\@=/ contains=@jsExpression extend
|
||||
syntax match jsFuncArgCommas contained ','
|
||||
syntax keyword jsArguments contained arguments
|
||||
syntax keyword jsForAwait contained await skipwhite skipempty nextgroup=jsParenRepeat
|
||||
|
||||
" Matches a single keyword argument with no parens
|
||||
syntax match jsArrowFuncArgs /\k\+\s*\%(=>\)\@=/ skipwhite contains=jsFuncArgs skipwhite skipempty nextgroup=jsArrowFunction extend
|
||||
syntax match jsArrowFuncArgs /\<\K\k*\ze\s*=>/ skipwhite contains=jsFuncArgs skipwhite skipempty nextgroup=jsArrowFunction extend
|
||||
" Matches a series of arguments surrounded in parens
|
||||
syntax match jsArrowFuncArgs /([^()]*)\s*\(=>\)\@=/ contains=jsFuncArgs skipempty skipwhite nextgroup=jsArrowFunction extend
|
||||
syntax match jsArrowFuncArgs /([^()]*)\ze\s*=>/ contains=jsFuncArgs skipempty skipwhite nextgroup=jsArrowFunction extend
|
||||
|
||||
exe 'syntax match jsFunction /\<function\>/ skipwhite skipempty nextgroup=jsGenerator,jsFuncName,jsFuncArgs,jsFlowFunctionGroup skipwhite '.(exists('g:javascript_conceal_function') ? 'conceal cchar='.g:javascript_conceal_function : '')
|
||||
exe 'syntax match jsArrowFunction /=>/ skipwhite skipempty nextgroup=jsFuncBlock,jsCommentFunction '.(exists('g:javascript_conceal_arrow_function') ? 'conceal cchar='.g:javascript_conceal_arrow_function : '')
|
||||
exe 'syntax match jsArrowFunction /()\s*\(=>\)\@=/ skipwhite skipempty nextgroup=jsArrowFunction '.(exists('g:javascript_conceal_noarg_arrow_function') ? 'conceal cchar='.g:javascript_conceal_noarg_arrow_function : '').(' contains=jsArrowFuncArgs')
|
||||
exe 'syntax match jsArrowFunction /_\s*\(=>\)\@=/ skipwhite skipempty nextgroup=jsArrowFunction '.(exists('g:javascript_conceal_underscore_arrow_function') ? 'conceal cchar='.g:javascript_conceal_underscore_arrow_function : '')
|
||||
exe 'syntax match jsArrowFunction /()\ze\s*=>/ skipwhite skipempty nextgroup=jsArrowFunction '.(exists('g:javascript_conceal_noarg_arrow_function') ? 'conceal cchar='.g:javascript_conceal_noarg_arrow_function : '')
|
||||
exe 'syntax match jsArrowFunction /_\ze\s*=>/ skipwhite skipempty nextgroup=jsArrowFunction '.(exists('g:javascript_conceal_underscore_arrow_function') ? 'conceal cchar='.g:javascript_conceal_underscore_arrow_function : '')
|
||||
|
||||
" Classes
|
||||
syntax keyword jsClassKeyword contained class
|
||||
syntax keyword jsExtendsKeyword contained extends skipwhite skipempty nextgroup=@jsExpression
|
||||
syntax match jsClassNoise contained /\./
|
||||
syntax match jsClassMethodType contained /\%(get\|set\|static\)\%( \k\+\)\@=/ skipwhite skipempty nextgroup=jsAsyncKeyword,jsFuncName,jsClassProperty
|
||||
syntax match jsClassMethodType contained /\<\%([gs]et\|static\)\ze\s\+\K\k*/ skipwhite skipempty nextgroup=jsAsyncKeyword,jsFuncName,jsClassProperty
|
||||
syntax region jsClassDefinition start=/\<class\>/ end=/\(\<extends\>\s\+\)\@<!{\@=/ contains=jsClassKeyword,jsExtendsKeyword,jsClassNoise,@jsExpression,jsFlowClassGroup skipwhite skipempty nextgroup=jsCommentClass,jsClassBlock,jsFlowClassGroup
|
||||
syntax match jsClassProperty contained /\<[0-9a-zA-Z_$]*\>\(\s*[=:]\)\@=/ skipwhite skipempty nextgroup=jsClassValue,jsFlowClassDef
|
||||
syntax region jsClassValue contained start=/=/ end=/\%(;\|}\|\n\)\@=/ contains=@jsExpression
|
||||
syntax match jsClassProperty contained /\<\K\k*\ze\s*=/ skipwhite skipempty nextgroup=jsClassValue,jsFlowClassDef
|
||||
syntax region jsClassValue contained start=/=/ end=/\_[;}]\@=/ contains=@jsExpression
|
||||
syntax region jsClassPropertyComputed contained matchgroup=jsBrackets start=/\[/ end=/]/ contains=@jsExpression skipwhite skipempty nextgroup=jsFuncArgs,jsClassValue extend
|
||||
syntax match jsClassFuncName contained /\<[a-zA-Z_$][0-9a-zA-Z_$]*\>\%(\s*(\)\@=/ skipwhite skipempty nextgroup=jsFuncArgs
|
||||
syntax region jsClassStringKey contained start=+"+ skip=+\\\("\|$\)+ end=+"\|$+ contains=jsSpecial,@Spell extend skipwhite skipempty nextgroup=jsFuncArgs
|
||||
syntax region jsClassStringKey contained start=+'+ skip=+\\\('\|$\)+ end=+'\|$+ contains=jsSpecial,@Spell extend skipwhite skipempty nextgroup=jsFuncArgs
|
||||
syntax match jsClassFuncName contained /\<\K\k*\ze\s*(/ skipwhite skipempty nextgroup=jsFuncArgs
|
||||
syntax region jsClassStringKey contained start=+\z(["']\)+ skip=+\\\%(\z1\|$\)+ end=+\z1\|$+ contains=jsSpecial,@Spell extend skipwhite skipempty nextgroup=jsFuncArgs
|
||||
|
||||
" Destructuring
|
||||
syntax match jsDestructuringPropertyValue contained /\<[0-9a-zA-Z_$]*\>/
|
||||
syntax match jsDestructuringProperty contained /\<[0-9a-zA-Z_$]*\>\(\s*=\)\@=/ skipwhite skipempty nextgroup=jsDestructuringValue
|
||||
syntax match jsDestructuringAssignment contained /\<[0-9a-zA-Z_$]*\>\(\s*:\)\@=/ skipwhite skipempty nextgroup=jsDestructuringValueAssignment
|
||||
syntax match jsDestructuringPropertyValue contained /\k\+/
|
||||
syntax match jsDestructuringProperty contained /\k\+\ze\s*=/ skipwhite skipempty nextgroup=jsDestructuringValue
|
||||
syntax match jsDestructuringAssignment contained /\k\+\ze\s*:/ skipwhite skipempty nextgroup=jsDestructuringValueAssignment
|
||||
syntax region jsDestructuringValue contained start=/=/ end=/[,}\]]\@=/ contains=@jsExpression extend
|
||||
syntax region jsDestructuringValueAssignment contained start=/:/ end=/[,}=]\@=/ contains=jsDestructuringPropertyValue,jsDestructuringBlock,jsNoise,jsDestructuringNoise skipwhite skipempty nextgroup=jsDestructuringValue extend
|
||||
syntax match jsDestructuringNoise contained /[,\[\]]/
|
||||
syntax match jsDestructuringNoise contained /[,[\]]/
|
||||
syntax region jsDestructuringPropertyComputed contained matchgroup=jsBrackets start=/\[/ end=/]/ contains=@jsExpression skipwhite skipempty nextgroup=jsDestructuringValue,jsDestructuringNoise extend fold
|
||||
|
||||
" Comments
|
||||
syntax keyword jsCommentTodo contained TODO FIXME XXX TBD
|
||||
syntax region jsComment start=/\/\// end=/$/ contains=jsCommentTodo,@Spell extend keepend
|
||||
syntax region jsComment start=/\/\*/ end=/\*\// contains=jsCommentTodo,@Spell fold extend keepend
|
||||
syntax region jsComment start=+//+ end=/$/ contains=jsCommentTodo,@Spell extend keepend
|
||||
syntax region jsComment start=+/\*+ end=+\*/+ contains=jsCommentTodo,@Spell fold extend keepend
|
||||
syntax region jsEnvComment start=/\%^#!/ end=/$/ display
|
||||
|
||||
" Specialized Comments - These are special comment regexes that are used in
|
||||
" odd places that maintain the proper nextgroup functionality. It sucks we
|
||||
" can't make jsComment a skippable type of group for nextgroup
|
||||
syntax region jsCommentFunction contained start=/\/\// end=/$/ contains=jsCommentTodo,@Spell skipwhite skipempty nextgroup=jsFuncBlock,jsFlowReturn extend keepend
|
||||
syntax region jsCommentFunction contained start=/\/\*/ end=/\*\// contains=jsCommentTodo,@Spell skipwhite skipempty nextgroup=jsFuncBlock,jsFlowReturn fold extend keepend
|
||||
syntax region jsCommentClass contained start=/\/\// end=/$/ contains=jsCommentTodo,@Spell skipwhite skipempty nextgroup=jsClassBlock,jsFlowClassGroup extend keepend
|
||||
syntax region jsCommentClass contained start=/\/\*/ end=/\*\// contains=jsCommentTodo,@Spell skipwhite skipempty nextgroup=jsClassBlock,jsFlowClassGroup fold extend keepend
|
||||
syntax region jsCommentIfElse contained start=/\/\// end=/$/ contains=jsCommentTodo,@Spell skipwhite skipempty nextgroup=jsIfElseBlock extend keepend
|
||||
syntax region jsCommentIfElse contained start=/\/\*/ end=/\*\// contains=jsCommentTodo,@Spell skipwhite skipempty nextgroup=jsIfElseBlock fold extend keepend
|
||||
syntax region jsCommentRepeat contained start=/\/\// end=/$/ contains=jsCommentTodo,@Spell skipwhite skipempty nextgroup=jsRepeatBlock extend keepend
|
||||
syntax region jsCommentRepeat contained start=/\/\*/ end=/\*\// contains=jsCommentTodo,@Spell skipwhite skipempty nextgroup=jsRepeatBlock fold extend keepend
|
||||
syntax region jsCommentFunction contained start=+//+ end=/$/ contains=jsCommentTodo,@Spell skipwhite skipempty nextgroup=jsFuncBlock,jsFlowReturn extend keepend
|
||||
syntax region jsCommentFunction contained start=+/\*+ end=+\*/+ contains=jsCommentTodo,@Spell skipwhite skipempty nextgroup=jsFuncBlock,jsFlowReturn fold extend keepend
|
||||
syntax region jsCommentClass contained start=+//+ end=/$/ contains=jsCommentTodo,@Spell skipwhite skipempty nextgroup=jsClassBlock,jsFlowClassGroup extend keepend
|
||||
syntax region jsCommentClass contained start=+/\*+ end=+\*/+ contains=jsCommentTodo,@Spell skipwhite skipempty nextgroup=jsClassBlock,jsFlowClassGroup fold extend keepend
|
||||
syntax region jsCommentIfElse contained start=+//+ end=/$/ contains=jsCommentTodo,@Spell skipwhite skipempty nextgroup=jsIfElseBlock extend keepend
|
||||
syntax region jsCommentIfElse contained start=+/\*+ end=+\*/+ contains=jsCommentTodo,@Spell skipwhite skipempty nextgroup=jsIfElseBlock fold extend keepend
|
||||
syntax region jsCommentRepeat contained start=+//+ end=/$/ contains=jsCommentTodo,@Spell skipwhite skipempty nextgroup=jsRepeatBlock extend keepend
|
||||
syntax region jsCommentRepeat contained start=+/\*+ end=+\*/+ contains=jsCommentTodo,@Spell skipwhite skipempty nextgroup=jsRepeatBlock fold extend keepend
|
||||
|
||||
" Decorators
|
||||
syntax match jsDecorator /^\s*@/ nextgroup=jsDecoratorFunction
|
||||
syntax match jsDecoratorFunction contained /[a-zA-Z_][a-zA-Z0-9_.]*/ nextgroup=jsParenDecorator
|
||||
syntax match jsDecoratorFunction contained /\h[a-zA-Z0-9_.]*/ nextgroup=jsParenDecorator
|
||||
|
||||
if exists("javascript_plugin_jsdoc")
|
||||
runtime extras/jsdoc.vim
|
||||
|
||||
@@ -13,12 +13,8 @@ if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'perl') == -1
|
||||
" - Fix <%text> blocks to show HTML tags but ignore Mason tags.
|
||||
"
|
||||
|
||||
" Clear previous syntax settings unless this is v6 or above, in which case just
|
||||
" exit without doing anything.
|
||||
"
|
||||
if version < 600
|
||||
syn clear
|
||||
elseif exists("b:current_syntax")
|
||||
" quit when a syntax file was already loaded
|
||||
if exists("b:current_syntax")
|
||||
finish
|
||||
endif
|
||||
|
||||
@@ -30,26 +26,16 @@ endif
|
||||
|
||||
" First pull in the HTML syntax.
|
||||
"
|
||||
if version < 600
|
||||
so <sfile>:p:h/html.vim
|
||||
else
|
||||
runtime! syntax/html.vim
|
||||
unlet b:current_syntax
|
||||
endif
|
||||
runtime! syntax/html.vim
|
||||
unlet b:current_syntax
|
||||
|
||||
syn cluster htmlPreproc add=@masonTop
|
||||
|
||||
" Now pull in the Perl syntax.
|
||||
"
|
||||
if version < 600
|
||||
syn include @perlTop <sfile>:p:h/perl.vim
|
||||
unlet b:current_syntax
|
||||
syn include @podTop <sfile>:p:h/pod.vim
|
||||
else
|
||||
syn include @perlTop syntax/perl.vim
|
||||
unlet b:current_syntax
|
||||
syn include @podTop syntax/pod.vim
|
||||
endif
|
||||
syn include @perlTop syntax/perl.vim
|
||||
unlet b:current_syntax
|
||||
syn include @podTop syntax/pod.vim
|
||||
|
||||
" It's hard to reduce down to the correct sub-set of Perl to highlight in some
|
||||
" of these cases so I've taken the safe option of just using perlTop in all of
|
||||
@@ -88,21 +74,9 @@ syn cluster masonTop contains=masonLine,masonExpr,masonPerl,masonComp,masonArgs,
|
||||
|
||||
" Set up default highlighting. Almost all of this is done in the included
|
||||
" syntax files.
|
||||
"
|
||||
if version >= 508 || !exists("did_mason_syn_inits")
|
||||
if version < 508
|
||||
let did_mason_syn_inits = 1
|
||||
com -nargs=+ HiLink hi link <args>
|
||||
else
|
||||
com -nargs=+ HiLink hi def link <args>
|
||||
endif
|
||||
|
||||
HiLink masonDoc Comment
|
||||
HiLink masonPod Comment
|
||||
HiLink masonPerlComment perlComment
|
||||
|
||||
delc HiLink
|
||||
endif
|
||||
hi def link masonDoc Comment
|
||||
hi def link masonPod Comment
|
||||
hi def link masonPerlComment perlComment
|
||||
|
||||
let b:current_syntax = "mason"
|
||||
|
||||
|
||||
@@ -92,32 +92,33 @@ endif
|
||||
|
||||
if nim_highlight_builtins == 1
|
||||
" builtin functions, types and objects, not really part of the syntax
|
||||
syn keyword nimBuiltin int int8 int16 int32 int64 uint uint8 uint16 uint32 uint64 float float32 float64 bool
|
||||
syn keyword nimBuiltin char string cstring pointer range array openarray seq
|
||||
syn keyword nimBuiltin int int8 int16 int32 int64 uint uint8 uint16 uint32 uint64 float float32 float64
|
||||
syn keyword nimBuiltin bool void chr char string cstring pointer range array openarray openArray seq varargs varArgs
|
||||
syn keyword nimBuiltin set Byte Natural Positive Conversion
|
||||
syn keyword nimBuiltin BiggestInt BiggestFloat cchar cschar cshort cint csize cuchar cushort
|
||||
syn keyword nimBuiltin clong clonglong cfloat cdouble clongdouble cuint culong culonglong cchar
|
||||
syn keyword nimBuiltin CompileDate CompileTime nimVersion nimMajor
|
||||
syn keyword nimBuiltin nimMinor nimPatch cpuEndian hostOS hostCPU inf
|
||||
syn keyword nimBuiltin neginf nan QuitSuccess QuitFailure dbgLineHook stdin
|
||||
syn keyword nimBuiltin CompileDate CompileTime nimversion nimVersion nimmajor nimMajor
|
||||
syn keyword nimBuiltin nimminor nimMinor nimpatch nimPatch cpuendian cpuEndian hostos hostOS hostcpu hostCPU inf
|
||||
syn keyword nimBuiltin neginf nan QuitSuccess QuitFailure dbglinehook dbgLineHook stdin
|
||||
syn keyword nimBuiltin stdout stderr defined new high low sizeof succ pred
|
||||
syn keyword nimBuiltin inc dec newSeq len incl excl card ord chr ze ze64
|
||||
syn keyword nimBuiltin toU8 toU16 toU32 abs min max add repr
|
||||
syn keyword nimBuiltin inc dec newseq newSeq len incl excl card ord chr ze ze64
|
||||
syn keyword nimBuiltin tou8 toU8 tou16 toU16 tou32 toU32 abs min max add repr
|
||||
syn match nimBuiltin "\<contains\>"
|
||||
syn keyword nimBuiltin toFloat toBiggestFloat toInt toBiggestInt addQuitProc
|
||||
syn keyword nimBuiltin copy setLen newString zeroMem copyMem moveMem
|
||||
syn keyword nimBuiltin equalMem alloc alloc0 realloc dealloc setLen assert
|
||||
syn keyword nimBuiltin swap getRefcount getCurrentException Msg
|
||||
syn keyword nimBuiltin getOccupiedMem getFreeMem getTotalMem isNil seqToPtr
|
||||
syn keyword nimBuiltin tofloat toFloat tobiggestfloat toBiggestFloat toint toInt tobiggestint toBiggestInt
|
||||
syn keyword nimBuiltin addquitproc addQuitProc
|
||||
syn keyword nimBuiltin copy setlen setLen newstring newString zeromem zeroMem copymem copyMem movemem moveMem
|
||||
syn keyword nimBuiltin equalmem equalMem alloc alloc0 realloc dealloc assert
|
||||
syn keyword nimBuiltin echo swap getrefcount getRefcount getcurrentexception getCurrentException Msg
|
||||
syn keyword nimBuiltin getoccupiedmem getOccupiedMem getfreemem getFreeMem gettotalmem getTotalMem isnil isNil seqtoptr seqToPtr
|
||||
syn keyword nimBuiltin find pop GC_disable GC_enable GC_fullCollect
|
||||
syn keyword nimBuiltin GC_setStrategy GC_enableMarkAndSweep GC_Strategy
|
||||
syn keyword nimBuiltin GC_disableMarkAnd Sweep GC_getStatistics GC_ref
|
||||
syn keyword nimBuiltin GC_ref GC_ref GC_unref GC_unref GC_unref quit
|
||||
syn keyword nimBuiltin OpenFile OpenFile CloseFile EndOfFile readChar
|
||||
syn keyword nimBuiltin FlushFile readFile write readLine writeln writeln
|
||||
syn keyword nimBuiltin getFileSize ReadBytes ReadChars readBuffer writeBytes
|
||||
syn keyword nimBuiltin writeChars writeBuffer setFilePos getFilePos
|
||||
syn keyword nimBuiltin fileHandle countdown countup items lines
|
||||
syn keyword nimBuiltin FlushFile readfile readFile readline readLine write writeln writeLn writeline writeLine
|
||||
syn keyword nimBuiltin getfilesize getFileSize ReadBytes ReadChars readbuffer readBuffer writebytes writeBytes
|
||||
syn keyword nimBuiltin writechars writeChars writebuffer writeBuffer setfilepos setFilePos getfilepos getFilePos
|
||||
syn keyword nimBuiltin filehandle fileHandle countdown countup items lines
|
||||
syn keyword nimBuiltin FileMode File RootObj FileHandle ByteAddress Endianness
|
||||
endif
|
||||
|
||||
|
||||
260
syntax/nix.vim
260
syntax/nix.vim
@@ -1,131 +1,187 @@
|
||||
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'nix') == -1
|
||||
|
||||
"
|
||||
" Syntax file for Nix
|
||||
"
|
||||
" TODO:
|
||||
" Emphasize :
|
||||
" Deemphasize ;
|
||||
" Consistent ()
|
||||
" rec (red?)
|
||||
" Vim syntax file
|
||||
" Language: Nix
|
||||
" Maintainer: Daiderd Jordan <daiderd@gmail.com>
|
||||
" URL: https://github.com/LnL7/vim-nix
|
||||
|
||||
if exists("b:current_syntax")
|
||||
finish
|
||||
finish
|
||||
endif
|
||||
|
||||
" Operators
|
||||
syn match nixOperator "\V++"
|
||||
syn match nixOperator "\V+"
|
||||
syn match nixOperator "\V!"
|
||||
syn match nixOperator "\V=="
|
||||
syn match nixOperator "\V!="
|
||||
syn match nixOperator "\V&&"
|
||||
syn match nixOperator "\V||"
|
||||
syn match nixOperator "\V->"
|
||||
syn keyword nixBoolean true false
|
||||
syn keyword nixNull null
|
||||
syn keyword nixRecKeyword rec
|
||||
|
||||
syn match nixOperator "\V-"
|
||||
syn match nixOperator "\V*"
|
||||
syn match nixOperator "\V/"
|
||||
syn match nixOperator "\V>"
|
||||
syn match nixOperator "\V<"
|
||||
syn keyword nixOperator or
|
||||
syn match nixOperator '!=\|!'
|
||||
syn match nixOperator '<=\?'
|
||||
syn match nixOperator '>=\?'
|
||||
syn match nixOperator '&&'
|
||||
syn match nixOperator '//\='
|
||||
syn match nixOperator '=='
|
||||
syn match nixOperator '?'
|
||||
syn match nixOperator '||'
|
||||
syn match nixOperator '++\='
|
||||
syn match nixOperator '-'
|
||||
syn match nixOperator '\*'
|
||||
syn match nixOperator '->'
|
||||
|
||||
" Keywords
|
||||
syn keyword nixKeyword let in or assert inherit null with rec
|
||||
syn keyword nixConditional if else then
|
||||
syn keyword nixBoolean true false
|
||||
syn match nixParen '[()]'
|
||||
syn match nixInteger '\d\+'
|
||||
|
||||
" Builtins
|
||||
syn keyword nixBuiltin builtins abort add attrNames attrValues
|
||||
\ baseNameOf compareVersions concatLists currentSystem deepSeq
|
||||
\ derivation dirOf div elem elemAt filter filterSource fromJSON
|
||||
\ getAttr getEnv hasAttr hashString head import intersectAttrs
|
||||
\ isAttrs isList isFunction isString isInt isBool isNull length
|
||||
\ lessThan listToAttrs map mul parseDrvNames pathExists readDir
|
||||
\ readFile removeAttrs seq stringLength sub substring tail throw
|
||||
\ toFile toJSON toPath toString toXML trace typeOf tryEval
|
||||
syn keyword nixTodo FIXME NOTE TODO OPTIMIZE XXX HACK contained
|
||||
syn match nixComment '#.*' contains=nixTodo,@Spell
|
||||
syn region nixComment start=+/\*+ end=+\*/+ contains=nixTodo,@Spell
|
||||
|
||||
syn match nixpkgs "<nixpkgs>"
|
||||
syn match nixSpecialOper "\V@\|;\|,\|?\|..."
|
||||
syn region nixInterpolation matchgroup=nixInterpolationDelimiter start="\${" end="}" contained contains=@nixExpr,nixInterpolationParam
|
||||
|
||||
" Attribute Lists
|
||||
"syn match nixBrace "\v[(){}\[\]]|rec\s*\{"
|
||||
syn region nixSet matchgroup=nixBraces start="{" end="}" contains=ALL
|
||||
syn region nixRecSet matchgroup=nixBraces start="rec\s*{" end="}" contains=ALL
|
||||
syn region nixList matchgroup=nixBraces start="\[" end="\]" contains=ALLBUT,nixAttr
|
||||
syn match nixAttr "\v[0-9A-Za-z\-\_]+\ze\s*\=" contained
|
||||
syn match nixSimpleStringSpecial /\\["nrt\\$]/ contained
|
||||
syn match nixInterpolationSpecial /''['$]/ contained
|
||||
|
||||
syn match nixInteger "\v<\d+>"
|
||||
syn region nixSimpleString matchgroup=nixStringDelimiter start=+"+ skip=+\\"+ end=+"+ contains=nixInterpolation,nixSimpleStringSpecial
|
||||
syn region nixString matchgroup=nixStringDelimiter start=+''+ skip=+''['$]+ end=+''+ contains=nixInterpolation,nixInterpolationSpecial
|
||||
|
||||
" Functions
|
||||
syn match nixFuncArg "\v\zs\w+\ze\s*:"
|
||||
syn match nixFunctionCall "[a-zA-Z_][a-zA-Z0-9_'-]*"
|
||||
|
||||
" TODO: Exclude ; and other illegal characters
|
||||
syn match nixPath "\v\S*/\S+|\S+/\S*"
|
||||
syn match nixPath "[a-zA-Z0-9._+-]*\%(/[a-zA-Z0-9._+-]\+\)\+"
|
||||
syn match nixHomePath "\~\%(/[a-zA-Z0-9._+-]\+\)\+"
|
||||
syn match nixSearchPath "[a-zA-Z0-9._+-]\+\%(\/[a-zA-Z0-9._+-]\+\)*" contained
|
||||
syn match nixPathDelimiter "[<>]" contained
|
||||
syn match nixSearchPathRef "<[a-zA-Z0-9._+-]\+\%(\/[a-zA-Z0-9._+-]\+\)*>" contains=nixSearchPath,nixPathDelimiter
|
||||
syn match nixURI "[a-zA-Z][a-zA-Z0-9.+-]*:[a-zA-Z0-9%/?:@&=$,_.!~*'+-]\+"
|
||||
|
||||
" This operator is placed after nixPath to override nixPath's highlighting
|
||||
syn match nixOperator "\V//"
|
||||
syn match nixAttributeDot "\." contained
|
||||
syn match nixAttribute "[a-zA-Z_][a-zA-Z0-9_'-]*\ze\%([^a-zA-Z0-9_'-.]\|$\)" contained
|
||||
syn region nixAttributeAssignment start="=" end="\ze;" contained contains=@nixExpr
|
||||
syn region nixAttributeDefinition start=/\ze[a-zA-Z_"$]/ end=";" contained contains=nixComment,nixAttribute,nixInterpolation,nixSimpleString,nixAttributeDot,nixAttributeAssignment
|
||||
|
||||
" Strings
|
||||
syn match nixStringIndentedEscapes +'''\|''\${\|''\\n\|''\\r\|''\\t+
|
||||
syn match nixStringEscapes +\\"\|\\\${\|\\n\|\\r\|\\t\|\\\\+
|
||||
syn region nixStringIndented
|
||||
\ start=+''+
|
||||
\ skip=+'''+
|
||||
\ end=+''+
|
||||
\ contains=nixAntiquotation,nixStringIndentedEscapes
|
||||
syn region nixString
|
||||
\ start=+"+
|
||||
\ skip=+\\"+
|
||||
\ end=+"+
|
||||
\ contains=nixAntiquotation,nixStringEscapes
|
||||
syn region nixInheritAttributeScope start="(" end=")" contained contains=nixComment,nixAttributeDot
|
||||
syn region nixAttributeDefinition matchgroup=nixInherit start="\<inherit\>" end=";" contained contains=nixComment,nixInheritAttributeScope,nixAttribute
|
||||
|
||||
" If this contains nixBrace, it ignores its own closing brace and syntax gets
|
||||
" thrown way off contains=ALLBUT,nixBrace
|
||||
syn region nixAntiquotation start=+\${+ end=+}+ contains=nixAntiQuotation
|
||||
syn region nixAttributeSet start="{" end="}" contains=nixComment,nixAttributeDefinition
|
||||
|
||||
" Comments
|
||||
syn region nixMultiLineComment start=+/\*+ skip=+\\"+ end=+\*/+ contains=nixTodos
|
||||
syn match nixEndOfLineComment "#.*$" contains=nixTodos
|
||||
syntax keyword nixTodos TODO XXX FIXME NOTE TODOS contained
|
||||
" vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv
|
||||
syn region nixArgumentDefinitionWithDefault matchgroup=nixArgumentDefinition start="[a-zA-Z_][a-zA-Z0-9_'-]*\ze\%(\s\|#.\{-\}\n\|\n\|/\*\_.\{-\}\*/\)*?\@=" matchgroup=NONE end="[,}]\@=" transparent contained contains=@nixExpr
|
||||
" vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv
|
||||
syn match nixArgumentDefinition "[a-zA-Z_][a-zA-Z0-9_'-]*\ze\%(\s\|#.\{-\}\n\|\n\|/\*\_.\{-\}\*/\)*[,}]\@=" contained
|
||||
syn match nixArgumentEllipsis "\.\.\." contained
|
||||
syn match nixArgumentSeparator "," contained
|
||||
|
||||
" Special (Delimiter
|
||||
hi def link nixBraces Delimiter
|
||||
hi def link nixpkgs Special
|
||||
hi def link nixSpecialOper Special
|
||||
hi def link nixStringIndentedEscapes SpecialChar
|
||||
hi def link nixStringEscapes SpecialChar
|
||||
hi def link nixBuiltin Special
|
||||
hi def link nixOperator Operator
|
||||
" vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv
|
||||
syn match nixArgOperator '@\%(\s\|#.\{-\}\n\|\n\|/\*\_.\{-\}\*/\)*[a-zA-Z_][a-zA-Z0-9_'-]*\%(\s\|#.\{-\}\n\|\n\|/\*\_.\{-\}\*/\)*:'he=s+1 contained contains=nixAttribute
|
||||
|
||||
" Constants
|
||||
hi def link nixBoolean Boolean
|
||||
hi def link nixInteger Number
|
||||
hi def link nixString String
|
||||
hi def link nixStringIndented String
|
||||
" vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv
|
||||
syn match nixArgOperator '[a-zA-Z_][a-zA-Z0-9_'-]*\%(\s\|#.\{-\}\n\|\n\|/\*\_.\{-\}\*/\)*@'hs=e-1 contains=nixAttribute nextgroup=nixFunctionArgument
|
||||
|
||||
" Comments
|
||||
hi def link nixMultiLineComment Comment
|
||||
hi def link nixEndOfLineComment Comment
|
||||
" This is a bit more complicated, because function arguments can be passed in a
|
||||
" very similar form on how attribute sets are defined and two regions with the
|
||||
" same start patterns will shadow each other. Instead of a region we could use a
|
||||
" match on {\_.\{-\}}, which unfortunately doesn't take nesting into account.
|
||||
"
|
||||
" So what we do instead is that we look forward until we are sure that it's a
|
||||
" function argument. Unfortunately, we need to catch comments and both vertical
|
||||
" and horizontal white space, which the following regex should hopefully do:
|
||||
"
|
||||
" "\%(\s\|#.\{-\}\n\|\n\|/\*\_.\{-\}\*/\)*"
|
||||
"
|
||||
" It is also used throught the whole file and is marked with 'v's as well.
|
||||
"
|
||||
" Fortunately the matching rules for function arguments are much simpler than
|
||||
" for real attribute sets, because we can stop when we hit the first ellipsis or
|
||||
" default value operator, but we also need to paste the "whitespace & comments
|
||||
" eating" regex all over the place (marked with 'v's):
|
||||
"
|
||||
" Region match 1: { foo ? ... } or { foo, ... } or { ... } (ellipsis)
|
||||
" vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv {----- identifier -----}vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv
|
||||
syn region nixFunctionArgument start="{\ze\%(\s\|#.\{-\}\n\|\n\|/\*\_.\{-\}\*/\)*\%([a-zA-Z_][a-zA-Z0-9_'-]*\%(\s\|#.\{-\}\n\|\n\|/\*\_.\{-\}\*/\)*[,?}]\|\.\.\.\)" end="}" contains=nixComment,nixArgumentDefinitionWithDefault,nixArgumentDefinition,nixArgumentEllipsis,nixArgumentSeparator nextgroup=nixArgOperator
|
||||
|
||||
" Identifiers
|
||||
hi def link nixConditional Conditional
|
||||
hi def link nixKeyword Keyword
|
||||
hi def link nixOperator Operator
|
||||
hi def link nixException Exception
|
||||
hi def link nixAttr Identifier
|
||||
hi def link nixFuncArg Identifier
|
||||
" Now it gets more tricky, because we need to look forward for the colon, but
|
||||
" there could be something like "{}@foo:", even though it's highly unlikely.
|
||||
"
|
||||
" Region match 2: {}
|
||||
" vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv@vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv{----- identifier -----} vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv
|
||||
syn region nixFunctionArgument start="{\ze\%(\s\|#.\{-\}\n\|\n\|/\*\_.\{-\}\*/\)*}\%(\%(\s\|#.\{-\}\n\|\n\|/\*\_.\{-\}\*/\)*@\%(\s\|#.\{-\}\n\|\n\|/\*\_.\{-\}\*/\)*[a-zA-Z_][a-zA-Z0-9_'-]*\)\%(\s\|#.\{-\}\n\|\n\|/\*\_.\{-\}\*/\)*:" end="}" contains=nixComment nextgroup=nixArgOperator
|
||||
|
||||
" PreProc
|
||||
hi def link nixAntiquotation Macro
|
||||
" vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv
|
||||
syn match nixSimpleFunctionArgument "[a-zA-Z_][a-zA-Z0-9_'-]*\ze\%(\s\|#.\{-\}\n\|\n\|/\*\_.\{-\}\*/\)*:/\@!"
|
||||
|
||||
" Underlined (html links)
|
||||
hi def link nixPath Underlined
|
||||
syn region nixList matchgroup=nixListBracket start="\[" end="\]" contains=@nixExpr
|
||||
|
||||
" Error
|
||||
syn region nixLetExpr matchgroup=nixLetExprKeyword start="\<let\>" end="\<in\>" contains=nixComment,nixAttributeDefinition
|
||||
|
||||
syn sync maxlines=20000
|
||||
syn sync minlines=50000
|
||||
syn keyword nixIfExprKeyword then contained
|
||||
syn region nixIfExpr matchgroup=nixIfExprKeyword start="\<if\>" end="\<else\>" contains=@nixExpr,nixIfExprKeyword
|
||||
|
||||
let b:current_syntax = 'nix'
|
||||
syn region nixWithExpr matchgroup=nixWithExprKeyword start="\<with\>" matchgroup=NONE end=";" contains=@nixExpr
|
||||
|
||||
syn region nixAssertExpr matchgroup=nixAssertKeyword start="\<assert\>" matchgroup=NONE end=";" contains=@nixExpr
|
||||
|
||||
syn cluster nixExpr contains=nixBoolean,nixNull,nixOperator,nixParen,nixInteger,nixRecKeyword,nixConditional,nixBuiltin,nixSimpleBuiltin,nixComment,nixFunctionCall,nixFunctionArgument,nixSimpleFunctionArgument,nixPath,nixHomePath,nixSearchPathRef,nixURI,nixAttributeSet,nixList,nixSimpleString,nixString,nixLetExpr,nixIfExpr,nixWithExpr,nixAssertExpr
|
||||
|
||||
" These definitions override @nixExpr and have to come afterwards:
|
||||
|
||||
syn match nixInterpolationParam "[a-zA-Z_][a-zA-Z0-9_'-]*\%(\.[a-zA-Z_][a-zA-Z0-9_'-]*\)*" contained
|
||||
|
||||
" Non-namespaced Nix builtins as of version 1.10:
|
||||
syn keyword nixSimpleBuiltin
|
||||
\ abort baseNameOf derivation dirOf fetchTarball import map removeAttrs
|
||||
\ throw toString
|
||||
|
||||
" Namespaced and non-namespaced Nix builtins as of version 1.10:
|
||||
syn keyword nixNamespacedBuiltin contained
|
||||
\ abort add all any attrNames attrValues baseNameOf compareVersions
|
||||
\ concatLists currentSystem deepSeq derivation dirOf div elem elemAt
|
||||
\ fetchTarball fetchurl filter filterSource foldl' fromJSON genList
|
||||
\ getAttr getEnv hasAttr hashString head import intersectAttrs isAttrs
|
||||
\ isBool isFunction isInt isList isString length lessThan listToAttrs map
|
||||
\ mul parseDrvName pathExists readDir readFile removeAttrs replaceStrings
|
||||
\ seq sort stringLength sub substring tail throw toFile toJSON toPath
|
||||
\ toString toXML trace typeOf
|
||||
|
||||
syn match nixBuiltin "builtins\.[a-zA-Z']\+"he=s+9 contains=nixComment,nixNamespacedBuiltin
|
||||
|
||||
hi def link nixArgOperator Operator
|
||||
hi def link nixArgumentDefinition Identifier
|
||||
hi def link nixArgumentEllipsis Operator
|
||||
hi def link nixAssertKeyword Keyword
|
||||
hi def link nixAttribute Identifier
|
||||
hi def link nixAttributeDot Operator
|
||||
hi def link nixBoolean Boolean
|
||||
hi def link nixBuiltin Special
|
||||
hi def link nixComment Comment
|
||||
hi def link nixConditional Conditional
|
||||
hi def link nixHomePath Include
|
||||
hi def link nixIfExprKeyword Keyword
|
||||
hi def link nixInherit Keyword
|
||||
hi def link nixInteger Integer
|
||||
hi def link nixInterpolation Macro
|
||||
hi def link nixInterpolationDelimiter Delimiter
|
||||
hi def link nixInterpolationParam Macro
|
||||
hi def link nixInterpolationSpecial Special
|
||||
hi def link nixLetExprKeyword Keyword
|
||||
hi def link nixNamespacedBuiltin Special
|
||||
hi def link nixNull Constant
|
||||
hi def link nixOperator Operator
|
||||
hi def link nixPath Include
|
||||
hi def link nixPathDelimiter Delimiter
|
||||
hi def link nixRecKeyword Keyword
|
||||
hi def link nixSearchPath Include
|
||||
hi def link nixSimpleBuiltin Keyword
|
||||
hi def link nixSimpleFunctionArgument Identifier
|
||||
hi def link nixSimpleString String
|
||||
hi def link nixSimpleStringSpecial SpecialChar
|
||||
hi def link nixString String
|
||||
hi def link nixStringDelimiter Delimiter
|
||||
hi def link nixTodo Todo
|
||||
hi def link nixURI Include
|
||||
hi def link nixWithExprKeyword Keyword
|
||||
|
||||
" This could lead up to slow syntax highlighting for large files, but usually
|
||||
" large files such as all-packages.nix are one large attribute set, so if we'd
|
||||
" use sync patterns we'd have to go back to the start of the file anyway
|
||||
syn sync fromstart
|
||||
|
||||
let b:current_syntax = "nix"
|
||||
|
||||
endif
|
||||
|
||||
@@ -1,93 +0,0 @@
|
||||
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'openscad') == -1
|
||||
|
||||
" Vim syntax file
|
||||
" Language: OpenSCAD
|
||||
" Maintainer: Sirtaj Singh Kang <sirtaj-vim@sirtaj.net>
|
||||
" Last Changed: 2013 March 05
|
||||
|
||||
if version < 600
|
||||
syntax clear
|
||||
elseif exists("b:current_syntax")
|
||||
finish
|
||||
endif
|
||||
|
||||
|
||||
"syn keyword openscadFunctionDef function
|
||||
syn keyword openscadFunctionDef function nextgroup=openscadFunction skipwhite skipempty
|
||||
syn match openscadFunction /\<\h\w*\>/ contained display
|
||||
|
||||
"syn keyword openscadModuleDef module
|
||||
syn keyword openscadModuleDef module nextgroup=openscadModule skipwhite skipempty
|
||||
syn match openscadModule /\<\h\w*\>/ contained display
|
||||
|
||||
syn keyword openscadStatement echo assign let
|
||||
syn keyword openscadConditional if else
|
||||
syn keyword openscadRepeat for intersection_for
|
||||
syn keyword openscadInclude include use
|
||||
syn keyword openscadCsgKeyword union difference intersection render intersection_for
|
||||
syn keyword openscadTransform scale rotate translate mirror multmatrix color minkowski hull projection linear_extrude rotate_extrude offset
|
||||
syn keyword openscadPrimitiveSolid cube sphere cylinder polyhedron surface
|
||||
syn keyword openscadPrimitive2D square circle polygon import_dxf text
|
||||
syn keyword openscadPrimitiveImport import child children
|
||||
|
||||
syn match openscadSpecialVariable "\$[a-zA-Z]\+\>" display
|
||||
syn match openscadModifier "^\s*[\*\!\#\%]" display
|
||||
|
||||
syn match openscadNumbers "\<\d\|\.\d" contains=openscadNumber display transparent
|
||||
syn match openscadNumber "\d\+" display contained
|
||||
syn match openscadNumber "\.\d\+" display contained
|
||||
|
||||
syn region openscadString start=/"/ skip=/\\"/ end=/"/
|
||||
|
||||
syn keyword openscadBoolean true false
|
||||
|
||||
syn keyword openscadCommentTodo TODO FIXME XXX contained display
|
||||
syn match openscadInlineComment ://.*$: contains=openscadCommentTodo
|
||||
syn region openscadBlockComment start=:/\*: end=:\*/: fold contains=openscadCommentTodo
|
||||
|
||||
syn region openscadBlock start="{" end="}" transparent fold
|
||||
syn region openscadVector start="\[" end="\]" transparent fold
|
||||
|
||||
syn keyword openscadBuiltin abs acos asin atan atan2 ceil cos exp floor ln log
|
||||
syn keyword openscadBuiltin lookup max min pow rands round sign sin sqrt tan
|
||||
syn keyword openscadBuiltin str len search version version_num concat chr
|
||||
syn keyword openscadBuiltin dxf_cross dxf_dim
|
||||
|
||||
hi def link openscadFunctionDef Structure
|
||||
hi def link openscadFunction Function
|
||||
hi def link openscadModuleDef Structure
|
||||
hi def link openscadModule Function
|
||||
hi def link openscadBlockComment Comment
|
||||
hi def link openscadBoolean Boolean
|
||||
hi def link openscadBuiltin Function
|
||||
hi def link openscadConditional Conditional
|
||||
hi def link openscadCsgKeyword Structure
|
||||
hi def link openscadInclude Include
|
||||
hi def link openscadInlineComment Comment
|
||||
hi def link openscadModifier Special
|
||||
hi def link openscadStatement Statement
|
||||
hi def link openscadNumbers Number
|
||||
hi def link openscadNumber Number
|
||||
hi def link openscadPrimitiveSolid Keyword
|
||||
hi def link openscadPrimitive2D Keyword
|
||||
hi def link openscadPrimitiveImport Keyword
|
||||
hi def link openscadRepeat Repeat
|
||||
hi def link openscadSpecialVariable Special
|
||||
hi def link openscadString String
|
||||
hi def link openscadTransform Statement
|
||||
hi def link openscadCommentTodo Todo
|
||||
|
||||
" Blatantly stolen from vim74\syntax\c.vim
|
||||
"when wanted, highlight trailing white space
|
||||
if exists("openscad_space_errors")
|
||||
if !exists("openscad_no_trail_space_error")
|
||||
syn match openscadSpaceError display excludenl "\s\+$"
|
||||
endif
|
||||
if !exists("openscad_no_tab_space_error")
|
||||
syn match openscadSpaceError display " \+\t"me=e-1
|
||||
endif
|
||||
endif
|
||||
|
||||
let b:current_syntax = "openscad"
|
||||
|
||||
endif
|
||||
198
syntax/perl.vim
198
syntax/perl.vim
@@ -435,125 +435,121 @@ else
|
||||
syn sync minlines=0
|
||||
endif
|
||||
|
||||
command -nargs=+ HiLink hi def link <args>
|
||||
|
||||
" NOTE: If you're linking new highlight groups to perlString, please also put
|
||||
" them into b:match_skip in ftplugin/perl.vim.
|
||||
|
||||
" The default highlighting.
|
||||
HiLink perlSharpBang PreProc
|
||||
HiLink perlControl PreProc
|
||||
HiLink perlInclude Include
|
||||
HiLink perlSpecial Special
|
||||
HiLink perlString String
|
||||
HiLink perlCharacter Character
|
||||
HiLink perlNumber Number
|
||||
HiLink perlFloat Float
|
||||
HiLink perlType Type
|
||||
HiLink perlIdentifier Identifier
|
||||
HiLink perlLabel Label
|
||||
HiLink perlStatement Statement
|
||||
HiLink perlConditional Conditional
|
||||
HiLink perlRepeat Repeat
|
||||
HiLink perlOperator Operator
|
||||
HiLink perlFunction Keyword
|
||||
HiLink perlSubName Function
|
||||
HiLink perlSubPrototype Type
|
||||
HiLink perlSignature Type
|
||||
HiLink perlSubAttributes PreProc
|
||||
HiLink perlSubAttributesCont perlSubAttributes
|
||||
HiLink perlComment Comment
|
||||
HiLink perlTodo Todo
|
||||
hi def link perlSharpBang PreProc
|
||||
hi def link perlControl PreProc
|
||||
hi def link perlInclude Include
|
||||
hi def link perlSpecial Special
|
||||
hi def link perlString String
|
||||
hi def link perlCharacter Character
|
||||
hi def link perlNumber Number
|
||||
hi def link perlFloat Float
|
||||
hi def link perlType Type
|
||||
hi def link perlIdentifier Identifier
|
||||
hi def link perlLabel Label
|
||||
hi def link perlStatement Statement
|
||||
hi def link perlConditional Conditional
|
||||
hi def link perlRepeat Repeat
|
||||
hi def link perlOperator Operator
|
||||
hi def link perlFunction Keyword
|
||||
hi def link perlSubName Function
|
||||
hi def link perlSubPrototype Type
|
||||
hi def link perlSignature Type
|
||||
hi def link perlSubAttributes PreProc
|
||||
hi def link perlSubAttributesCont perlSubAttributes
|
||||
hi def link perlComment Comment
|
||||
hi def link perlTodo Todo
|
||||
if exists("perl_string_as_statement")
|
||||
HiLink perlStringStartEnd perlStatement
|
||||
hi def link perlStringStartEnd perlStatement
|
||||
else
|
||||
HiLink perlStringStartEnd perlString
|
||||
hi def link perlStringStartEnd perlString
|
||||
endif
|
||||
HiLink perlVStringV perlStringStartEnd
|
||||
HiLink perlList perlStatement
|
||||
HiLink perlMisc perlStatement
|
||||
HiLink perlVarPlain perlIdentifier
|
||||
HiLink perlVarPlain2 perlIdentifier
|
||||
HiLink perlArrow perlIdentifier
|
||||
HiLink perlFiledescRead perlIdentifier
|
||||
HiLink perlFiledescStatement perlIdentifier
|
||||
HiLink perlVarSimpleMember perlIdentifier
|
||||
HiLink perlVarSimpleMemberName perlString
|
||||
HiLink perlVarNotInMatches perlIdentifier
|
||||
HiLink perlVarSlash perlIdentifier
|
||||
HiLink perlQQ perlString
|
||||
HiLink perlHereDoc perlString
|
||||
HiLink perlStringUnexpanded perlString
|
||||
HiLink perlSubstitutionSQ perlString
|
||||
HiLink perlSubstitutionGQQ perlString
|
||||
HiLink perlTranslationGQ perlString
|
||||
HiLink perlMatch perlString
|
||||
HiLink perlMatchStartEnd perlStatement
|
||||
HiLink perlFormatName perlIdentifier
|
||||
HiLink perlFormatField perlString
|
||||
HiLink perlPackageDecl perlType
|
||||
HiLink perlStorageClass perlType
|
||||
HiLink perlPackageRef perlType
|
||||
HiLink perlStatementPackage perlStatement
|
||||
HiLink perlStatementStorage perlStatement
|
||||
HiLink perlStatementControl perlStatement
|
||||
HiLink perlStatementScalar perlStatement
|
||||
HiLink perlStatementRegexp perlStatement
|
||||
HiLink perlStatementNumeric perlStatement
|
||||
HiLink perlStatementList perlStatement
|
||||
HiLink perlStatementHash perlStatement
|
||||
HiLink perlStatementIOfunc perlStatement
|
||||
HiLink perlStatementFiledesc perlStatement
|
||||
HiLink perlStatementVector perlStatement
|
||||
HiLink perlStatementFiles perlStatement
|
||||
HiLink perlStatementFlow perlStatement
|
||||
HiLink perlStatementInclude perlStatement
|
||||
HiLink perlStatementProc perlStatement
|
||||
HiLink perlStatementSocket perlStatement
|
||||
HiLink perlStatementIPC perlStatement
|
||||
HiLink perlStatementNetwork perlStatement
|
||||
HiLink perlStatementPword perlStatement
|
||||
HiLink perlStatementTime perlStatement
|
||||
HiLink perlStatementMisc perlStatement
|
||||
HiLink perlStatementIndirObj perlStatement
|
||||
HiLink perlFunctionName perlIdentifier
|
||||
HiLink perlMethod perlIdentifier
|
||||
HiLink perlPostDeref perlIdentifier
|
||||
HiLink perlFunctionPRef perlType
|
||||
hi def link perlVStringV perlStringStartEnd
|
||||
hi def link perlList perlStatement
|
||||
hi def link perlMisc perlStatement
|
||||
hi def link perlVarPlain perlIdentifier
|
||||
hi def link perlVarPlain2 perlIdentifier
|
||||
hi def link perlArrow perlIdentifier
|
||||
hi def link perlFiledescRead perlIdentifier
|
||||
hi def link perlFiledescStatement perlIdentifier
|
||||
hi def link perlVarSimpleMember perlIdentifier
|
||||
hi def link perlVarSimpleMemberName perlString
|
||||
hi def link perlVarNotInMatches perlIdentifier
|
||||
hi def link perlVarSlash perlIdentifier
|
||||
hi def link perlQQ perlString
|
||||
hi def link perlHereDoc perlString
|
||||
hi def link perlStringUnexpanded perlString
|
||||
hi def link perlSubstitutionSQ perlString
|
||||
hi def link perlSubstitutionGQQ perlString
|
||||
hi def link perlTranslationGQ perlString
|
||||
hi def link perlMatch perlString
|
||||
hi def link perlMatchStartEnd perlStatement
|
||||
hi def link perlFormatName perlIdentifier
|
||||
hi def link perlFormatField perlString
|
||||
hi def link perlPackageDecl perlType
|
||||
hi def link perlStorageClass perlType
|
||||
hi def link perlPackageRef perlType
|
||||
hi def link perlStatementPackage perlStatement
|
||||
hi def link perlStatementStorage perlStatement
|
||||
hi def link perlStatementControl perlStatement
|
||||
hi def link perlStatementScalar perlStatement
|
||||
hi def link perlStatementRegexp perlStatement
|
||||
hi def link perlStatementNumeric perlStatement
|
||||
hi def link perlStatementList perlStatement
|
||||
hi def link perlStatementHash perlStatement
|
||||
hi def link perlStatementIOfunc perlStatement
|
||||
hi def link perlStatementFiledesc perlStatement
|
||||
hi def link perlStatementVector perlStatement
|
||||
hi def link perlStatementFiles perlStatement
|
||||
hi def link perlStatementFlow perlStatement
|
||||
hi def link perlStatementInclude perlStatement
|
||||
hi def link perlStatementProc perlStatement
|
||||
hi def link perlStatementSocket perlStatement
|
||||
hi def link perlStatementIPC perlStatement
|
||||
hi def link perlStatementNetwork perlStatement
|
||||
hi def link perlStatementPword perlStatement
|
||||
hi def link perlStatementTime perlStatement
|
||||
hi def link perlStatementMisc perlStatement
|
||||
hi def link perlStatementIndirObj perlStatement
|
||||
hi def link perlFunctionName perlIdentifier
|
||||
hi def link perlMethod perlIdentifier
|
||||
hi def link perlPostDeref perlIdentifier
|
||||
hi def link perlFunctionPRef perlType
|
||||
if !get(g:, 'perl_include_pod', 1)
|
||||
HiLink perlPOD perlComment
|
||||
hi def link perlPOD perlComment
|
||||
endif
|
||||
HiLink perlShellCommand perlString
|
||||
HiLink perlSpecialAscii perlSpecial
|
||||
HiLink perlSpecialDollar perlSpecial
|
||||
HiLink perlSpecialString perlSpecial
|
||||
HiLink perlSpecialStringU perlSpecial
|
||||
HiLink perlSpecialMatch perlSpecial
|
||||
HiLink perlDATA perlComment
|
||||
hi def link perlShellCommand perlString
|
||||
hi def link perlSpecialAscii perlSpecial
|
||||
hi def link perlSpecialDollar perlSpecial
|
||||
hi def link perlSpecialString perlSpecial
|
||||
hi def link perlSpecialStringU perlSpecial
|
||||
hi def link perlSpecialMatch perlSpecial
|
||||
hi def link perlDATA perlComment
|
||||
|
||||
" NOTE: Due to a bug in Vim (or more likely, a misunderstanding on my part),
|
||||
" I had to remove the transparent property from the following regions
|
||||
" in order to get them to highlight correctly. Feel free to remove
|
||||
" these and reinstate the transparent property if you know how.
|
||||
HiLink perlParensSQ perlString
|
||||
HiLink perlBracketsSQ perlString
|
||||
HiLink perlBracesSQ perlString
|
||||
HiLink perlAnglesSQ perlString
|
||||
hi def link perlParensSQ perlString
|
||||
hi def link perlBracketsSQ perlString
|
||||
hi def link perlBracesSQ perlString
|
||||
hi def link perlAnglesSQ perlString
|
||||
|
||||
HiLink perlParensDQ perlString
|
||||
HiLink perlBracketsDQ perlString
|
||||
HiLink perlBracesDQ perlString
|
||||
HiLink perlAnglesDQ perlString
|
||||
hi def link perlParensDQ perlString
|
||||
hi def link perlBracketsDQ perlString
|
||||
hi def link perlBracesDQ perlString
|
||||
hi def link perlAnglesDQ perlString
|
||||
|
||||
HiLink perlSpecialStringU2 perlString
|
||||
hi def link perlSpecialStringU2 perlString
|
||||
|
||||
" Possible errors
|
||||
HiLink perlNotEmptyLine Error
|
||||
HiLink perlElseIfError Error
|
||||
HiLink perlSubPrototypeError Error
|
||||
HiLink perlSubError Error
|
||||
|
||||
delcommand HiLink
|
||||
hi def link perlNotEmptyLine Error
|
||||
hi def link perlElseIfError Error
|
||||
hi def link perlSubPrototypeError Error
|
||||
hi def link perlSubError Error
|
||||
|
||||
" Syncing to speed up processing
|
||||
"
|
||||
|
||||
@@ -621,7 +621,7 @@ if !exists("php_ignore_phpdoc") || !php_ignore_phpdoc
|
||||
|
||||
syn region phpDocTags start="{@\(example\|id\|internal\|inheritdoc\|link\|source\|toc\|tutorial\)" end="}" containedin=phpDocComment
|
||||
syn match phpDocTags "@\%(abstract\|access\|api\|author\|brief\|bug\|category\|class\|copyright\|created\|date\|deprecated\|details\|example\|exception\|file\|filesource\|final\|global\|id\|ignore\|inheritdoc\|internal\|license\|link\|magic\|method\|name\|package\|param\|property\|return\|see\|since\|source\|static\|staticvar\|struct\|subpackage\|throws\|toc\|todo\|tutorial\|type\|uses\|var\|version\|warning\)" containedin=phpDocComment nextgroup=phpDocParam,phpDocIdentifier skipwhite contained
|
||||
syn match phpDocParam "\s\+\zs\%(\h\w*|\?\)\+" nextgroup=phpDocIdentifier skipwhite contained
|
||||
syn match phpDocParam "\s\+\zs\(|\|\\\|\h\w*\)*\h\w*" nextgroup=phpDocIdentifier skipwhite contained
|
||||
syn match phpDocIdentifier "\s\+\zs$\h\w*" contained
|
||||
|
||||
syn case match
|
||||
|
||||
@@ -21,11 +21,8 @@ if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'perl') == -1
|
||||
|
||||
" Remove any old syntax stuff hanging around (this is suppressed
|
||||
" automatically by ":syn include" if necessary).
|
||||
" For version 5.x: Clear all syntax items
|
||||
" For version 6.x: Quit when a syntax file was already loaded
|
||||
if version < 600
|
||||
syntax clear
|
||||
elseif exists("b:current_syntax")
|
||||
" quit when a syntax file was already loaded
|
||||
if exists("b:current_syntax")
|
||||
finish
|
||||
endif
|
||||
|
||||
@@ -69,28 +66,17 @@ syn match podEscape "\I\i*>"me=e-1 contained contains=@NoSpell
|
||||
syn match podEscape2 "\d\+>"me=e-1 contained contains=@NoSpell
|
||||
|
||||
" 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_pod_syntax_inits")
|
||||
if version < 508
|
||||
let did_pod_syntax_inits = 1
|
||||
command -nargs=+ HiLink hi link <args>
|
||||
else
|
||||
command -nargs=+ HiLink hi def link <args>
|
||||
endif
|
||||
" Only when an item doesn't have highlighting yet
|
||||
|
||||
HiLink podCommand Statement
|
||||
HiLink podCmdText String
|
||||
HiLink podOverIndent Number
|
||||
HiLink podForKeywd Identifier
|
||||
HiLink podFormat Identifier
|
||||
HiLink podVerbatimLine PreProc
|
||||
HiLink podSpecial Identifier
|
||||
HiLink podEscape String
|
||||
HiLink podEscape2 Number
|
||||
|
||||
delcommand HiLink
|
||||
endif
|
||||
hi def link podCommand Statement
|
||||
hi def link podCmdText String
|
||||
hi def link podOverIndent Number
|
||||
hi def link podForKeywd Identifier
|
||||
hi def link podFormat Identifier
|
||||
hi def link podVerbatimLine PreProc
|
||||
hi def link podSpecial Identifier
|
||||
hi def link podEscape String
|
||||
hi def link podEscape2 Number
|
||||
|
||||
if exists("perl_pod_spellcheck_headings")
|
||||
" Spell-check headings
|
||||
|
||||
@@ -21,13 +21,13 @@ syn keyword purescriptBoolean true false
|
||||
syn match purescriptDelimiter "[,;|.()[\]{}]"
|
||||
|
||||
" Constructor
|
||||
syn match purescriptConstructor "\<[A-Z]\w*\>"
|
||||
syn match purescriptConstructor "\%(\<class\s\+\)\@15<!\<[A-Z]\w*\>"
|
||||
syn region purescriptConstructorDecl matchgroup=purescriptConstructor start="\<[A-Z]\w*\>" end="\(|\|$\)"me=e-1,re=e-1 contained
|
||||
\ containedin=purescriptData,purescriptNewtype
|
||||
\ contains=purescriptType,purescriptTypeVar,purescriptDelimiter,purescriptOperatorType,purescriptOperatorTypeSig,@purescriptComment
|
||||
|
||||
" Type
|
||||
syn match purescriptType "\<[A-Z]\w*\>" contained
|
||||
syn match purescriptType "\%(\<class\s\+\)\@15<!\<[A-Z]\w*\>" contained
|
||||
\ containedin=purescriptTypeAlias
|
||||
\ nextgroup=purescriptType,purescriptTypeVar skipwhite
|
||||
syn match purescriptTypeVar "\<[_a-z]\(\w\|\'\)*\>" contained
|
||||
@@ -36,9 +36,20 @@ syn region purescriptTypeExport matchgroup=purescriptType start="\<[A-Z]\(\S\&[^
|
||||
\ contains=purescriptConstructor,purescriptDelimiter
|
||||
|
||||
" Function
|
||||
syn match purescriptFunction "\<[_a-z]\(\w\|\'\)*\>" contained
|
||||
syn match purescriptFunction "(\(\W\&[^(),\"]\)\+)" contained extend
|
||||
syn match purescriptBacktick "`[_A-Za-z][A-Za-z0-9_]*`"
|
||||
syn match purescriptFunction "\%(\<instance\s\+\|\<class\s\+\)\@18<!\<[_a-z]\(\w\|\'\)*\>" contained
|
||||
" syn match purescriptFunction "\<[_a-z]\(\w\|\'\)*\>" contained
|
||||
syn match purescriptFunction "(\%(\<class\s\+\)\@18<!\(\W\&[^(),\"]\)\+)" contained extend
|
||||
syn match purescriptBacktick "`[_A-Za-z][A-Za-z0-9_\.]*`"
|
||||
|
||||
" Class
|
||||
syn region purescriptClassDecl start="^\%(\s*\)class\>"ms=e-5 end="\<where\>\|$"
|
||||
\ contains=purescriptClass,purescriptClassName,purescriptOperatorType,purescriptOperator,purescriptType,purescriptWhere
|
||||
\ nextgroup=purescriptClass
|
||||
\ skipnl
|
||||
syn match purescriptClass "\<class\>" containedin=purescriptClassDecl contained
|
||||
\ nextgroup=purescriptClassName
|
||||
\ skipnl
|
||||
syn match purescriptClassName "\<[A-Z]\w*\>" containedin=purescriptClassDecl contained
|
||||
|
||||
" Module
|
||||
syn match purescriptModuleName "\(\w\+\.\?\)*" contained excludenl
|
||||
@@ -46,8 +57,8 @@ syn match purescriptModuleKeyword "\<module\>"
|
||||
syn match purescriptModule "^module\>\s\+\<\(\w\+\.\?\)*\>"
|
||||
\ contains=purescriptModuleKeyword,purescriptModuleName
|
||||
\ nextgroup=purescriptModuleParams skipwhite skipnl skipempty
|
||||
syn region purescriptModuleParams start="(" end=")" fold contained keepend
|
||||
\ contains=purescriptDelimiter,purescriptType,purescriptTypeExport,purescriptFunction,purescriptStructure,purescriptModuleKeyword,@purescriptComment
|
||||
syn region purescriptModuleParams start="(" skip="([^)]\{-})" end=")" fold contained keepend
|
||||
\ contains=purescriptClassDecl,purescriptClass,purescriptClassName,purescriptDelimiter,purescriptType,purescriptTypeExport,purescriptFunction,purescriptStructure,purescriptModuleKeyword,@purescriptComment
|
||||
\ nextgroup=purescriptImportParams skipwhite
|
||||
|
||||
" Import
|
||||
@@ -86,8 +97,9 @@ syn match purescriptForall "∀"
|
||||
syn keyword purescriptConditional if then else
|
||||
syn keyword purescriptStatement do case of in
|
||||
syn keyword purescriptLet let
|
||||
" syn keyword purescriptClass class
|
||||
syn keyword purescriptWhere where
|
||||
syn match purescriptStructure "\<\(data\|newtype\|type\|class\|kind\)\>"
|
||||
syn match purescriptStructure "\<\(data\|newtype\|type\|kind\)\>"
|
||||
\ nextgroup=purescriptType skipwhite
|
||||
syn keyword purescriptStructure derive
|
||||
syn keyword purescriptStructure instance
|
||||
@@ -101,7 +113,7 @@ syn match purescriptInfix "^\(infix\|infixl\|infixr\)\>\s\+\([0-9]\+\)\s\+\(type
|
||||
|
||||
" Operators
|
||||
syn match purescriptOperator "\([-!#$%&\*\+/<=>\?@\\^|~:]\|\<_\>\)"
|
||||
syn match purescriptOperatorType "\(::\|∷\)"
|
||||
syn match purescriptOperatorType "\%(\<instance\>.*\)\@40<!\(::\|∷\)"
|
||||
\ nextgroup=purescriptForall,purescriptType skipwhite skipnl skipempty
|
||||
syn match purescriptOperatorFunction "\(->\|<-\|[\\→←]\)"
|
||||
syn match purescriptOperatorTypeSig "\(->\|<-\|=>\|<=\|::\|[∷∀→←⇒⇐]\)" contained
|
||||
@@ -176,6 +188,8 @@ highlight def link purescriptLineComment purescriptComment
|
||||
highlight def link purescriptBlockComment purescriptComment
|
||||
|
||||
" purescript general highlights
|
||||
highlight def link purescriptClass purescriptKeyword
|
||||
highlight def link purescriptClassName Type
|
||||
highlight def link purescriptStructure purescriptKeyword
|
||||
highlight def link purescriptKeyword Keyword
|
||||
highlight def link purescriptStatement Statement
|
||||
|
||||
@@ -2,11 +2,14 @@ if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'qml') == -1
|
||||
|
||||
" Vim syntax file
|
||||
" Language: QML
|
||||
" Maintainer: Warwick Allison <warwick.allison@nokia.com>
|
||||
" Updaters:
|
||||
" URL:
|
||||
" Changes:
|
||||
" Last Change: 2009 Apr 30
|
||||
" Maintainer: Peter Hoeg <peter@hoeg.com>
|
||||
" Updaters: Refer to CONTRIBUTORS.md
|
||||
" URL: https://github.com/peterhoeg/vim-qml
|
||||
" Changes: `git log` is your friend
|
||||
" Last Change: 2017-11-11
|
||||
"
|
||||
" This file is bassed on the original work done by Warwick Allison
|
||||
" <warwick.allison@nokia.com> whose did about 99% of the work here.
|
||||
|
||||
" Based on javascript syntax (as is QML)
|
||||
|
||||
@@ -26,20 +29,20 @@ endif
|
||||
|
||||
syn case ignore
|
||||
|
||||
|
||||
syn cluster qmlExpr contains=qmlStringD,qmlString,SqmlCharacter,qmlNumber,qmlObjectLiteralType,qmlBoolean,qmlType,qmlJsType,qmlNull,qmlGlobal,qmlFunction
|
||||
syn keyword qmlCommentTodo TODO FIXME XXX TBD contained
|
||||
syn match qmlLineComment "\/\/.*" contains=@Spell,qmlCommentTodo
|
||||
syn match qmlCommentSkip "^[ \t]*\*\($\|[ \t]\+\)"
|
||||
syn region qmlComment start="/\*" end="\*/" contains=@Spell,qmlCommentTodo fold
|
||||
syn match qmlSpecial "\\\d\d\d\|\\."
|
||||
syn region qmlStringD start=+"+ skip=+\\\\\|\\"\|\\$+ end=+"\|$+ contains=qmlSpecial,@htmlPreproc
|
||||
syn region qmlStringS start=+'+ skip=+\\\\\|\\'\|\\$+ end=+'\|$+ contains=qmlSpecial,@htmlPreproc
|
||||
syn region qmlStringD start=+"+ skip=+\\\\\|\\"\|\\$+ end=+"\|$+ contains=qmlSpecial,@htmlPreproc,@Spell
|
||||
syn region qmlStringS start=+'+ skip=+\\\\\|\\'\|\\$+ end=+'\|$+ contains=qmlSpecial,@htmlPreproc,@Spell
|
||||
|
||||
syn match qmlCharacter "'\\.'"
|
||||
syn match qmlNumber "-\=\<\d\+L\=\>\|0[xX][0-9a-fA-F]\+\>"
|
||||
syn region qmlRegexpString start=+/[^/*]+me=e-1 skip=+\\\\\|\\/+ end=+/[gi]\{0,2\}\s*$+ end=+/[gi]\{0,2\}\s*[;.,)\]}]+me=e-1 contains=@htmlPreproc oneline
|
||||
syn match qmlObjectLiteralType "[A-Za-z][_A-Za-z0-9]*\s*\({\)\@="
|
||||
syn match qmlNonBindingColon "?[^;]*:"
|
||||
syn region qmlTernaryColon start="?" end=":" contains=@qmlExpr,qmlBraces,qmlParens
|
||||
syn match qmlBindingProperty "\<[A-Za-z][_A-Za-z.0-9]*\s*:"
|
||||
|
||||
syn keyword qmlConditional if else switch
|
||||
@@ -122,7 +125,6 @@ if version >= 508 || !exists("did_qml_syn_inits")
|
||||
HiLink qmlReserved Keyword
|
||||
HiLink qmlDebug Debug
|
||||
HiLink qmlConstant Label
|
||||
HiLink qmlNonBindingColon NONE
|
||||
HiLink qmlBindingProperty Label
|
||||
HiLink qmlDeclaration Function
|
||||
|
||||
|
||||
@@ -102,9 +102,9 @@ syn match scalaTypeTypeDeclaration /(/ contained nextgroup=scalaTypeTypeExtensio
|
||||
syn match scalaTypeTypeDeclaration /\%(⇒\|=>\)\ze/ contained nextgroup=scalaTypeTypeDeclaration contains=scalaTypeTypeExtension skipwhite
|
||||
syn match scalaTypeTypeDeclaration /\<[_\.A-Za-z0-9$]\+\>/ contained nextgroup=scalaTypeTypeExtension,scalaTypeTypeEquals skipwhite
|
||||
syn match scalaTypeTypeEquals /=\ze[^>]/ contained nextgroup=scalaTypeTypePostDeclaration skipwhite
|
||||
syn match scalaTypeTypeExtension /)\?\_s*\zs\%(⇒\|=>\|<:\|:>\|=:=\|::\|#\)/ contained nextgroup=scalaTypeTypeDeclaration skipwhite
|
||||
syn match scalaTypeTypeExtension /)\?\_s*\zs\%(⇒\|=>\|<:\|:>\|=:=\|::\|#\)/ contained contains=scalaTypeOperator nextgroup=scalaTypeTypeDeclaration skipwhite
|
||||
syn match scalaTypeTypePostDeclaration /\<[_\.A-Za-z0-9$]\+\>/ contained nextgroup=scalaTypeTypePostExtension skipwhite
|
||||
syn match scalaTypeTypePostExtension /\%(⇒\|=>\|<:\|:>\|=:=\|::\)/ contained nextgroup=scalaTypeTypePostDeclaration skipwhite
|
||||
syn match scalaTypeTypePostExtension /\%(⇒\|=>\|<:\|:>\|=:=\|::\)/ contained contains=scalaTypeOperator nextgroup=scalaTypeTypePostDeclaration skipwhite
|
||||
hi link scalaTypeTypeDeclaration Type
|
||||
hi link scalaTypeTypeExtension Keyword
|
||||
hi link scalaTypeTypePostDeclaration Special
|
||||
@@ -113,7 +113,7 @@ hi link scalaTypeTypePostExtension Keyword
|
||||
syn match scalaTypeDeclaration /(/ contained nextgroup=scalaTypeExtension contains=scalaRoundBrackets skipwhite
|
||||
syn match scalaTypeDeclaration /\%(⇒\|=>\)\ze/ contained nextgroup=scalaTypeDeclaration contains=scalaTypeExtension skipwhite
|
||||
syn match scalaTypeDeclaration /\<[_\.A-Za-z0-9$]\+\>/ contained nextgroup=scalaTypeExtension skipwhite
|
||||
syn match scalaTypeExtension /)\?\_s*\zs\%(⇒\|=>\|<:\|:>\|=:=\|::\|#\)/ contained nextgroup=scalaTypeDeclaration skipwhite
|
||||
syn match scalaTypeExtension /)\?\_s*\zs\%(⇒\|=>\|<:\|:>\|=:=\|::\|#\)/ contained contains=scalaTypeOperator nextgroup=scalaTypeDeclaration skipwhite
|
||||
hi link scalaTypeDeclaration Type
|
||||
hi link scalaTypeExtension Keyword
|
||||
hi link scalaTypePostExtension Keyword
|
||||
@@ -122,12 +122,14 @@ syn match scalaTypeAnnotation /\%([_a-zA-Z0-9$\s]:\_s*\)\ze[_=(\.A-Za-z0-9$]\+/
|
||||
syn match scalaTypeAnnotation /)\_s*:\_s*\ze[_=(\.A-Za-z0-9$]\+/ skipwhite nextgroup=scalaTypeDeclaration
|
||||
hi link scalaTypeAnnotation Normal
|
||||
|
||||
syn match scalaCaseFollowing /\<[_\.A-Za-z0-9$]\+\>/ contained
|
||||
syn match scalaCaseFollowing /`[^`]\+`/ contained
|
||||
syn match scalaCaseFollowing /\<[_\.A-Za-z0-9$]\+\>/ contained contains=scalaCapitalWord
|
||||
syn match scalaCaseFollowing /`[^`]\+`/ contained contains=scalaCapitalWord
|
||||
hi link scalaCaseFollowing Special
|
||||
|
||||
syn keyword scalaKeywordModifier abstract override final lazy implicit implicitly private protected sealed null require super
|
||||
syn keyword scalaKeywordModifier abstract override final lazy implicit private protected sealed null super
|
||||
syn keyword scalaSpecialFunction implicitly require
|
||||
hi link scalaKeywordModifier Function
|
||||
hi link scalaSpecialFunction Function
|
||||
|
||||
syn keyword scalaSpecial this true false ne eq
|
||||
syn keyword scalaSpecial new nextgroup=scalaInstanceDeclaration skipwhite
|
||||
@@ -199,7 +201,6 @@ hi link scalaDocLinks Function
|
||||
hi link scalaParameterAnnotation Function
|
||||
hi link scalaParamAnnotationValue Keyword
|
||||
hi link scalaCommentAnnotation Function
|
||||
hi link scalaCommentCodeBlockBrackets String
|
||||
hi link scalaCommentCodeBlock String
|
||||
hi link scalaTodo Todo
|
||||
|
||||
|
||||
@@ -41,10 +41,16 @@ hi def link tomlBoolean Boolean
|
||||
syn match tomlDate /\d\{4\}-\d\{2\}-\d\{2\}T\d\{2\}:\d\{2\}:\d\{2\}\%(\.\d\+\)\?\%(Z\|[+-]\d\{2\}:\d\{2\}\)/ display
|
||||
hi def link tomlDate Constant
|
||||
|
||||
syn match tomlTable /^\s*\[[^#\[\]]\+\]\s*\(#.*\)\?$/ contains=tomlComment
|
||||
syn region tomlKeyDq oneline start=/"/ end=/"/ contains=tomlEscape contained
|
||||
hi def link tomlKeyDq Identifier
|
||||
|
||||
syn region tomlKeySq oneline start=/'/ end=/'/ contained
|
||||
hi def link tomlKeySq Identifier
|
||||
|
||||
syn region tomlTable oneline start=/^\s*\[[^\[]/ end=/\]/ contains=tomlKeyDq,tomlKeySq
|
||||
hi def link tomlTable Identifier
|
||||
|
||||
syn match tomlTableArray /^\s*\[\[[^#\[\]]\+\]\]\s*\(#.*\)\?$/ contains=tomlComment
|
||||
syn region tomlTableArray oneline start=/^\s*\[\[/ end=/\]\]/ contains=tomlKeyDq,tomlKeySq
|
||||
hi def link tomlTableArray Identifier
|
||||
|
||||
syn keyword tomlTodo TODO FIXME XXX BUG contained
|
||||
|
||||
@@ -19,9 +19,6 @@ if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'twig') == -1
|
||||
" 2011 July 27: Changed all references of jinja tp twig
|
||||
" 2014 December 4: Do not assume that the base filetype is HTML.
|
||||
|
||||
if exists('b:main_syntax')
|
||||
finish
|
||||
endif
|
||||
if exists('b:current_syntax')
|
||||
let b:main_syntax = b:current_syntax
|
||||
else
|
||||
|
||||
@@ -7,20 +7,11 @@ if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'perl') == -1
|
||||
" Previous: Vincent Pit <perl@profvince.com>
|
||||
" Last Change: 2016-02-01
|
||||
|
||||
" For version 5.x: Clear all syntax items
|
||||
" For version 6.x: Quit when a syntax file was already loaded
|
||||
if version < 600
|
||||
syntax clear
|
||||
elseif exists("b:current_syntax")
|
||||
if exists("b:current_syntax")
|
||||
finish
|
||||
endif
|
||||
|
||||
" Read the C syntax to start with
|
||||
if version < 600
|
||||
source <sfile>:p:h/c.vim
|
||||
else
|
||||
runtime! syntax/c.vim
|
||||
endif
|
||||
runtime! syntax/c.vim
|
||||
|
||||
" Configuration:
|
||||
" let xs_superseded = 0 " mark C functions superseded by Perl replacements (ex. memcpy vs Copy)
|
||||
@@ -3672,29 +3663,16 @@ syn keyword xsMacro whichsig write xio_any xio_dirp xiv_iv xlv_targoff
|
||||
syn keyword xsMacro xpv_len xuv_uv yystype
|
||||
|
||||
" 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_xs_syntax_inits")
|
||||
if version < 508
|
||||
let did_xs_syntax_inits = 1
|
||||
command -nargs=+ HiLink hi link <args>
|
||||
else
|
||||
command -nargs=+ HiLink hi def link <args>
|
||||
endif
|
||||
|
||||
HiLink xsPrivate Error
|
||||
HiLink xsSuperseded Error
|
||||
HiLink xsType Type
|
||||
HiLink xsString String
|
||||
HiLink xsConstant Constant
|
||||
HiLink xsException Exception
|
||||
HiLink xsKeyword Keyword
|
||||
HiLink xsFunction Function
|
||||
HiLink xsVariable Identifier
|
||||
HiLink xsMacro Macro
|
||||
|
||||
delcommand HiLink
|
||||
endif
|
||||
hi def link xsPrivate Error
|
||||
hi def link xsSuperseded Error
|
||||
hi def link xsType Type
|
||||
hi def link xsString String
|
||||
hi def link xsConstant Constant
|
||||
hi def link xsException Exception
|
||||
hi def link xsKeyword Keyword
|
||||
hi def link xsFunction Function
|
||||
hi def link xsVariable Identifier
|
||||
hi def link xsMacro Macro
|
||||
|
||||
let b:current_syntax = "xs"
|
||||
|
||||
|
||||
Reference in New Issue
Block a user