mirror of
https://github.com/sheerun/vim-polyglot.git
synced 2025-11-09 03:53:52 -05:00
Compare commits
5 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
44b3d860cb | ||
|
|
5a65ffe66d | ||
|
|
b9dae8fbab | ||
|
|
84593f2d7f | ||
|
|
22f6f3b6d3 |
@@ -1,4 +1,4 @@
|
|||||||
# vim-polyglot [![Build Status][travis-img-url]][travis-url]
|
# vim-polyglot [![Build Status][travis-img-url]][travis-url] []()
|
||||||
|
|
||||||
[travis-img-url]: https://travis-ci.org/sheerun/vim-polyglot.svg
|
[travis-img-url]: https://travis-ci.org/sheerun/vim-polyglot.svg
|
||||||
[travis-url]: https://travis-ci.org/sheerun/vim-polyglot
|
[travis-url]: https://travis-ci.org/sheerun/vim-polyglot
|
||||||
@@ -65,8 +65,9 @@ Optionally download one of the [releases](https://github.com/sheerun/vim-polyglo
|
|||||||
- [latex](https://github.com/LaTeX-Box-Team/LaTeX-Box) (syntax, indent, ftplugin)
|
- [latex](https://github.com/LaTeX-Box-Team/LaTeX-Box) (syntax, indent, ftplugin)
|
||||||
- [less](https://github.com/groenewege/vim-less) (syntax, indent, ftplugin, ftdetect)
|
- [less](https://github.com/groenewege/vim-less) (syntax, indent, ftplugin, ftdetect)
|
||||||
- [liquid](https://github.com/tpope/vim-liquid) (syntax, indent, ftplugin, ftdetect)
|
- [liquid](https://github.com/tpope/vim-liquid) (syntax, indent, ftplugin, ftdetect)
|
||||||
|
- [mako](https://github.com/sophacles/vim-bundle-mako) (syntax, indent, ftplugin, ftdetect)
|
||||||
- [markdown](https://github.com/tpope/vim-markdown) (syntax, ftplugin, ftdetect)
|
- [markdown](https://github.com/tpope/vim-markdown) (syntax, ftplugin, ftdetect)
|
||||||
- [nginx](https://github.com/nginx/nginx) (syntax, indent, ftdetect)
|
- [nginx](https://github.com/othree/nginx-contrib-vim) (syntax, indent, ftdetect)
|
||||||
- [nim](https://github.com/zah/nim.vim) (syntax, compiler, indent, ftdetect)
|
- [nim](https://github.com/zah/nim.vim) (syntax, compiler, indent, ftdetect)
|
||||||
- [nix](https://github.com/spwhitt/vim-nix) (syntax, ftplugin, ftdetect)
|
- [nix](https://github.com/spwhitt/vim-nix) (syntax, ftplugin, ftdetect)
|
||||||
- [objc](https://github.com/b4winckler/vim-objc) (ftplugin, syntax, indent)
|
- [objc](https://github.com/b4winckler/vim-objc) (ftplugin, syntax, indent)
|
||||||
@@ -91,7 +92,7 @@ Optionally download one of the [releases](https://github.com/sheerun/vim-polyglo
|
|||||||
- [rust](https://github.com/rust-lang/rust.vim) (syntax, indent, compiler, autoload, ftplugin, ftdetect)
|
- [rust](https://github.com/rust-lang/rust.vim) (syntax, indent, compiler, autoload, ftplugin, ftdetect)
|
||||||
- [sbt](https://github.com/derekwyatt/vim-sbt) (syntax, ftdetect)
|
- [sbt](https://github.com/derekwyatt/vim-sbt) (syntax, ftdetect)
|
||||||
- [scala](https://github.com/derekwyatt/vim-scala) (syntax, indent, compiler, ftplugin, ftdetect)
|
- [scala](https://github.com/derekwyatt/vim-scala) (syntax, indent, compiler, ftplugin, ftdetect)
|
||||||
- [slim](https://github.com/slim-template/vim-slim) (syntax, indent, ftdetect)
|
- [slim](https://github.com/slim-template/vim-slim) (syntax, indent, ftplugin, ftdetect)
|
||||||
- [solidity](https://github.com/ethereum/vim-solidity) (syntax, indent, ftdetect)
|
- [solidity](https://github.com/ethereum/vim-solidity) (syntax, indent, ftdetect)
|
||||||
- [stylus](https://github.com/wavded/vim-stylus) (syntax, indent, ftplugin, ftdetect)
|
- [stylus](https://github.com/wavded/vim-stylus) (syntax, indent, ftplugin, ftdetect)
|
||||||
- [swift](https://github.com/keith/swift.vim) (syntax, indent, ftplugin, ftdetect)
|
- [swift](https://github.com/keith/swift.vim) (syntax, indent, ftplugin, ftdetect)
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'haskell') == -1
|
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'haskell') == -1
|
||||||
|
|
||||||
setlocal comments=s1fl:{-,mb:-,ex:-},:--
|
setlocal comments=s1fl:{-,mb:\ \ ,ex:-},:--
|
||||||
setlocal iskeyword+='
|
setlocal iskeyword+='
|
||||||
|
|
||||||
endif
|
endif
|
||||||
|
|||||||
3
build
3
build
@@ -136,8 +136,9 @@ PACKS="
|
|||||||
latex:LaTeX-Box-Team/LaTeX-Box
|
latex:LaTeX-Box-Team/LaTeX-Box
|
||||||
less:groenewege/vim-less
|
less:groenewege/vim-less
|
||||||
liquid:tpope/vim-liquid
|
liquid:tpope/vim-liquid
|
||||||
|
mako:sophacles/vim-bundle-mako
|
||||||
markdown:tpope/vim-markdown
|
markdown:tpope/vim-markdown
|
||||||
nginx:nginx/nginx::/contrib/vim/
|
nginx:othree/nginx-contrib-vim
|
||||||
nim:zah/nim.vim:_BASIC
|
nim:zah/nim.vim:_BASIC
|
||||||
nix:spwhitt/vim-nix
|
nix:spwhitt/vim-nix
|
||||||
objc:b4winckler/vim-objc
|
objc:b4winckler/vim-objc
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ endif
|
|||||||
let s:cpo_save = &cpo
|
let s:cpo_save = &cpo
|
||||||
set cpo-=C
|
set cpo-=C
|
||||||
|
|
||||||
CompilerSet makeprg=nim\ c\ $*
|
CompilerSet makeprg=nim\ c\ --verbosity:0\ $*\ %:p
|
||||||
|
|
||||||
CompilerSet errorformat=
|
CompilerSet errorformat=
|
||||||
\%-GHint:\ %m,
|
\%-GHint:\ %m,
|
||||||
|
|||||||
@@ -198,7 +198,7 @@ au BufNewFile,BufRead *.js setf javascript
|
|||||||
au BufNewFile,BufRead *.jsm setf javascript
|
au BufNewFile,BufRead *.jsm setf javascript
|
||||||
au BufNewFile,BufRead Jakefile setf javascript
|
au BufNewFile,BufRead Jakefile setf javascript
|
||||||
fun! s:SelectJavascript()
|
fun! s:SelectJavascript()
|
||||||
if getline(1) =~# '^#!.*/bin/env\s\+node\>'
|
if getline(1) =~# '^#!.*/bin/\%(env\s\+\)\?node\>'
|
||||||
set ft=javascript
|
set ft=javascript
|
||||||
endif
|
endif
|
||||||
endfun
|
endfun
|
||||||
@@ -270,6 +270,10 @@ au BufNewFile,BufRead */templates/**.liquid,*/layout/**.liquid,*/snippets/**.liq
|
|||||||
\ let b:liquid_subtype = 'html' |
|
\ let b:liquid_subtype = 'html' |
|
||||||
\ set ft=liquid |
|
\ set ft=liquid |
|
||||||
endif
|
endif
|
||||||
|
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'mako') == -1
|
||||||
|
|
||||||
|
au BufRead,BufNewFile *.mako set filetype=mako
|
||||||
|
endif
|
||||||
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'markdown') == -1
|
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'markdown') == -1
|
||||||
|
|
||||||
autocmd BufNewFile,BufRead *.markdown,*.md,*.mdown,*.mkd,*.mkdn
|
autocmd BufNewFile,BufRead *.markdown,*.md,*.mdown,*.mkd,*.mkdn
|
||||||
@@ -302,7 +306,7 @@ au BufRead,BufNewFile nginx.conf set ft=nginx
|
|||||||
endif
|
endif
|
||||||
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'nim') == -1
|
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'nim') == -1
|
||||||
|
|
||||||
au BufNewFile,BufRead *.nim set filetype=nim
|
au BufNewFile,BufRead *.nim,*.nims set filetype=nim
|
||||||
endif
|
endif
|
||||||
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'nix') == -1
|
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'nix') == -1
|
||||||
|
|
||||||
@@ -352,8 +356,8 @@ if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'plantuml') == -
|
|||||||
if did_filetype()
|
if did_filetype()
|
||||||
finish
|
finish
|
||||||
endif
|
endif
|
||||||
autocmd BufRead,BufNewFile * :if getline(1) =~ '^.*startuml.*$'| setfiletype plantuml | endif
|
autocmd BufRead,BufNewFile * :if getline(1) =~ '^.*startuml.*$'| setfiletype plantuml | set filetype=plantuml | endif
|
||||||
autocmd BufRead,BufNewFile *.pu,*.uml,*.plantuml set filetype=plantuml
|
autocmd BufRead,BufNewFile *.pu,*.uml,*.plantuml setfiletype plantuml | set filetype=plantuml
|
||||||
endif
|
endif
|
||||||
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'protobuf') == -1
|
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'protobuf') == -1
|
||||||
|
|
||||||
@@ -395,30 +399,46 @@ function! s:setf(filetype) abort
|
|||||||
let &filetype = a:filetype
|
let &filetype = a:filetype
|
||||||
endif
|
endif
|
||||||
endfunction
|
endfunction
|
||||||
au BufNewFile,BufRead *.rb,*.rbw,*.gemspec call s:setf('ruby')
|
func! s:StarSetf(ft)
|
||||||
au BufNewFile,BufRead *.builder,*.rxml,*.rjs,*.ruby call s:setf('ruby')
|
if expand("<amatch>") !~ g:ft_ignore_pat
|
||||||
au BufNewFile,BufRead [rR]akefile,*.rake call s:setf('ruby')
|
exe 'setf ' . a:ft
|
||||||
au BufNewFile,BufRead [rR]antfile,*.rant call s:setf('ruby')
|
endif
|
||||||
au BufNewFile,BufRead .irbrc,irbrc call s:setf('ruby')
|
endfunc
|
||||||
au BufNewFile,BufRead .pryrc call s:setf('ruby')
|
au BufNewFile,BufRead *.erb,*.rhtml call s:setf('eruby')
|
||||||
au BufNewFile,BufRead *.ru call s:setf('ruby')
|
au BufNewFile,BufRead .irbrc,irbrc call s:setf('ruby')
|
||||||
au BufNewFile,BufRead Capfile,*.cap call s:setf('ruby')
|
au BufNewFile,BufRead *.rb,*.rbw,*.gemspec call s:setf('ruby')
|
||||||
au BufNewFile,BufRead Gemfile call s:setf('ruby')
|
au BufNewFile,BufRead *.ru call s:setf('ruby')
|
||||||
au BufNewFile,BufRead Guardfile,.Guardfile call s:setf('ruby')
|
au BufNewFile,BufRead Gemfile call s:setf('ruby')
|
||||||
|
au BufNewFile,BufRead *.builder,*.rxml,*.rjs,*.ruby call s:setf('ruby')
|
||||||
|
au BufNewFile,BufRead [rR]akefile,*.rake call s:setf('ruby')
|
||||||
|
au BufNewFile,BufRead [rR]akefile* call s:StarSetf('ruby')
|
||||||
|
au BufNewFile,BufRead [rR]antfile,*.rant call s:setf('ruby')
|
||||||
|
endif
|
||||||
|
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'ruby') == -1
|
||||||
|
|
||||||
|
function! s:setf(filetype) abort
|
||||||
|
if &filetype !=# a:filetype
|
||||||
|
let &filetype = a:filetype
|
||||||
|
endif
|
||||||
|
endfunction
|
||||||
|
au BufNewFile,BufRead Appraisals call s:setf('ruby')
|
||||||
|
au BufNewFile,BufRead .autotest call s:setf('ruby')
|
||||||
|
au BufNewFile,BufRead [Bb]uildfile call s:setf('ruby')
|
||||||
|
au BufNewFile,BufRead Capfile,*.cap call s:setf('ruby')
|
||||||
au BufNewFile,BufRead Cheffile call s:setf('ruby')
|
au BufNewFile,BufRead Cheffile call s:setf('ruby')
|
||||||
au BufNewFile,BufRead Berksfile call s:setf('ruby')
|
au BufNewFile,BufRead Berksfile call s:setf('ruby')
|
||||||
au BufNewFile,BufRead [vV]agrantfile call s:setf('ruby')
|
|
||||||
au BufNewFile,BufRead .autotest call s:setf('ruby')
|
|
||||||
au BufNewFile,BufRead *.erb,*.rhtml call s:setf('eruby')
|
|
||||||
au BufNewFile,BufRead [tT]horfile,*.thor call s:setf('ruby')
|
|
||||||
au BufNewFile,BufRead *.rabl call s:setf('ruby')
|
|
||||||
au BufNewFile,BufRead *.jbuilder call s:setf('ruby')
|
|
||||||
au BufNewFile,BufRead Puppetfile call s:setf('ruby')
|
|
||||||
au BufNewFile,BufRead [Bb]uildfile call s:setf('ruby')
|
|
||||||
au BufNewFile,BufRead Appraisals call s:setf('ruby')
|
|
||||||
au BufNewFile,BufRead Podfile,*.podspec call s:setf('ruby')
|
au BufNewFile,BufRead Podfile,*.podspec call s:setf('ruby')
|
||||||
|
au BufNewFile,BufRead Guardfile,.Guardfile call s:setf('ruby')
|
||||||
|
au BufNewFile,BufRead *.jbuilder call s:setf('ruby')
|
||||||
|
au BufNewFile,BufRead KitchenSink call s:setf('ruby')
|
||||||
|
au BufNewFile,BufRead *.opal call s:setf('ruby')
|
||||||
|
au BufNewFile,BufRead .pryrc call s:setf('ruby')
|
||||||
|
au BufNewFile,BufRead Puppetfile call s:setf('ruby')
|
||||||
|
au BufNewFile,BufRead *.rabl call s:setf('ruby')
|
||||||
au BufNewFile,BufRead [rR]outefile call s:setf('ruby')
|
au BufNewFile,BufRead [rR]outefile call s:setf('ruby')
|
||||||
au BufNewFile,BufRead .simplecov set filetype=ruby
|
au BufNewFile,BufRead .simplecov call s:setf('ruby)
|
||||||
|
au BufNewFile,BufRead [tT]horfile,*.thor call s:setf('ruby')
|
||||||
|
au BufNewFile,BufRead [vV]agrantfile call s:setf('ruby')
|
||||||
endif
|
endif
|
||||||
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'rust') == -1
|
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'rust') == -1
|
||||||
|
|
||||||
@@ -441,7 +461,7 @@ au BufRead,BufNewFile *.sbt setfiletype sbt.scala
|
|||||||
endif
|
endif
|
||||||
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'slim') == -1
|
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'slim') == -1
|
||||||
|
|
||||||
autocmd BufNewFile,BufRead *.slim set filetype=slim
|
autocmd BufNewFile,BufRead *.slim setf slim
|
||||||
endif
|
endif
|
||||||
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'solidity') == -1
|
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'solidity') == -1
|
||||||
|
|
||||||
|
|||||||
@@ -40,6 +40,30 @@ setlocal errorformat=
|
|||||||
\%C%p^,
|
\%C%p^,
|
||||||
\%-C%.%#
|
\%-C%.%#
|
||||||
|
|
||||||
|
let g:crystal_compiler_command = get(g:, 'crystal_compiler_command', 'crystal')
|
||||||
|
let g:crystal_auto_format = get(g:, 'crystal_auto_format', 0)
|
||||||
|
|
||||||
|
command! -buffer -nargs=* CrystalImpl echo crystal_lang#impl(expand('%'), getpos('.'), <q-args>).output
|
||||||
|
command! -buffer -nargs=0 CrystalDef call crystal_lang#jump_to_definition(expand('%'), getpos('.'))
|
||||||
|
command! -buffer -nargs=* CrystalContext echo crystal_lang#context(expand('%'), getpos('.'), <q-args>).output
|
||||||
|
command! -buffer -nargs=* CrystalHierarchy echo crystal_lang#type_hierarchy(expand('%'), <q-args>)
|
||||||
|
command! -buffer -nargs=? CrystalSpecSwitch call crystal_lang#switch_spec_file(<f-args>)
|
||||||
|
command! -buffer -nargs=? CrystalSpecRunAll call crystal_lang#run_all_spec(<f-args>)
|
||||||
|
command! -buffer -nargs=? CrystalSpecRunCurrent call crystal_lang#run_current_spec(<f-args>)
|
||||||
|
command! -buffer -nargs=* -bar CrystalFormat call crystal_lang#format(<q-args>)
|
||||||
|
|
||||||
|
nnoremap <Plug>(crystal-jump-to-definition) :<C-u>CrystalDef<CR>
|
||||||
|
nnoremap <Plug>(crystal-show-context) :<C-u>CrystalContext<CR>
|
||||||
|
nnoremap <Plug>(crystal-spec-switch) :<C-u>CrystalSpecSwitch<CR>
|
||||||
|
nnoremap <Plug>(crystal-spec-run-all) :<C-u>CrystalSpecRunAll<CR>
|
||||||
|
nnoremap <Plug>(crystal-spec-run-current) :<C-u>CrystalSpecRunCurrent<CR>
|
||||||
|
nnoremap <Plug>(crystal-format) :<C-u>CrystalFormat<CR>
|
||||||
|
|
||||||
|
augroup plugin-ft-crystal
|
||||||
|
autocmd!
|
||||||
|
autocmd BufWritePre <buffer> if g:crystal_auto_format | CrystalFormat | endif
|
||||||
|
augroup END
|
||||||
|
|
||||||
if get(g:, 'crystal_define_mappings', 1)
|
if get(g:, 'crystal_define_mappings', 1)
|
||||||
nmap <buffer>gd <Plug>(crystal-jump-to-definition)
|
nmap <buffer>gd <Plug>(crystal-jump-to-definition)
|
||||||
nmap <buffer>gc <Plug>(crystal-show-context)
|
nmap <buffer>gc <Plug>(crystal-show-context)
|
||||||
|
|||||||
@@ -1,5 +1,8 @@
|
|||||||
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'javascript') == -1
|
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'javascript') == -1
|
||||||
|
|
||||||
setlocal suffixesadd+=.js
|
setlocal suffixesadd+=.js
|
||||||
|
if (v:version < 704 || (v:version == 704 && !has('patch002'))) && exists('®expengine')
|
||||||
|
set re=1
|
||||||
|
end
|
||||||
|
|
||||||
endif
|
endif
|
||||||
|
|||||||
15
ftplugin/mako.vim
Normal file
15
ftplugin/mako.vim
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'mako') == -1
|
||||||
|
|
||||||
|
" Vim filetype plugin file
|
||||||
|
" Language: Mako
|
||||||
|
" Maintainer: Randy Stauner <randy@magnificent-tears.com>
|
||||||
|
" Last Change: 2014-02-07
|
||||||
|
" Version: 0.1
|
||||||
|
|
||||||
|
if exists("b:did_ftplugin") | finish | endif
|
||||||
|
let b:did_ftplugin = 1
|
||||||
|
|
||||||
|
setlocal comments=:##
|
||||||
|
setlocal commentstring=##%s
|
||||||
|
|
||||||
|
endif
|
||||||
12
ftplugin/slim.vim
Normal file
12
ftplugin/slim.vim
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'slim') == -1
|
||||||
|
|
||||||
|
if exists("b:did_ftplugin")
|
||||||
|
finish
|
||||||
|
endif
|
||||||
|
let b:did_ftplugin = 1
|
||||||
|
|
||||||
|
let b:undo_ftplugin = "setl isk<"
|
||||||
|
|
||||||
|
setlocal iskeyword+=-
|
||||||
|
|
||||||
|
endif
|
||||||
@@ -16,7 +16,7 @@ setlocal formatoptions=cl
|
|||||||
|
|
||||||
let s:comment = '\v^\s*#' " # comment
|
let s:comment = '\v^\s*#' " # comment
|
||||||
let s:array_entry = '\v^\s*-\s' " - foo
|
let s:array_entry = '\v^\s*-\s' " - foo
|
||||||
let s:named_module_entry = '\v^\s*-\s*(name|hosts):\s*\S' " - name: 'do stuff'
|
let s:named_module_entry = '\v^\s*-\s*(name|hosts|role):\s*\S' " - name: 'do stuff'
|
||||||
let s:dictionary_entry = '\v^\s*[^:-]+:\s*$' " with_items:
|
let s:dictionary_entry = '\v^\s*[^:-]+:\s*$' " with_items:
|
||||||
let s:key_value = '\v^\s*[^:-]+:\s*\S' " apt: name=package
|
let s:key_value = '\v^\s*[^:-]+:\s*\S' " apt: name=package
|
||||||
let s:scalar_value = '\v:\s*[>|\|]\s*$' " shell: >
|
let s:scalar_value = '\v:\s*[>|\|]\s*$' " shell: >
|
||||||
|
|||||||
@@ -113,24 +113,22 @@ function! GetHaskellIndent()
|
|||||||
let l:hlstack = s:getHLStack()
|
let l:hlstack = s:getHLStack()
|
||||||
|
|
||||||
" do not indent in strings and quasiquotes
|
" do not indent in strings and quasiquotes
|
||||||
if index(l:hlstack, 'haskellString') > -1 || index(l:hlstack, 'haskellQuasiQuote') > -1
|
if index(l:hlstack, 'haskellQuasiQuote') > -1 || index(l:hlstack, 'haskellBlockComment') > -1
|
||||||
return -1
|
return -1
|
||||||
endif
|
endif
|
||||||
|
|
||||||
" blockcomment handling
|
|
||||||
if index(l:hlstack, 'haskellBlockComment') > -1
|
|
||||||
for l:c in range(v:lnum - 1, 0, -1)
|
|
||||||
let l:line = getline(l:c)
|
|
||||||
if l:line =~ '{-'
|
|
||||||
return 1 + match(l:line, '{-')
|
|
||||||
endif
|
|
||||||
endfor
|
|
||||||
return 1
|
|
||||||
endif
|
|
||||||
|
|
||||||
let l:prevline = getline(v:lnum - 1)
|
let l:prevline = getline(v:lnum - 1)
|
||||||
let l:line = getline(v:lnum)
|
let l:line = getline(v:lnum)
|
||||||
|
|
||||||
|
" indent multiline strings
|
||||||
|
if index(l:hlstack, 'haskellString') > -1
|
||||||
|
if l:line =~ '^\s*\\'
|
||||||
|
return match(l:prevline, '["\\]')
|
||||||
|
else
|
||||||
|
return - 1
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
|
||||||
" reset
|
" reset
|
||||||
if l:prevline =~ '^\s*$' && l:line !~ '^\s*\S'
|
if l:prevline =~ '^\s*$' && l:line !~ '^\s*\S'
|
||||||
return 0
|
return 0
|
||||||
@@ -319,7 +317,10 @@ function! GetHaskellIndent()
|
|||||||
" foo
|
" foo
|
||||||
" >>{
|
" >>{
|
||||||
if l:line =~ '^\s*{' && l:prevline !~ '^{'
|
if l:line =~ '^\s*{' && l:prevline !~ '^{'
|
||||||
return match(l:prevline, '\S') + &shiftwidth
|
let l:s = match(l:prevline, '\S')
|
||||||
|
if l:s >= 0
|
||||||
|
return l:s + &shiftwidth
|
||||||
|
endif
|
||||||
endif
|
endif
|
||||||
|
|
||||||
" in foo
|
" in foo
|
||||||
|
|||||||
@@ -19,6 +19,7 @@ setlocal nosmartindent
|
|||||||
setlocal indentexpr=GetJavascriptIndent()
|
setlocal indentexpr=GetJavascriptIndent()
|
||||||
setlocal formatexpr=Fixedgq(v:lnum,v:count)
|
setlocal formatexpr=Fixedgq(v:lnum,v:count)
|
||||||
setlocal indentkeys=0{,0},0),0],0\,:,!^F,o,O,e
|
setlocal indentkeys=0{,0},0),0],0\,:,!^F,o,O,e
|
||||||
|
setlocal cinoptions+=j1,J1
|
||||||
|
|
||||||
" Only define the function once.
|
" Only define the function once.
|
||||||
if exists("*GetJavascriptIndent")
|
if exists("*GetJavascriptIndent")
|
||||||
@@ -42,19 +43,17 @@ endif
|
|||||||
" 1. Variables {{{1
|
" 1. Variables {{{1
|
||||||
" ============
|
" ============
|
||||||
|
|
||||||
let s:js_keywords = '^\s*\(break\|catch\|const\|continue\|debugger\|delete\|do\|else\|finally\|for\|function\|if\|in\|instanceof\|let\|new\|return\|switch\|this\|throw\|try\|typeof\|var\|void\|while\|with\)'
|
let s:line_pre = '^\s*\%(\/\*.*\*\/\s*\)*'
|
||||||
let s:expr_case = '^\s*\(case\s\+[^\:]*\|default\)\s*:\s*'
|
let s:js_keywords = s:line_pre . '\%(break\|catch\|const\|continue\|debugger\|delete\|do\|else\|finally\|for\|function\|if\|in\|instanceof\|let\|new\|return\|switch\|this\|throw\|try\|typeof\|var\|void\|while\|with\)\>\C'
|
||||||
|
let s:expr_case = s:line_pre . '\%(case\s\+[^\:]*\|default\)\s*:\s*\C'
|
||||||
" Regex of syntax group names that are or delimit string or are comments.
|
" Regex of syntax group names that are or delimit string or are comments.
|
||||||
let s:syng_strcom = '\%(\%(template\)\@<!string\|regex\|comment\)\c'
|
let s:syng_strcom = '\%(string\|regex\|comment\|template\)\c'
|
||||||
|
|
||||||
" Regex of syntax group names that are or delimit template strings
|
|
||||||
let s:syng_template = 'template\c'
|
|
||||||
|
|
||||||
" Regex of syntax group names that are strings.
|
" Regex of syntax group names that are strings.
|
||||||
let s:syng_string = 'regex\c'
|
let s:syng_string = 'regex\c'
|
||||||
|
|
||||||
" Regex of syntax group names that are strings or documentation.
|
" Regex of syntax group names that are strings or documentation.
|
||||||
let s:syng_multiline = 'comment\c'
|
let s:syng_multiline = '\%(comment\|doc\)\c'
|
||||||
|
|
||||||
" Regex of syntax group names that are line comment.
|
" Regex of syntax group names that are line comment.
|
||||||
let s:syng_linecom = 'linecomment\c'
|
let s:syng_linecom = 'linecomment\c'
|
||||||
@@ -62,37 +61,39 @@ let s:syng_linecom = 'linecomment\c'
|
|||||||
" Expression used to check whether we should skip a match with searchpair().
|
" Expression used to check whether we should skip a match with searchpair().
|
||||||
let s:skip_expr = "synIDattr(synID(line('.'),col('.'),1),'name') =~ '".s:syng_strcom."'"
|
let s:skip_expr = "synIDattr(synID(line('.'),col('.'),1),'name') =~ '".s:syng_strcom."'"
|
||||||
|
|
||||||
let s:line_term = '\s*\%(\%(\/\/\).*\)\=$'
|
let s:line_term = '\s*\%(\%(\/\/.*\)\=\|\%(\/\*.*\*\/\s*\)*\)$'
|
||||||
|
|
||||||
" Regex that defines continuation lines, not including (, {, or [.
|
" Regex that defines continuation lines, not including (, {, or [.
|
||||||
let s:continuation_regex = '\%([\\*/.:]\|+\@<!+\|-\@<!-\|\%(<%\)\@<!=\|\W[|&?]\|||\|&&\|[^=]=[^=>].*,\)' . s:line_term
|
let s:continuation_regex = '\%([*.?:]\|+\@<!+\|-\@<!-\|\*\@<!\/\|=\|||\|&&\)' . s:line_term
|
||||||
|
|
||||||
" Regex that defines continuation lines.
|
let s:one_line_scope_regex = '\%(\<else\>\|=>\)\C' . s:line_term
|
||||||
" TODO: this needs to deal with if ...: and so on
|
|
||||||
let s:msl_regex = s:continuation_regex.'\|'.s:expr_case
|
|
||||||
|
|
||||||
let s:one_line_scope_regex = '\%(\%(\<else\>\|\<\%(if\|for\|while\)\>\s*(\%([^()]*\|[^()]*(\%([^()]*\|[^()]*(\%([^()]*\|[^()]*([^()]*)[^()]*\))[^()]*\))[^()]*\))\)\|=>\)' . s:line_term
|
function s:Onescope(lnum)
|
||||||
|
if getline(a:lnum) =~ s:one_line_scope_regex
|
||||||
|
return 1
|
||||||
|
end
|
||||||
|
let mypos = col('.')
|
||||||
|
call cursor(a:lnum, 1)
|
||||||
|
if search('\<\%(while\|for\|if\)\>\s*(\C', 'ce', a:lnum) > 0 &&
|
||||||
|
\ searchpair('(', '', ')', 'W', s:skip_expr, a:lnum) > 0 &&
|
||||||
|
\ col('.') == strlen(s:RemoveTrailingComments(getline(a:lnum)))
|
||||||
|
call cursor(a:lnum, mypos)
|
||||||
|
return 1
|
||||||
|
else
|
||||||
|
call cursor(a:lnum, mypos)
|
||||||
|
return 0
|
||||||
|
end
|
||||||
|
endfunction
|
||||||
|
|
||||||
" Regex that defines blocks.
|
" Regex that defines blocks.
|
||||||
let s:block_regex = '\%([{([]\)\s*\%(|\%([*@]\=\h\w*,\=\s*\)\%(,\s*[*@]\=\h\w*\)*|\)\=' . s:line_term
|
let s:block_regex = '[{([]' . s:line_term
|
||||||
|
|
||||||
let s:operator_first = '^\s*\%([*/.:?]\|\([-+]\)\1\@!\|||\|&&\)'
|
let s:operator_first = s:line_pre . '\%([.,:?]\|\([-/+*]\)\%(\1\|\*\|\/\)\@!\|||\|&&\)'
|
||||||
|
|
||||||
let s:var_stmt = '^\s*\%(const\|let\|var\)'
|
let s:var_stmt = s:line_pre . '\%(const\|let\|var\)\s\+\C'
|
||||||
|
|
||||||
let s:comma_first = '^\s*,'
|
let s:comma_last = ',' . s:line_term
|
||||||
let s:comma_last = ',\s*$'
|
|
||||||
|
|
||||||
let s:case_indent = s:sw()
|
|
||||||
let s:case_indent_after = s:sw()
|
|
||||||
let s:m = matchlist(&cinoptions, ':\(.\)')
|
|
||||||
if (len(s:m) > 2)
|
|
||||||
let s:case_indent = s:m[1]
|
|
||||||
endif
|
|
||||||
let s:m = matchlist(&cinoptions, '=\(.\)')
|
|
||||||
if (len(s:m) > 2)
|
|
||||||
let s:case_indent_after = s:m[1]
|
|
||||||
endif
|
|
||||||
" 2. Auxiliary Functions {{{1
|
" 2. Auxiliary Functions {{{1
|
||||||
" ======================
|
" ======================
|
||||||
|
|
||||||
@@ -106,11 +107,6 @@ function s:IsInString(lnum, col)
|
|||||||
return synIDattr(synID(a:lnum, a:col, 1), 'name') =~ s:syng_string
|
return synIDattr(synID(a:lnum, a:col, 1), 'name') =~ s:syng_string
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
" Check if the character at lnum:col is inside a template string.
|
|
||||||
function s:IsInTempl(lnum, col)
|
|
||||||
return synIDattr(synID(a:lnum, a:col, 1), 'name') =~ s:syng_template
|
|
||||||
endfunction
|
|
||||||
|
|
||||||
" Check if the character at lnum:col is inside a multi-line comment.
|
" Check if the character at lnum:col is inside a multi-line comment.
|
||||||
function s:IsInMultilineComment(lnum, col)
|
function s:IsInMultilineComment(lnum, col)
|
||||||
return !s:IsLineComment(a:lnum, a:col) && synIDattr(synID(a:lnum, a:col, 1), 'name') =~ s:syng_multiline
|
return !s:IsLineComment(a:lnum, a:col) && synIDattr(synID(a:lnum, a:col, 1), 'name') =~ s:syng_multiline
|
||||||
@@ -129,15 +125,15 @@ function s:PrevNonBlankNonString(lnum)
|
|||||||
" Go in and out of blocks comments as necessary.
|
" Go in and out of blocks comments as necessary.
|
||||||
" If the line isn't empty (with opt. comment) or in a string, end search.
|
" If the line isn't empty (with opt. comment) or in a string, end search.
|
||||||
let line = getline(lnum)
|
let line = getline(lnum)
|
||||||
if s:IsInMultilineComment(lnum, matchend(line, '/\*') - 1)
|
if s:IsInMultilineComment(lnum, matchend(line, '^\s*/\*') - 1) && line !~ s:line_pre . '$'
|
||||||
if in_block
|
if in_block
|
||||||
let in_block = 0
|
let in_block = 0
|
||||||
else
|
else
|
||||||
break
|
break
|
||||||
endif
|
endif
|
||||||
elseif !in_block && s:IsInMultilineComment(lnum, matchend(line, '\*/') - 1)
|
elseif !in_block && s:IsInMultilineComment(lnum, match(line, '\*/\s*$') + 1) && line !~ s:line_pre . '$'
|
||||||
let in_block = 1
|
let in_block = 1
|
||||||
elseif !in_block && line !~ '^\s*\%(//\).*$' && !(s:IsInStringOrComment(lnum, 1) && s:IsInStringOrComment(lnum, strlen(line)))
|
elseif !in_block && line !~ s:line_pre . '\%(//\).*$' && !(s:IsInStringOrComment(lnum, 1) && s:IsInStringOrComment(lnum, strlen(line)))
|
||||||
break
|
break
|
||||||
endif
|
endif
|
||||||
let lnum = prevnonblank(lnum - 1)
|
let lnum = prevnonblank(lnum - 1)
|
||||||
@@ -154,10 +150,12 @@ function s:GetMSL(lnum, in_one_line_scope)
|
|||||||
" If we have a continuation line, or we're in a string, use line as MSL.
|
" If we have a continuation line, or we're in a string, use line as MSL.
|
||||||
" Otherwise, terminate search as we have found our MSL already.
|
" Otherwise, terminate search as we have found our MSL already.
|
||||||
let line = getline(lnum)
|
let line = getline(lnum)
|
||||||
let col = match(line, s:msl_regex) + 1
|
let col = match(line, s:continuation_regex) + 1
|
||||||
|
let coal = match(line, s:comma_last) + 1
|
||||||
let line2 = getline(msl)
|
let line2 = getline(msl)
|
||||||
let col2 = matchend(line2, ')')
|
let col2 = matchend(line2, ')')
|
||||||
if (col > 0 && !s:IsInStringOrComment(lnum, col)) || s:IsInString(lnum, strlen(line))
|
if ((col > 0 && !s:IsInStringOrComment(lnum, col) || coal > 0 && !s:IsInStringOrComment(lnum,coal)) &&
|
||||||
|
\ !s:Match(lnum, s:expr_case)) || s:IsInString(lnum, strlen(line))
|
||||||
let msl = lnum
|
let msl = lnum
|
||||||
|
|
||||||
" if there are more closing brackets, continue from the line which has the matching opening bracket
|
" if there are more closing brackets, continue from the line which has the matching opening bracket
|
||||||
@@ -176,7 +174,7 @@ function s:GetMSL(lnum, in_one_line_scope)
|
|||||||
if a:in_one_line_scope
|
if a:in_one_line_scope
|
||||||
break
|
break
|
||||||
end
|
end
|
||||||
let msl_one_line = s:Match(lnum, s:one_line_scope_regex)
|
let msl_one_line = s:Onescope(lnum)
|
||||||
if msl_one_line == 0
|
if msl_one_line == 0
|
||||||
break
|
break
|
||||||
endif
|
endif
|
||||||
@@ -187,34 +185,41 @@ function s:GetMSL(lnum, in_one_line_scope)
|
|||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function s:RemoveTrailingComments(content)
|
function s:RemoveTrailingComments(content)
|
||||||
let single = '\/\/\(.*\)\s*$'
|
let single = '\/\/\%(.*\)\s*$'
|
||||||
let multi = '\/\*\(.*\)\*\/\s*$'
|
let multi = '\/\*\%(.*\)\*\/\s*$'
|
||||||
return substitute(substitute(a:content, single, '', ''), multi, '', '')
|
return substitute(substitute(substitute(a:content, single, '', ''), multi, '', ''), '\s\+$', '', '')
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
" Find if the string is inside var statement (but not the first string)
|
" Find if the string is inside var statement (but not the first string)
|
||||||
function s:InMultiVarStatement(lnum)
|
function s:InMultiVarStatement(lnum, cont, prev)
|
||||||
let lnum = s:PrevNonBlankNonString(a:lnum - 1)
|
let lnum = s:PrevNonBlankNonString(a:lnum - 1)
|
||||||
|
|
||||||
" let type = synIDattr(synID(lnum, indent(lnum) + 1, 0), 'name')
|
" let type = synIDattr(synID(lnum, indent(lnum) + 1, 0), 'name')
|
||||||
|
|
||||||
" loop through previous expressions to find a var statement
|
" loop through previous expressions to find a var statement
|
||||||
while lnum > 0
|
while lnum > 0 && (s:Match(lnum, s:comma_last) ||(a:cont && getline(lnum) =~ s:line_pre . '}') ||
|
||||||
let line = getline(lnum)
|
\ s:Match(lnum,s:continuation_regex)) || (a:prev && (s:Match(a:prev, s:comma_last) ||
|
||||||
|
\ s:Match(a:prev,s:continuation_regex)))
|
||||||
" if the line is a js keyword
|
" if the line is a js keyword
|
||||||
if (line =~ s:js_keywords)
|
if a:cont
|
||||||
|
call cursor(lnum,1)
|
||||||
|
if searchpair('{', '', '}', 'bW', s:skip_expr) > 0
|
||||||
|
let lnum = line('.')
|
||||||
|
end
|
||||||
|
end
|
||||||
|
if s:Match(lnum, s:js_keywords)
|
||||||
" check if the line is a var stmt
|
" check if the line is a var stmt
|
||||||
" if the line has a comma first or comma last then we can assume that we
|
" if the line has a comma first or comma last then we can assume that we
|
||||||
" are in a multiple var statement
|
" are in a multiple var statement
|
||||||
if (line =~ s:var_stmt)
|
if s:Match(lnum, s:var_stmt) && (s:Match(lnum, s:comma_last)||s:Match(lnum,s:continuation_regex))
|
||||||
return lnum
|
return lnum
|
||||||
endif
|
endif
|
||||||
|
|
||||||
" other js keywords, not a var
|
" other js keywords, not a var
|
||||||
return 0
|
if !s:Match(lnum, s:comma_last)||!s:Match(lnum,s:continuation_regex)
|
||||||
|
return 0
|
||||||
|
end
|
||||||
endif
|
endif
|
||||||
|
|
||||||
let lnum = s:PrevNonBlankNonString(lnum - 1)
|
let lnum = s:PrevNonBlankNonString(lnum - 1)
|
||||||
endwhile
|
endwhile
|
||||||
|
|
||||||
@@ -222,25 +227,25 @@ function s:InMultiVarStatement(lnum)
|
|||||||
return 0
|
return 0
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
" Find line above with beginning of the var statement or returns 0 if it's not
|
" Find line above with beginning of the var statement or returns 0 if it's not"{{{2
|
||||||
" this statement
|
" this statement
|
||||||
function s:GetVarIndent(lnum)
|
" function s:GetVarIndent(lnum)
|
||||||
let lvar = s:InMultiVarStatement(a:lnum)
|
" let lvar = s:InMultiVarStatement(a:lnum, 0,0)
|
||||||
let prev_lnum = s:PrevNonBlankNonString(a:lnum - 1)
|
" let prev_lnum = s:PrevNonBlankNonString(a:lnum - 1)
|
||||||
|
|
||||||
if lvar
|
" if lvar
|
||||||
let line = s:RemoveTrailingComments(getline(prev_lnum))
|
" let line = s:RemoveTrailingComments(getline(prev_lnum))
|
||||||
|
|
||||||
" if the previous line doesn't end in a comma, return to regular indent
|
" " if the previous line doesn't end in a comma, return to regular indent
|
||||||
if (line !~ s:comma_last)
|
" if (line !~ s:comma_last)
|
||||||
return indent(prev_lnum) - s:sw()
|
" return indent(prev_lnum) - s:sw()
|
||||||
else
|
" else
|
||||||
return indent(lvar) + s:sw()
|
" return indent(lvar) + s:sw()
|
||||||
endif
|
" endif
|
||||||
endif
|
" endif
|
||||||
|
|
||||||
return -1
|
" return -1
|
||||||
endfunction
|
" endfunction"}}}
|
||||||
|
|
||||||
|
|
||||||
" Check if line 'lnum' has more opening brackets than closing ones.
|
" Check if line 'lnum' has more opening brackets than closing ones.
|
||||||
@@ -261,7 +266,7 @@ function s:LineHasOpeningBrackets(lnum)
|
|||||||
endif
|
endif
|
||||||
let pos = match(line, '[][(){}]', pos + 1)
|
let pos = match(line, '[][(){}]', pos + 1)
|
||||||
endwhile
|
endwhile
|
||||||
return (open_0 > 0 ? 1 : (open_0 == 0 ? 0 : 2)) . (open_2 > 0) . (open_4 > 0)
|
return (open_0 > 0 ? 1 : (open_0 == 0 ? 0 : 2)) . (open_2 > 0 ? 1 : (open_2 == 0 ? 0 : 2)) . (open_4 > 0 ? 1 : (open_4 == 0 ? 0 : 2))
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function s:Match(lnum, regex)
|
function s:Match(lnum, regex)
|
||||||
@@ -293,7 +298,9 @@ function s:IndentWithContinuation(lnum, ind, width)
|
|||||||
return msl_ind + a:width
|
return msl_ind + a:width
|
||||||
else
|
else
|
||||||
return msl_ind
|
return msl_ind
|
||||||
endif
|
end
|
||||||
|
elseif s:InMultiVarStatement(p_lnum, 0, s:PrevNonBlankNonString(p_lnum - 1))
|
||||||
|
return indent(p_lnum) - s:sw()
|
||||||
endif
|
endif
|
||||||
|
|
||||||
return a:ind
|
return a:ind
|
||||||
@@ -301,7 +308,7 @@ endfunction
|
|||||||
|
|
||||||
function s:InOneLineScope(lnum)
|
function s:InOneLineScope(lnum)
|
||||||
let msl = s:GetMSL(a:lnum, 1)
|
let msl = s:GetMSL(a:lnum, 1)
|
||||||
if msl > 0 && s:Match(msl, s:one_line_scope_regex)
|
if msl > 0 && s:Onescope(msl)
|
||||||
return msl
|
return msl
|
||||||
endif
|
endif
|
||||||
return 0
|
return 0
|
||||||
@@ -311,11 +318,11 @@ function s:ExitingOneLineScope(lnum)
|
|||||||
let msl = s:GetMSL(a:lnum, 1)
|
let msl = s:GetMSL(a:lnum, 1)
|
||||||
if msl > 0
|
if msl > 0
|
||||||
" if the current line is in a one line scope ..
|
" if the current line is in a one line scope ..
|
||||||
if s:Match(msl, s:one_line_scope_regex)
|
if s:Onescope(msl)
|
||||||
return 0
|
return 0
|
||||||
else
|
else
|
||||||
let prev_msl = s:GetMSL(msl - 1, 1)
|
let prev_msl = s:GetMSL(msl - 1, 1)
|
||||||
if s:Match(prev_msl, s:one_line_scope_regex)
|
if s:Onescope(prev_msl)
|
||||||
return prev_msl
|
return prev_msl
|
||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
@@ -327,13 +334,12 @@ endfunction
|
|||||||
" =========================
|
" =========================
|
||||||
|
|
||||||
function GetJavascriptIndent()
|
function GetJavascriptIndent()
|
||||||
" 3.1. Setup {{{2
|
" 3.1. Setup {{{1
|
||||||
" ----------
|
" ----------
|
||||||
|
|
||||||
" Set up variables for restoring position in file. Could use v:lnum here.
|
" Set up variables for restoring position in file. Could use v:lnum here.
|
||||||
let vcol = col('.')
|
let vcol = col('.')
|
||||||
|
|
||||||
" 3.2. Work on the current line {{{2
|
" 3.2. Work on the current line {{{1
|
||||||
" -----------------------------
|
" -----------------------------
|
||||||
|
|
||||||
let ind = -1
|
let ind = -1
|
||||||
@@ -342,116 +348,79 @@ function GetJavascriptIndent()
|
|||||||
" previous nonblank line number
|
" previous nonblank line number
|
||||||
let prevline = prevnonblank(v:lnum - 1)
|
let prevline = prevnonblank(v:lnum - 1)
|
||||||
|
|
||||||
if (line =~ s:expr_case)
|
" to not change multiline string values
|
||||||
if (getline(prevline) =~ s:expr_case)
|
if synIDattr(synID(v:lnum, 1, 1), 'name') =~? 'string\|template' && line !~ s:line_pre . '[''"`]'
|
||||||
return indent(prevline)
|
return indent(v:lnum)
|
||||||
else
|
|
||||||
if (getline(prevline) =~ s:block_regex)
|
|
||||||
return indent(prevline) + s:case_indent
|
|
||||||
else
|
|
||||||
return indent(prevline) - s:case_indent_after
|
|
||||||
endif
|
|
||||||
endif
|
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
" If we are in a multi-line comment, cindent does the right thing.
|
||||||
|
if s:IsInMultilineComment(v:lnum, 1) && !s:IsLineComment(v:lnum, 1) &&
|
||||||
|
\ s:IsInMultilineComment(v:lnum, match(line, '\s*$')) && line !~ '^\/\*'
|
||||||
|
return cindent(v:lnum)
|
||||||
|
endif
|
||||||
|
|
||||||
|
" single opening bracket will assume you want a c style of indenting
|
||||||
|
if s:Match(v:lnum, s:line_pre . '{' . s:line_term)
|
||||||
|
return cindent(v:lnum)
|
||||||
|
endif
|
||||||
|
|
||||||
|
" cindent each line which has a switch label
|
||||||
|
if (line =~ s:expr_case)
|
||||||
|
return cindent(v:lnum)
|
||||||
|
endif
|
||||||
|
|
||||||
" If we got a closing bracket on an empty line, find its match and indent
|
" If we got a closing bracket on an empty line, find its match and indent
|
||||||
" according to it. For parentheses we indent to its column - 1, for the
|
" according to it. For parentheses we indent to its column - 1, for the
|
||||||
" others we indent to the containing line's MSL's level. Return -1 if fail.
|
" others we indent to the containing line's MSL's level. Return -1 if fail.
|
||||||
let col = matchend(line, '^\s*[],})]')
|
let col = matchend(line, s:line_pre . '[]})]')
|
||||||
if col > 0 && !s:IsInStringOrComment(v:lnum, col)
|
if col > 0 && !s:IsInStringOrComment(v:lnum, col)
|
||||||
call cursor(v:lnum, col)
|
call cursor(v:lnum, col)
|
||||||
|
|
||||||
let lvar = s:InMultiVarStatement(v:lnum)
|
|
||||||
if lvar
|
|
||||||
let prevline_contents = s:RemoveTrailingComments(getline(prevline))
|
|
||||||
|
|
||||||
" check for comma first
|
|
||||||
if (line[col - 1] =~ ',')
|
|
||||||
" if the previous line ends in comma or semicolon don't indent
|
|
||||||
if (prevline_contents =~ '[;,]\s*$')
|
|
||||||
return indent(s:GetMSL(line('.'), 0))
|
|
||||||
" get previous line indent, if it's comma first return prevline indent
|
|
||||||
elseif (prevline_contents =~ s:comma_first)
|
|
||||||
return indent(prevline)
|
|
||||||
" otherwise we indent 1 level
|
|
||||||
else
|
|
||||||
return indent(lvar) + s:sw()
|
|
||||||
endif
|
|
||||||
endif
|
|
||||||
endif
|
|
||||||
|
|
||||||
|
|
||||||
let bs = strpart('(){}[]', stridx(')}]', line[col - 1]) * 2, 2)
|
let bs = strpart('(){}[]', stridx(')}]', line[col - 1]) * 2, 2)
|
||||||
if searchpair(escape(bs[0], '\['), '', bs[1], 'bW', s:skip_expr) > 0
|
if searchpair(escape(bs[0], '\['), '', bs[1], 'bW', s:skip_expr) > 0
|
||||||
if line[col-1]==')' && col('.') != col('$') - 1
|
let ind = s:InMultiVarStatement(line('.'), 0, 0) ? indent(line('.')) : indent(s:GetMSL(line('.'), 0))
|
||||||
let ind = virtcol('.')-1
|
|
||||||
else
|
|
||||||
let ind = indent(s:GetMSL(line('.'), 0))
|
|
||||||
endif
|
|
||||||
endif
|
endif
|
||||||
return ind
|
return ind
|
||||||
endif
|
endif
|
||||||
|
|
||||||
" If the line is comma first, dedent 1 level
|
|
||||||
if (getline(prevline) =~ s:comma_first)
|
|
||||||
return indent(prevline) - s:sw()
|
|
||||||
endif
|
|
||||||
if (getline(prevline) =~ s:expr_case)
|
|
||||||
return indent(prevline) + s:case_indent_after
|
|
||||||
endif
|
|
||||||
|
|
||||||
" If line starts with an operator...
|
" If line starts with an operator...
|
||||||
if (s:Match(v:lnum, s:operator_first))
|
if (line =~ s:operator_first)
|
||||||
if (s:Match(prevline, s:operator_first))
|
if (s:Match(prevline, s:operator_first))
|
||||||
" and so does previous line, don't indent
|
" and so does previous line, don't indent
|
||||||
return indent(prevline)
|
return indent(prevline)
|
||||||
end
|
end
|
||||||
let counts = s:LineHasOpeningBrackets(prevline)
|
let counts = s:LineHasOpeningBrackets(prevline)
|
||||||
if counts[0] == '2'
|
if counts[0] == '2' || counts[1] == '2' || counts[2] == '2'
|
||||||
call cursor(prevline, 1)
|
call cursor(prevline, 1)
|
||||||
" Search for the opening tag
|
" Search for the opening tag
|
||||||
let mnum = searchpair('(', '', ')', 'bW', s:skip_expr)
|
let bs = strpart('(){}[]', stridx(')}]', line[col - 1]) * 2, 2)
|
||||||
if mnum > 0 && s:Match(mnum, s:operator_first)
|
if searchpair(escape(bs[0], '\['), '', bs[1], 'bW', s:skip_expr) > 0 && s:Match(line('.'), s:operator_first)
|
||||||
return indent(mnum)
|
return indent(line('.'))
|
||||||
end
|
end
|
||||||
elseif counts[0] != '1' && counts[1] != '1' && counts[2] != '1'
|
elseif counts[0] != '1' && counts[1] != '1' && counts[2] != '1'
|
||||||
" otherwise, indent 1 level
|
" otherwise, indent 1 level
|
||||||
return indent(prevline) + s:sw()
|
return indent(prevline) + s:sw()
|
||||||
end
|
end
|
||||||
|
|
||||||
" If previous line starts with an operator...
|
" If previous line starts with an operator...
|
||||||
elseif s:Match(prevline, s:operator_first) && !s:Match(prevline, s:comma_last) && !s:Match(prevline, '};\=' . s:line_term)
|
elseif (s:Match(prevline, s:operator_first) && !s:Match(prevline,s:continuation_regex))||getline(prevline) =~ ');\=' . s:line_term
|
||||||
let counts = s:LineHasOpeningBrackets(prevline)
|
let counts = s:LineHasOpeningBrackets(prevline)
|
||||||
if counts[0] == '2' && counts[1] == '1'
|
if counts[0] == '2' && !s:Match(prevline, s:operator_first)
|
||||||
call cursor(prevline, 1)
|
call cursor(prevline, 1)
|
||||||
" Search for the opening tag
|
" Search for the opening tag
|
||||||
let mnum = searchpair('(', '', ')', 'bW', s:skip_expr)
|
let mnum = searchpair('(', '', ')', 'bW', s:skip_expr)
|
||||||
if mnum > 0 && !s:Match(mnum, s:operator_first)
|
if mnum > 0 && s:Match(mnum, s:operator_first)
|
||||||
return indent(mnum) + s:sw()
|
return indent(mnum) - s:sw()
|
||||||
|
end
|
||||||
|
elseif s:Match(prevline, s:operator_first)
|
||||||
|
if counts[0] != '1' && counts[1] != '1' && counts[2] != '1'
|
||||||
|
return indent(prevline) - s:sw()
|
||||||
end
|
end
|
||||||
elseif counts[0] != '1' && counts[1] != '1' && counts[2] != '1'
|
|
||||||
return indent(prevline) - s:sw()
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
if getline(prevline) =~ '^\s*`$' && s:IsInTempl(v:lnum, 1)
|
" 3.3. Work on the previous line. {{{1
|
||||||
if line !~ '^\s*`$'
|
|
||||||
return indent(prevline) + s:sw()
|
|
||||||
endif
|
|
||||||
elseif line =~ '^\s*`$' && s:IsInTempl(prevline, 1)
|
|
||||||
return indent(prevline) - s:sw()
|
|
||||||
endif
|
|
||||||
|
|
||||||
" If we are in a multi-line comment, cindent does the right thing.
|
|
||||||
if s:IsInMultilineComment(v:lnum, 1) && !s:IsLineComment(v:lnum, 1)
|
|
||||||
return cindent(v:lnum)
|
|
||||||
endif
|
|
||||||
|
|
||||||
" Check for multiple var assignments
|
|
||||||
" let var_indent = s:GetVarIndent(v:lnum)
|
|
||||||
" if var_indent >= 0
|
|
||||||
" return var_indent
|
|
||||||
" endif
|
|
||||||
|
|
||||||
" 3.3. Work on the previous line. {{{2
|
|
||||||
" -------------------------------
|
" -------------------------------
|
||||||
|
|
||||||
" If the line is empty and the previous nonblank line was a multi-line
|
" If the line is empty and the previous nonblank line was a multi-line
|
||||||
@@ -477,11 +446,7 @@ function GetJavascriptIndent()
|
|||||||
|
|
||||||
" If the previous line ended with a block opening, add a level of indent.
|
" If the previous line ended with a block opening, add a level of indent.
|
||||||
if s:Match(lnum, s:block_regex)
|
if s:Match(lnum, s:block_regex)
|
||||||
if (line =~ s:expr_case)
|
return s:InMultiVarStatement(lnum, 0, 0) ? indent(lnum) + s:sw() : indent(s:GetMSL(lnum, 0)) + s:sw()
|
||||||
return indent(s:GetMSL(lnum, 0)) + s:sw()/2
|
|
||||||
else
|
|
||||||
return indent(s:GetMSL(lnum, 0)) + s:sw()
|
|
||||||
endif
|
|
||||||
endif
|
endif
|
||||||
|
|
||||||
" Set up variables for current line.
|
" Set up variables for current line.
|
||||||
@@ -489,43 +454,43 @@ function GetJavascriptIndent()
|
|||||||
let ind = indent(lnum)
|
let ind = indent(lnum)
|
||||||
" If the previous line contained an opening bracket, and we are still in it,
|
" If the previous line contained an opening bracket, and we are still in it,
|
||||||
" add indent depending on the bracket type.
|
" add indent depending on the bracket type.
|
||||||
if line =~ '[[({]'
|
if s:Match(lnum, '[[({})\]]')
|
||||||
let counts = s:LineHasOpeningBrackets(lnum)
|
|
||||||
if counts[0] == '1' && searchpair('(', '', ')', 'bW', s:skip_expr) > 0
|
|
||||||
if col('.') + 1 == col('$') || line =~ s:one_line_scope_regex
|
|
||||||
return ind + s:sw()
|
|
||||||
else
|
|
||||||
return virtcol('.')
|
|
||||||
endif
|
|
||||||
elseif counts[1] == '1' || counts[2] == '1' && counts[0] != '2'
|
|
||||||
return ind + s:sw()
|
|
||||||
else
|
|
||||||
call cursor(v:lnum, vcol)
|
|
||||||
end
|
|
||||||
elseif line =~ '.\+};\=' . s:line_term
|
|
||||||
call cursor(lnum, 1)
|
|
||||||
" Search for the opening tag
|
|
||||||
let mnum = searchpair('{', '', '}', 'bW', s:skip_expr)
|
|
||||||
if mnum > 0
|
|
||||||
return indent(s:GetMSL(mnum, 0))
|
|
||||||
end
|
|
||||||
elseif line =~ '.\+);\=' || line =~ s:comma_last
|
|
||||||
let counts = s:LineHasOpeningBrackets(lnum)
|
let counts = s:LineHasOpeningBrackets(lnum)
|
||||||
if counts[0] == '2'
|
if counts[0] == '2'
|
||||||
call cursor(lnum, 1)
|
call cursor(lnum, 1)
|
||||||
" Search for the opening tag
|
" Search for the opening tag
|
||||||
let mnum = searchpair('(', '', ')', 'bW', s:skip_expr)
|
if searchpair('(', '', ')', 'bW', s:skip_expr) > 0
|
||||||
if mnum > 0
|
return indent(s:GetMSL(line('.'), 0))
|
||||||
return indent(s:GetMSL(mnum, 0))
|
|
||||||
end
|
end
|
||||||
elseif line !~ s:var_stmt
|
elseif counts[1] == '2' && !s:Match(lnum, s:line_pre . '}')
|
||||||
return indent(prevline)
|
call cursor(lnum, 1)
|
||||||
|
" Search for the opening tag
|
||||||
|
if searchpair('{', '', '}', 'bW', s:skip_expr) > 0
|
||||||
|
return indent(s:GetMSL(line('.'), 0))
|
||||||
|
end
|
||||||
|
elseif counts[2] == '2' && !s:Match(lnum, s:line_pre . ']')
|
||||||
|
call cursor(lnum, 1)
|
||||||
|
" Search for the opening tag
|
||||||
|
if searchpair('\[', '', '\]', 'bW', s:skip_expr) > 0
|
||||||
|
return indent(s:GetMSL(line('.'), 0))
|
||||||
|
end
|
||||||
|
elseif counts[1] == '1' || counts[2] == '1' || counts[0] == '1' || s:Onescope(lnum)
|
||||||
|
return ind + s:sw()
|
||||||
|
else
|
||||||
|
call cursor(v:lnum, vcol)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
" 3.4. Work on the MSL line. {{{2
|
" 3.4. Work on the MSL line. {{{1
|
||||||
" --------------------------
|
" --------------------------
|
||||||
|
if s:Match(lnum, s:comma_last) && !s:Match(lnum, s:continuation_regex)
|
||||||
|
return s:Match(lnum, s:var_stmt) ? indent(lnum) + s:sw() : indent(lnum)
|
||||||
|
|
||||||
|
elseif s:Match(s:PrevNonBlankNonString(lnum - 1), s:comma_last)
|
||||||
|
if !s:Match(lnum, s:comma_last) && s:InMultiVarStatement(lnum,1,0)
|
||||||
|
return indent(lnum) - s:sw()
|
||||||
|
end
|
||||||
|
end
|
||||||
let ind_con = ind
|
let ind_con = ind
|
||||||
let ind = s:IndentWithContinuation(lnum, ind_con, s:sw())
|
let ind = s:IndentWithContinuation(lnum, ind_con, s:sw())
|
||||||
|
|
||||||
@@ -550,7 +515,7 @@ endfunction
|
|||||||
|
|
||||||
let &cpo = s:cpo_save
|
let &cpo = s:cpo_save
|
||||||
unlet s:cpo_save
|
unlet s:cpo_save
|
||||||
|
" gq{{{2
|
||||||
function! Fixedgq(lnum, count)
|
function! Fixedgq(lnum, count)
|
||||||
let l:tw = &tw ? &tw : 80;
|
let l:tw = &tw ? &tw : 80;
|
||||||
|
|
||||||
@@ -611,5 +576,7 @@ function! Fixedgq(lnum, count)
|
|||||||
|
|
||||||
return 0
|
return 0
|
||||||
endfunction
|
endfunction
|
||||||
|
"}}}
|
||||||
|
" vim: foldmethod=marker:foldlevel=1
|
||||||
|
|
||||||
endif
|
endif
|
||||||
|
|||||||
358
indent/mako.vim
Normal file
358
indent/mako.vim
Normal file
@@ -0,0 +1,358 @@
|
|||||||
|
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'mako') == -1
|
||||||
|
|
||||||
|
" Vim indent file
|
||||||
|
" Language: Mako
|
||||||
|
" Author: Scott Torborg <storborg@mit.edu>
|
||||||
|
" Version: 0.4
|
||||||
|
" License: Do What The Fuck You Want To Public License (WTFPL)
|
||||||
|
"
|
||||||
|
" ---------------------------------------------------------------------------
|
||||||
|
"
|
||||||
|
" DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
|
||||||
|
" Version 2, December 2004
|
||||||
|
"
|
||||||
|
" Copyright (C) 2004 Sam Hocevar <sam@hocevar.net>
|
||||||
|
"
|
||||||
|
" Everyone is permitted to copy and distribute verbatim or modified
|
||||||
|
" copies of this license document, and changing it is allowed as long
|
||||||
|
" as the name is changed.
|
||||||
|
"
|
||||||
|
" DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
|
||||||
|
" TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
|
||||||
|
"
|
||||||
|
" 0. You just DO WHAT THE FUCK YOU WANT TO.
|
||||||
|
"
|
||||||
|
" ---------------------------------------------------------------------------
|
||||||
|
"
|
||||||
|
" This script does more useful indenting for Mako HTML templates. It indents
|
||||||
|
" inside of control blocks, defs, etc. Note that this indenting style will
|
||||||
|
" sacrifice readability of the output text for the sake of readability of the
|
||||||
|
" template.
|
||||||
|
"
|
||||||
|
" We'll use HTML indenting globally, python inside <% %> blocks. Inspired by
|
||||||
|
" the excellent PHP + HTML indentation files such as php.vim by Pim Snel.
|
||||||
|
"
|
||||||
|
" Changelog:
|
||||||
|
" 0.4 - 5 March 2010
|
||||||
|
" - Added license information
|
||||||
|
" 0.3 - 15 September 2009
|
||||||
|
" - Added explicit indenting for ## comments, fixed unindenting count,
|
||||||
|
" thanks to Mike Lewis (@MikeRLewis) for this
|
||||||
|
" 0.2 - 15 June 2009
|
||||||
|
" - Fixed issue where opening and closing mako tags on the same line
|
||||||
|
" would cause incorrect indenting
|
||||||
|
" 0.1 - 06 June 2009
|
||||||
|
" - Initial public release of mako indent file
|
||||||
|
|
||||||
|
let sw=2 " default shiftwidth of 2 spaces
|
||||||
|
|
||||||
|
if exists("b:did_indent")
|
||||||
|
finish
|
||||||
|
endif
|
||||||
|
let b:did_indent = 1
|
||||||
|
|
||||||
|
setlocal nosmartindent
|
||||||
|
setlocal noautoindent
|
||||||
|
setlocal nocindent
|
||||||
|
setlocal nolisp
|
||||||
|
|
||||||
|
setlocal indentexpr=GetMakoIndent()
|
||||||
|
setlocal indentkeys+=*<Return>,<>>,<bs>,end,:
|
||||||
|
|
||||||
|
" Only define the function once.
|
||||||
|
if exists("*GetMakoIndent")
|
||||||
|
finish
|
||||||
|
endif
|
||||||
|
|
||||||
|
if exists('g:html_indent_tags')
|
||||||
|
unlet g:html_indent_tags
|
||||||
|
endif
|
||||||
|
|
||||||
|
function IsInsidePythonBlock(startline)
|
||||||
|
" Loop until we get a line that's either <% or %>
|
||||||
|
let lnum = a:startline
|
||||||
|
while getline(lnum) !~ '\(%>\|<%\)$' && lnum > 0
|
||||||
|
let lnum = lnum - 1
|
||||||
|
endwhile
|
||||||
|
|
||||||
|
" lnum points to the last control. If it's a <% then we're inside an
|
||||||
|
" embedded python block, otherwise we're not.
|
||||||
|
return getline(lnum) =~ '<%$'
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
function GetMakoIndent()
|
||||||
|
" Find a non-empty line above the current line
|
||||||
|
let lnum = prevnonblank(v:lnum - 1)
|
||||||
|
|
||||||
|
" Hit the start of the file, use zero indent.
|
||||||
|
if lnum == 0
|
||||||
|
return 0
|
||||||
|
endif
|
||||||
|
|
||||||
|
let line = getline(lnum) " last line
|
||||||
|
let cline = getline(v:lnum) " current line
|
||||||
|
let pline = getline(lnum - 1) " previous to last line
|
||||||
|
let ind = indent(lnum)
|
||||||
|
if line =~ '^\s*##'
|
||||||
|
return indent(lnum)
|
||||||
|
end
|
||||||
|
|
||||||
|
let restore_ic=&ic
|
||||||
|
let &ic=1 " ignore case
|
||||||
|
|
||||||
|
let ind = <SID>HtmlIndentSum(lnum, -1)
|
||||||
|
let ind = <SID>HtmlIndentSum(lnum, -1)
|
||||||
|
let ind = ind + <SID>HtmlIndentSum(v:lnum, 0)
|
||||||
|
|
||||||
|
let &ic=restore_ic
|
||||||
|
|
||||||
|
let ind = indent(lnum) + (&sw * ind)
|
||||||
|
|
||||||
|
" Indent after %anything: or <%anything NOT ending in />
|
||||||
|
if line =~ '^\s*%.*:\s*$'
|
||||||
|
let ind = ind + &sw
|
||||||
|
endif
|
||||||
|
|
||||||
|
" Unindent before %end* or </%anything
|
||||||
|
if cline =~ '^\s*%\s*end'
|
||||||
|
let ind = ind - &sw
|
||||||
|
endif
|
||||||
|
"
|
||||||
|
" Unindent before %else, %except, and %elif
|
||||||
|
if cline =~ '^\s*%\s*else' || cline =~ '^\s*%\s*except' || cline =~ '^\s*%\s*elif'
|
||||||
|
let ind = ind - &sw
|
||||||
|
endif
|
||||||
|
|
||||||
|
" Indent at the beginning of a python control block
|
||||||
|
if line =~ '<%$'
|
||||||
|
let ind = ind + &sw
|
||||||
|
endif
|
||||||
|
"
|
||||||
|
" Unindent at the end of the python block.
|
||||||
|
if cline =~ '^\s*%>$'
|
||||||
|
let scanlnum = lnum
|
||||||
|
" Scan backwards until we find the beginning of this python block.
|
||||||
|
while getline(scanlnum) !~ '<%$' && scanlnum > 0
|
||||||
|
let scanlnum = scanlnum - 1
|
||||||
|
endwhile
|
||||||
|
let ind = indent(scanlnum)
|
||||||
|
endif
|
||||||
|
|
||||||
|
" If we're inside a python block and the previous line ends in a colon,
|
||||||
|
" indent.
|
||||||
|
if IsInsidePythonBlock(lnum - 1)
|
||||||
|
" Indent after :
|
||||||
|
if line =~ '\:$'
|
||||||
|
let ind = ind + &sw
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
|
||||||
|
return ind
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
|
||||||
|
" [-- helper function to assemble tag list --]
|
||||||
|
fun! <SID>HtmlIndentPush(tag)
|
||||||
|
if exists('g:html_indent_tags')
|
||||||
|
let g:html_indent_tags = g:html_indent_tags.'\|'.a:tag
|
||||||
|
else
|
||||||
|
let g:html_indent_tags = a:tag
|
||||||
|
endif
|
||||||
|
endfun
|
||||||
|
|
||||||
|
fun! <SID>MakoIndentPush(tag)
|
||||||
|
if exists('g:mako_indent_tags')
|
||||||
|
let g:mako_indent_tags = g:mako_indent_tags.'\|'.a:tag
|
||||||
|
else
|
||||||
|
let g:mako_indent_tags = a:tag
|
||||||
|
endif
|
||||||
|
endfun
|
||||||
|
|
||||||
|
" [-- <ELEMENT ? - - ...> --]
|
||||||
|
call <SID>HtmlIndentPush('a')
|
||||||
|
call <SID>HtmlIndentPush('abbr')
|
||||||
|
call <SID>HtmlIndentPush('acronym')
|
||||||
|
call <SID>HtmlIndentPush('address')
|
||||||
|
call <SID>HtmlIndentPush('b')
|
||||||
|
call <SID>HtmlIndentPush('bdo')
|
||||||
|
call <SID>HtmlIndentPush('big')
|
||||||
|
call <SID>HtmlIndentPush('blockquote')
|
||||||
|
call <SID>HtmlIndentPush('button')
|
||||||
|
call <SID>HtmlIndentPush('caption')
|
||||||
|
call <SID>HtmlIndentPush('center')
|
||||||
|
call <SID>HtmlIndentPush('cite')
|
||||||
|
call <SID>HtmlIndentPush('code')
|
||||||
|
call <SID>HtmlIndentPush('colgroup')
|
||||||
|
call <SID>HtmlIndentPush('del')
|
||||||
|
call <SID>HtmlIndentPush('dfn')
|
||||||
|
call <SID>HtmlIndentPush('dir')
|
||||||
|
call <SID>HtmlIndentPush('div')
|
||||||
|
call <SID>HtmlIndentPush('dl')
|
||||||
|
call <SID>HtmlIndentPush('em')
|
||||||
|
call <SID>HtmlIndentPush('fieldset')
|
||||||
|
call <SID>HtmlIndentPush('font')
|
||||||
|
call <SID>HtmlIndentPush('form')
|
||||||
|
call <SID>HtmlIndentPush('frameset')
|
||||||
|
call <SID>HtmlIndentPush('h1')
|
||||||
|
call <SID>HtmlIndentPush('h2')
|
||||||
|
call <SID>HtmlIndentPush('h3')
|
||||||
|
call <SID>HtmlIndentPush('h4')
|
||||||
|
call <SID>HtmlIndentPush('h5')
|
||||||
|
call <SID>HtmlIndentPush('h6')
|
||||||
|
call <SID>HtmlIndentPush('i')
|
||||||
|
call <SID>HtmlIndentPush('iframe')
|
||||||
|
call <SID>HtmlIndentPush('ins')
|
||||||
|
call <SID>HtmlIndentPush('kbd')
|
||||||
|
call <SID>HtmlIndentPush('label')
|
||||||
|
call <SID>HtmlIndentPush('legend')
|
||||||
|
call <SID>HtmlIndentPush('map')
|
||||||
|
call <SID>HtmlIndentPush('menu')
|
||||||
|
call <SID>HtmlIndentPush('noframes')
|
||||||
|
call <SID>HtmlIndentPush('noscript')
|
||||||
|
call <SID>HtmlIndentPush('object')
|
||||||
|
call <SID>HtmlIndentPush('ol')
|
||||||
|
call <SID>HtmlIndentPush('optgroup')
|
||||||
|
call <SID>HtmlIndentPush('pre')
|
||||||
|
call <SID>HtmlIndentPush('q')
|
||||||
|
call <SID>HtmlIndentPush('s')
|
||||||
|
call <SID>HtmlIndentPush('samp')
|
||||||
|
call <SID>HtmlIndentPush('script')
|
||||||
|
call <SID>HtmlIndentPush('select')
|
||||||
|
call <SID>HtmlIndentPush('small')
|
||||||
|
call <SID>HtmlIndentPush('span')
|
||||||
|
call <SID>HtmlIndentPush('strong')
|
||||||
|
call <SID>HtmlIndentPush('style')
|
||||||
|
call <SID>HtmlIndentPush('sub')
|
||||||
|
call <SID>HtmlIndentPush('sup')
|
||||||
|
call <SID>HtmlIndentPush('table')
|
||||||
|
call <SID>HtmlIndentPush('textarea')
|
||||||
|
call <SID>HtmlIndentPush('title')
|
||||||
|
call <SID>HtmlIndentPush('tt')
|
||||||
|
call <SID>HtmlIndentPush('u')
|
||||||
|
call <SID>HtmlIndentPush('ul')
|
||||||
|
call <SID>HtmlIndentPush('var')
|
||||||
|
|
||||||
|
" For some reason the default HTML indentation script doesn't consider these
|
||||||
|
" elements to be worthy of indentation.
|
||||||
|
call <SID>HtmlIndentPush('p')
|
||||||
|
call <SID>HtmlIndentPush('dt')
|
||||||
|
call <SID>HtmlIndentPush('dd')
|
||||||
|
|
||||||
|
|
||||||
|
" [-- <ELEMENT ? O O ...> --]
|
||||||
|
if !exists('g:html_indent_strict')
|
||||||
|
call <SID>HtmlIndentPush('body')
|
||||||
|
call <SID>HtmlIndentPush('head')
|
||||||
|
call <SID>HtmlIndentPush('html')
|
||||||
|
call <SID>HtmlIndentPush('tbody')
|
||||||
|
endif
|
||||||
|
|
||||||
|
|
||||||
|
" [-- <ELEMENT ? O - ...> --]
|
||||||
|
if !exists('g:html_indent_strict_table')
|
||||||
|
call <SID>HtmlIndentPush('th')
|
||||||
|
call <SID>HtmlIndentPush('td')
|
||||||
|
call <SID>HtmlIndentPush('tr')
|
||||||
|
call <SID>HtmlIndentPush('tfoot')
|
||||||
|
call <SID>HtmlIndentPush('thead')
|
||||||
|
endif
|
||||||
|
|
||||||
|
" [-- <Mako Elements> --]
|
||||||
|
call <SID>MakoIndentPush('%def')
|
||||||
|
call <SID>MakoIndentPush('%block')
|
||||||
|
call <SID>MakoIndentPush('%call')
|
||||||
|
call <SID>MakoIndentPush('%doc')
|
||||||
|
call <SID>MakoIndentPush('%text')
|
||||||
|
call <SID>MakoIndentPush('%.\+:.\+')
|
||||||
|
|
||||||
|
delfun <SID>HtmlIndentPush
|
||||||
|
delfun <SID>MakoIndentPush
|
||||||
|
|
||||||
|
set cpo-=C
|
||||||
|
|
||||||
|
" [-- get number of regex matches in a string --]
|
||||||
|
fun! <SID>MatchCount(expr, pat)
|
||||||
|
let mpos = 0
|
||||||
|
let mcount = 0
|
||||||
|
let expr = a:expr
|
||||||
|
while (mpos > -1)
|
||||||
|
let mend = matchend(expr, a:pat)
|
||||||
|
if mend > -1
|
||||||
|
let mcount = mcount + 1
|
||||||
|
endif
|
||||||
|
if mend == mpos
|
||||||
|
let mpos = mpos + 1
|
||||||
|
else
|
||||||
|
let mpos = mend
|
||||||
|
endif
|
||||||
|
let expr = strpart(expr, mpos)
|
||||||
|
endwhile
|
||||||
|
return mcount
|
||||||
|
endfun
|
||||||
|
|
||||||
|
" [-- count indent-increasing tags of line a:lnum --]
|
||||||
|
fun! <SID>HtmlIndentOpen(lnum)
|
||||||
|
let s = substitute('x'.getline(a:lnum),
|
||||||
|
\ '.\{-}\(\(<\)\('.g:html_indent_tags.'\)\>\)', "\1", 'g')
|
||||||
|
let s = substitute(s, "[^\1].*$", '', '')
|
||||||
|
return strlen(s)
|
||||||
|
endfun
|
||||||
|
|
||||||
|
" [-- count indent-decreasing tags of line a:lnum --]
|
||||||
|
fun! <SID>HtmlIndentClose(lnum)
|
||||||
|
let s = substitute('x'.getline(a:lnum),
|
||||||
|
\ '.\{-}\(\(<\)/\('.g:html_indent_tags.'\)\>>\)', "\1", 'g')
|
||||||
|
let s = substitute(s, "[^\1].*$", '', '')
|
||||||
|
return strlen(s)
|
||||||
|
endfun
|
||||||
|
|
||||||
|
" [-- count indent-increasing mako tags of line a:lnum --]
|
||||||
|
fun! <SID>MakoIndentOpen(lnum)
|
||||||
|
let s = substitute('x'.getline(a:lnum),
|
||||||
|
\ '.\{-}\(\(<\)\('.g:mako_indent_tags.'\)\>\)', "\1", 'g')
|
||||||
|
let s = substitute(s, "[^\1].*$", '', '')
|
||||||
|
return strlen(s)
|
||||||
|
endfun
|
||||||
|
|
||||||
|
" [-- count indent-decreasing mako tags of line a:lnum --]
|
||||||
|
fun! <SID>MakoIndentClose(lnum)
|
||||||
|
let mcount = <SID>MatchCount(getline(a:lnum), '</\('.g:mako_indent_tags.'\)>')
|
||||||
|
let mcount = mcount + <SID>MatchCount(getline(a:lnum), '<\('.g:mako_indent_tags.'\)[^>]*/>')
|
||||||
|
return mcount
|
||||||
|
endfun
|
||||||
|
|
||||||
|
" [-- count indent-increasing '{' of (java|css) line a:lnum --]
|
||||||
|
fun! <SID>HtmlIndentOpenAlt(lnum)
|
||||||
|
return strlen(substitute(getline(a:lnum), '[^{]\+', '', 'g'))
|
||||||
|
endfun
|
||||||
|
|
||||||
|
" [-- count indent-decreasing '}' of (java|css) line a:lnum --]
|
||||||
|
fun! <SID>HtmlIndentCloseAlt(lnum)
|
||||||
|
return strlen(substitute(getline(a:lnum), '[^}]\+', '', 'g'))
|
||||||
|
endfun
|
||||||
|
|
||||||
|
" [-- return the sum of indents respecting the syntax of a:lnum --]
|
||||||
|
fun! <SID>HtmlIndentSum(lnum, style)
|
||||||
|
let open = <SID>HtmlIndentOpen(a:lnum) + <SID>MakoIndentOpen(a:lnum)
|
||||||
|
let close = <SID>HtmlIndentClose(a:lnum) + <SID>MakoIndentClose(a:lnum)
|
||||||
|
if a:style == match(getline(a:lnum), '^\s*</')
|
||||||
|
if a:style == match(getline(a:lnum), '^\s*</\('.g:html_indent_tags.'\|'.g:mako_indent_tags.'\)')
|
||||||
|
if 0 != open || 0 != close
|
||||||
|
return open - close
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
if '' != &syntax &&
|
||||||
|
\ synIDattr(synID(a:lnum, 1, 1), 'name') =~ '\(css\|java\).*' &&
|
||||||
|
\ synIDattr(synID(a:lnum, strlen(getline(a:lnum)) - 1, 1), 'name')
|
||||||
|
\ =~ '\(css\|java\).*'
|
||||||
|
if a:style == match(getline(a:lnum), '^\s*}')
|
||||||
|
return <SID>HtmlIndentOpenAlt(a:lnum) - <SID>HtmlIndentCloseAlt(a:lnum)
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
return 0
|
||||||
|
endfun
|
||||||
|
|
||||||
|
" vim: set ts=4 sw=4:
|
||||||
|
|
||||||
|
endif
|
||||||
@@ -121,7 +121,7 @@ function! GetNimIndent(lnum)
|
|||||||
endif
|
endif
|
||||||
|
|
||||||
if pline =~ '\(type\|import\|const\|var\)\s*$'
|
if pline =~ '\(type\|import\|const\|var\)\s*$'
|
||||||
\ || pline =~ '=\s*\(object\|enum\|tuple\|generic\)'
|
\ || pline =~ '=\s*\(object\|enum\|tuple\|concept\)'
|
||||||
return plindent + &sw
|
return plindent + &sw
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
|||||||
@@ -20,6 +20,11 @@ if !exists('g:ruby_indent_access_modifier_style')
|
|||||||
let g:ruby_indent_access_modifier_style = 'normal'
|
let g:ruby_indent_access_modifier_style = 'normal'
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
if !exists('g:ruby_indent_block_style')
|
||||||
|
" Possible values: "expression", "do"
|
||||||
|
let g:ruby_indent_block_style = 'expression'
|
||||||
|
endif
|
||||||
|
|
||||||
setlocal nosmartindent
|
setlocal nosmartindent
|
||||||
|
|
||||||
" Now, set up our indentation expression and keys that trigger it.
|
" Now, set up our indentation expression and keys that trigger it.
|
||||||
@@ -219,15 +224,15 @@ function s:GetMSL(lnum)
|
|||||||
elseif s:Match(lnum, s:non_bracket_continuation_regex) &&
|
elseif s:Match(lnum, s:non_bracket_continuation_regex) &&
|
||||||
\ (s:Match(msl, s:bracket_continuation_regex) || s:Match(msl, s:block_continuation_regex))
|
\ (s:Match(msl, s:bracket_continuation_regex) || s:Match(msl, s:block_continuation_regex))
|
||||||
" If the current line is a bracket continuation or a block-starter, but
|
" If the current line is a bracket continuation or a block-starter, but
|
||||||
" the previous is a non-bracket one, respect the previous' indentation,
|
" the previous is a non-bracket one, keep going to see if the previous
|
||||||
" and stop here.
|
" line is a part of another continuation.
|
||||||
"
|
"
|
||||||
" Example:
|
" Example:
|
||||||
" method_call one,
|
" method_call one,
|
||||||
" two {
|
" two {
|
||||||
" three
|
" three
|
||||||
"
|
"
|
||||||
return lnum
|
let msl = lnum
|
||||||
elseif s:Match(lnum, s:bracket_continuation_regex) &&
|
elseif s:Match(lnum, s:bracket_continuation_regex) &&
|
||||||
\ (s:Match(msl, s:bracket_continuation_regex) || s:Match(msl, s:block_continuation_regex))
|
\ (s:Match(msl, s:bracket_continuation_regex) || s:Match(msl, s:block_continuation_regex))
|
||||||
" If both lines are bracket continuations (the current may also be a
|
" If both lines are bracket continuations (the current may also be a
|
||||||
@@ -419,7 +424,9 @@ function GetRubyIndent(...)
|
|||||||
if searchpair(escape(bs[0], '\['), '', bs[1], 'bW', s:skip_expr) > 0
|
if searchpair(escape(bs[0], '\['), '', bs[1], 'bW', s:skip_expr) > 0
|
||||||
if line[col-1]==')' && col('.') != col('$') - 1
|
if line[col-1]==')' && col('.') != col('$') - 1
|
||||||
let ind = virtcol('.') - 1
|
let ind = virtcol('.') - 1
|
||||||
else
|
elseif g:ruby_indent_block_style == 'do'
|
||||||
|
let ind = indent(line('.'))
|
||||||
|
else " g:ruby_indent_block_style == 'expression'
|
||||||
let ind = indent(s:GetMSL(line('.')))
|
let ind = indent(s:GetMSL(line('.')))
|
||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
@@ -444,12 +451,15 @@ function GetRubyIndent(...)
|
|||||||
\ strpart(line, col('.') - 1, 2) !~ 'do'
|
\ strpart(line, col('.') - 1, 2) !~ 'do'
|
||||||
" assignment to case/begin/etc, on the same line, hanging indent
|
" assignment to case/begin/etc, on the same line, hanging indent
|
||||||
let ind = virtcol('.') - 1
|
let ind = virtcol('.') - 1
|
||||||
|
elseif g:ruby_indent_block_style == 'do'
|
||||||
|
" align to line of the "do", not to the MSL
|
||||||
|
let ind = indent(line('.'))
|
||||||
elseif getline(msl) =~ '=\s*\(#.*\)\=$'
|
elseif getline(msl) =~ '=\s*\(#.*\)\=$'
|
||||||
" in the case of assignment to the msl, align to the starting line,
|
" in the case of assignment to the MSL, align to the starting line,
|
||||||
" not to the msl
|
" not to the MSL
|
||||||
let ind = indent(line('.'))
|
let ind = indent(line('.'))
|
||||||
else
|
else
|
||||||
" align to the msl
|
" align to the MSL
|
||||||
let ind = indent(msl)
|
let ind = indent(msl)
|
||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
@@ -516,7 +526,10 @@ function GetRubyIndent(...)
|
|||||||
if s:Match(lnum, s:block_regex)
|
if s:Match(lnum, s:block_regex)
|
||||||
let msl = s:GetMSL(lnum)
|
let msl = s:GetMSL(lnum)
|
||||||
|
|
||||||
if getline(msl) =~ '=\s*\(#.*\)\=$'
|
if g:ruby_indent_block_style == 'do'
|
||||||
|
" don't align to the msl, align to the "do"
|
||||||
|
let ind = indent(lnum) + sw
|
||||||
|
elseif getline(msl) =~ '=\s*\(#.*\)\=$'
|
||||||
" in the case of assignment to the msl, align to the starting line,
|
" in the case of assignment to the msl, align to the starting line,
|
||||||
" not to the msl
|
" not to the msl
|
||||||
let ind = indent(lnum) + sw
|
let ind = indent(lnum) + sw
|
||||||
@@ -564,7 +577,7 @@ function GetRubyIndent(...)
|
|||||||
if s:Match(line('.'), s:ruby_indent_keywords)
|
if s:Match(line('.'), s:ruby_indent_keywords)
|
||||||
return indent('.') + sw
|
return indent('.') + sw
|
||||||
else
|
else
|
||||||
return indent('.')
|
return indent(s:GetMSL(line('.')))
|
||||||
endif
|
endif
|
||||||
else
|
else
|
||||||
call cursor(clnum, vcol)
|
call cursor(clnum, vcol)
|
||||||
|
|||||||
@@ -442,7 +442,7 @@ let &cpo = s:cpo_save
|
|||||||
unlet s:cpo_save
|
unlet s:cpo_save
|
||||||
|
|
||||||
function! Fixedgq(lnum, count)
|
function! Fixedgq(lnum, count)
|
||||||
let l:tw = &tw ? &tw : 80;
|
let l:tw = &tw ? &tw : 80
|
||||||
|
|
||||||
let l:count = a:count
|
let l:count = a:count
|
||||||
let l:first_char = indent(a:lnum) + 1
|
let l:first_char = indent(a:lnum) + 1
|
||||||
|
|||||||
@@ -42,7 +42,7 @@ syn region cryString start=+"+ skip=+\\\\\|\\"+ end=+"+ contains=crySpecial
|
|||||||
syn region cryString start=+``+ skip=+\\\\\|\\"+ end=+``+ contains=hsSpecialChar
|
syn region cryString start=+``+ skip=+\\\\\|\\"+ end=+``+ contains=hsSpecialChar
|
||||||
syn match cryCharacter "[^a-zA-Z0-9_']'\([^\\]\|\\[^']\+\|\\'\)'"lc=1 contains=crySpecialChar,crySpecialCharError
|
syn match cryCharacter "[^a-zA-Z0-9_']'\([^\\]\|\\[^']\+\|\\'\)'"lc=1 contains=crySpecialChar,crySpecialCharError
|
||||||
syn match cryCharacter "^'\([^\\]\|\\[^']\+\|\\'\)'" contains=crySpecialChar,crySpecialCharError
|
syn match cryCharacter "^'\([^\\]\|\\[^']\+\|\\'\)'" contains=crySpecialChar,crySpecialCharError
|
||||||
syn match cryNumber "\<[0-9]\+\>\|\<0[xX][0-9a-fA-F]\+\>\|\<0[oO][0-7]\+\>"
|
syn match cryNumber "\<[0-9]\+\>\|\<0[b][01]\+\>\|\<0[x][0-9a-fA-F]\+\>\|\<0[o][0-7]\+\>"
|
||||||
|
|
||||||
" Keyword definitions.
|
" Keyword definitions.
|
||||||
|
|
||||||
@@ -61,10 +61,12 @@ syn keyword cryPrimitive error parity lg2 pmod pdiv pmult format
|
|||||||
syn keyword cryPrimitive join split groupBy take drop min max negate reverse
|
syn keyword cryPrimitive join split groupBy take drop min max negate reverse
|
||||||
syn keyword cryPrimitive project tail width
|
syn keyword cryPrimitive project tail width
|
||||||
syn keyword cryPrimitive ASSERT
|
syn keyword cryPrimitive ASSERT
|
||||||
|
syn keyword cryPrimitive module import private
|
||||||
|
|
||||||
" Comments
|
" Comments
|
||||||
syn match cryLineComment "//.*"
|
syn keyword cryTodo contained TODO FIXME XXX
|
||||||
syn region cryBlockComment start="/\*" end="\*/" contains=cryBlockComment
|
syn match cryLineComment "//.*" contains=cryTodo
|
||||||
|
syn region cryBlockComment start="/\*" end="\*/" contains=cryBlockComment,cryTodo
|
||||||
|
|
||||||
if !exists("cry_minlines")
|
if !exists("cry_minlines")
|
||||||
let cry_minlines = 50
|
let cry_minlines = 50
|
||||||
@@ -103,6 +105,7 @@ if version >= 508 || !exists("did_cry_syntax_inits")
|
|||||||
hi link cryBoolean Boolean
|
hi link cryBoolean Boolean
|
||||||
hi link cryType Type
|
hi link cryType Type
|
||||||
hi link cryProp Keyword
|
hi link cryProp Keyword
|
||||||
|
hi link cryTodo Todo
|
||||||
|
|
||||||
delcommand HiLink
|
delcommand HiLink
|
||||||
endif
|
endif
|
||||||
|
|||||||
@@ -99,7 +99,11 @@ syntax match jsRegexpOr "\v\<@!\|" contained
|
|||||||
syntax match jsRegexpMod "\v\(@<=\?[:=!>]" contained
|
syntax match jsRegexpMod "\v\(@<=\?[:=!>]" contained
|
||||||
syntax cluster jsRegexpSpecial contains=jsSpecial,jsRegexpBoundary,jsRegexpBackRef,jsRegexpQuantifier,jsRegexpOr,jsRegexpMod
|
syntax cluster jsRegexpSpecial contains=jsSpecial,jsRegexpBoundary,jsRegexpBackRef,jsRegexpQuantifier,jsRegexpOr,jsRegexpMod
|
||||||
syntax region jsRegexpGroup start="\\\@<!(" skip="\\.\|\[\(\\.\|[^]]\)*\]" end="\\\@<!)" contained contains=jsRegexpCharClass,@jsRegexpSpecial keepend
|
syntax region jsRegexpGroup start="\\\@<!(" skip="\\.\|\[\(\\.\|[^]]\)*\]" end="\\\@<!)" contained contains=jsRegexpCharClass,@jsRegexpSpecial keepend
|
||||||
syntax region jsRegexpString start=+\%(\%(\%(return\|case\)\s\+\)\@50<=\|\%(\%([)\]"']\|\d\|\w\)\s*\)\@50<!\)/\(\*\|/\)\@!+ skip=+\\.\|\[\%(\\.\|[^]]\)*\]+ end=+/[gimy]\{,4}+ contains=jsRegexpCharClass,jsRegexpGroup,@jsRegexpSpecial,@htmlPreproc oneline keepend
|
if v:version > 703 || v:version == 603 && has("patch1088")
|
||||||
|
syntax region jsRegexpString start=+\%(\%(\%(return\|case\)\s\+\)\@50<=\|\%(\%([)\]"']\|\d\|\w\)\s*\)\@50<!\)/\(\*\|/\)\@!+ skip=+\\.\|\[\%(\\.\|[^]]\)*\]+ end=+/[gimy]\{,4}+ contains=jsRegexpCharClass,jsRegexpGroup,@jsRegexpSpecial,@htmlPreproc oneline keepend
|
||||||
|
else
|
||||||
|
syntax region jsRegexpString start=+\%(\%(\%(return\|case\)\s\+\)\@<=\|\%(\%([)\]"']\|\d\|\w\)\s*\)\@<!\)/\(\*\|/\)\@!+ skip=+\\.\|\[\%(\\.\|[^]]\)*\]+ end=+/[gimy]\{,4}+ contains=jsRegexpCharClass,jsRegexpGroup,@jsRegexpSpecial,@htmlPreproc oneline keepend
|
||||||
|
endif
|
||||||
syntax match jsNumber /\<-\=\d\+\(L\|[eE][+-]\=\d\+\)\=\>\|\<0[xX]\x\+\>/
|
syntax match jsNumber /\<-\=\d\+\(L\|[eE][+-]\=\d\+\)\=\>\|\<0[xX]\x\+\>/
|
||||||
syntax keyword jsNumber Infinity
|
syntax keyword jsNumber Infinity
|
||||||
syntax match jsFloat /\<-\=\%(\d\+\.\d\+\|\d\+\.\|\.\d\+\)\%([eE][+-]\=\d\+\)\=\>/
|
syntax match jsFloat /\<-\=\%(\d\+\.\d\+\|\d\+\.\|\.\d\+\)\%([eE][+-]\=\d\+\)\=\>/
|
||||||
@@ -187,9 +191,9 @@ syntax cluster jsExpression contains=jsComment,jsLineComment,jsBlockComment,jsTa
|
|||||||
syntax cluster jsAll contains=@jsExpression,jsLabel,jsConditional,jsRepeat,jsReturn,jsStatement,jsTernaryIf,jsException
|
syntax cluster jsAll contains=@jsExpression,jsLabel,jsConditional,jsRepeat,jsReturn,jsStatement,jsTernaryIf,jsException
|
||||||
syntax region jsBracket matchgroup=jsBrackets start="\[" end="\]" contains=@jsAll,jsParensErrB,jsParensErrC,jsBracket,jsParen,jsBlock,@htmlPreproc fold
|
syntax region jsBracket matchgroup=jsBrackets start="\[" end="\]" contains=@jsAll,jsParensErrB,jsParensErrC,jsBracket,jsParen,jsBlock,@htmlPreproc fold
|
||||||
syntax region jsParen matchgroup=jsParens start="(" end=")" contains=@jsAll,jsOf,jsParensErrA,jsParensErrC,jsParen,jsBracket,jsBlock,@htmlPreproc fold extend
|
syntax region jsParen matchgroup=jsParens start="(" end=")" contains=@jsAll,jsOf,jsParensErrA,jsParensErrC,jsParen,jsBracket,jsBlock,@htmlPreproc fold extend
|
||||||
syntax region jsClassBlock matchgroup=jsClassBraces start="{" end="}" contains=jsFuncName,jsClassMethodDefinitions,jsOperator,jsArrowFunction,jsArrowFuncArgs,jsComment,jsBlockComment,jsLineComment contained fold
|
syntax region jsClassBlock matchgroup=jsClassBraces start="{" end="}" contains=jsFuncName,jsClassMethodDefinitions,jsOperator,jsArrowFunction,jsArrowFuncArgs,jsComment,jsBlockComment,jsLineComment,jsGenerator contained fold
|
||||||
syntax region jsFuncBlock matchgroup=jsFuncBraces start="{" end="}" contains=@jsAll,jsParensErrA,jsParensErrB,jsParen,jsBracket,jsBlock,@htmlPreproc,jsClassDefinition fold extend
|
syntax region jsFuncBlock matchgroup=jsFuncBraces start="{" end="}" contains=@jsAll,jsParensErrA,jsParensErrB,jsParen,jsBracket,jsBlock,@htmlPreproc,jsClassDefinition fold extend
|
||||||
syntax region jsBlock matchgroup=jsBraces start="{" end="}" contains=@jsAll,jsParensErrA,jsParensErrB,jsParen,jsBracket,jsBlock,jsObjectKey,@htmlPreproc,jsClassDefinition fold extend
|
syntax region jsBlock matchgroup=jsBraces start="{" end="}" contains=@jsAll,jsParensErrA,jsParensErrB,jsParen,jsBracket,jsBlock,jsObjectKey,@htmlPreproc,jsClassDefinition extend
|
||||||
syntax region jsTernaryIf matchgroup=jsTernaryIfOperator start=+?+ end=+:+ contains=@jsExpression,jsTernaryIf
|
syntax region jsTernaryIf matchgroup=jsTernaryIfOperator start=+?+ end=+:+ contains=@jsExpression,jsTernaryIf
|
||||||
|
|
||||||
"" catch errors caused by wrong parenthesis
|
"" catch errors caused by wrong parenthesis
|
||||||
@@ -202,8 +206,11 @@ syntax match jsFuncArgDestructuring contained /\({\|}\|=\|:\|\[\|\]\)/ extend
|
|||||||
exe 'syntax match jsFunction /\<function\>/ nextgroup=jsGenerator,jsFuncName,jsFuncArgs skipwhite '.(exists('g:javascript_conceal_function') ? 'conceal cchar='.g:javascript_conceal_function : '')
|
exe 'syntax match jsFunction /\<function\>/ nextgroup=jsGenerator,jsFuncName,jsFuncArgs skipwhite '.(exists('g:javascript_conceal_function') ? 'conceal cchar='.g:javascript_conceal_function : '')
|
||||||
exe 'syntax match jsArrowFunction /=>/ skipwhite nextgroup=jsFuncBlock contains=jsFuncBraces '.(exists('g:javascript_conceal_arrow_function') ? 'conceal cchar='.g:javascript_conceal_arrow_function : '')
|
exe 'syntax match jsArrowFunction /=>/ skipwhite nextgroup=jsFuncBlock contains=jsFuncBraces '.(exists('g:javascript_conceal_arrow_function') ? 'conceal cchar='.g:javascript_conceal_arrow_function : '')
|
||||||
|
|
||||||
syntax match jsGenerator contained '\*' nextgroup=jsFuncName,jsFuncArgs skipwhite
|
syntax match jsGenerator contained /\*/ nextgroup=jsFuncName,jsFuncArgs skipwhite skipempty
|
||||||
syntax match jsFuncName contained /\<[a-zA-Z_$][0-9a-zA-Z_$]*/ nextgroup=jsFuncArgs skipwhite
|
syntax match jsFuncName contained /\<[a-zA-Z_$][0-9a-zA-Z_$]*/ nextgroup=jsFuncArgs skipwhite skipempty
|
||||||
|
" These versions of jsFuncName is for use in object declarations with no key
|
||||||
|
" syntax match jsFuncName contained /\%(^[\r\n\t ]*\)\@<=[*\r\n\t ]*[a-zA-Z_$][0-9a-zA-Z_$]*[\r\n\t ]*(\@=/ nextgroup=jsFuncArgs skipwhite skipempty containedin=jsBlock contains=jsGenerator
|
||||||
|
" syntax match jsFuncName contained /\%(,[\r\n\t ]*\)\@<=[*\r\n\t ]*[a-zA-Z_$][0-9a-zA-Z_$]*[\r\n\t ]*(\@=/ nextgroup=jsFuncArgs skipwhite skipempty containedin=jsBlock contains=jsGenerator
|
||||||
syntax region jsFuncArgs contained matchgroup=jsFuncParens start='(' end=')' contains=jsFuncArgCommas,jsFuncArgRest,jsComment,jsLineComment,jsStringS,jsStringD,jsNumber,jsFuncArgDestructuring,jsArrowFunction,jsParen,jsArrowFuncArgs nextgroup=jsFuncBlock keepend skipwhite skipempty
|
syntax region jsFuncArgs contained matchgroup=jsFuncParens start='(' end=')' contains=jsFuncArgCommas,jsFuncArgRest,jsComment,jsLineComment,jsStringS,jsStringD,jsNumber,jsFuncArgDestructuring,jsArrowFunction,jsParen,jsArrowFuncArgs nextgroup=jsFuncBlock keepend skipwhite skipempty
|
||||||
syntax match jsFuncArgCommas contained ','
|
syntax match jsFuncArgCommas contained ','
|
||||||
syntax match jsFuncArgRest contained /\%(\.\.\.[a-zA-Z_$][0-9a-zA-Z_$]*\))/ contains=jsFuncArgRestDots
|
syntax match jsFuncArgRest contained /\%(\.\.\.[a-zA-Z_$][0-9a-zA-Z_$]*\))/ contains=jsFuncArgRestDots
|
||||||
@@ -217,7 +224,7 @@ syntax match jsArrowFuncArgs /([^()]*)\s*\(=>\)\@=/ skipempty skipwhite conta
|
|||||||
syntax keyword jsClassKeywords extends class contained
|
syntax keyword jsClassKeywords extends class contained
|
||||||
syntax match jsClassNoise /\./ contained
|
syntax match jsClassNoise /\./ contained
|
||||||
syntax keyword jsClassMethodDefinitions get set static contained nextgroup=jsFuncName skipwhite skipempty
|
syntax keyword jsClassMethodDefinitions get set static contained nextgroup=jsFuncName skipwhite skipempty
|
||||||
syntax match jsClassDefinition /class [a-zA-Z_$][0-9a-zA-Z_$ \n.]*/ contains=jsClassKeywords,jsClassNoise nextgroup=jsClassBlock skipwhite skipempty
|
syntax match jsClassDefinition /\<class\>\%( [a-zA-Z_$][0-9a-zA-Z_$ \n.]*\)*/ contains=jsClassKeywords,jsClassNoise nextgroup=jsClassBlock skipwhite skipempty
|
||||||
|
|
||||||
" Define the default highlighting.
|
" Define the default highlighting.
|
||||||
" For version 5.7 and earlier: only when not done already
|
" For version 5.7 and earlier: only when not done already
|
||||||
|
|||||||
96
syntax/mako.vim
Normal file
96
syntax/mako.vim
Normal file
@@ -0,0 +1,96 @@
|
|||||||
|
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'mako') == -1
|
||||||
|
|
||||||
|
" Vim syntax file
|
||||||
|
" Language: Mako
|
||||||
|
" Maintainer: Armin Ronacher <armin.ronacher@active-4.com>
|
||||||
|
" URL: http://lucumr.pocoo.org/
|
||||||
|
" Last Change: 2013-05-01
|
||||||
|
" Version: 0.6.1+
|
||||||
|
"
|
||||||
|
" Thanks to Brine Rue <brian@lolapps.com> who noticed a bug in the
|
||||||
|
" delimiter handling.
|
||||||
|
"
|
||||||
|
" Known Limitations
|
||||||
|
" the <%text> block does not have correct attributes
|
||||||
|
|
||||||
|
" 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")
|
||||||
|
finish
|
||||||
|
endif
|
||||||
|
|
||||||
|
if !exists("main_syntax")
|
||||||
|
let main_syntax = "html"
|
||||||
|
endif
|
||||||
|
|
||||||
|
"Source the html syntax file
|
||||||
|
ru! syntax/html.vim
|
||||||
|
unlet b:current_syntax
|
||||||
|
|
||||||
|
" tell html.vim what syntax groups should take precedence (see :help html.vim)
|
||||||
|
syn cluster htmlPreproc add=makoLine,makoVariable,makoTag,makoDocComment,makoDefEnd,makoText,makoDelim,makoEnd,makoComment,makoEscape
|
||||||
|
|
||||||
|
"Put the python syntax file in @pythonTop
|
||||||
|
syn include @pythonTop syntax/python.vim
|
||||||
|
|
||||||
|
" End keywords
|
||||||
|
syn keyword makoEnd contained endfor endwhile endif endtry enddef
|
||||||
|
|
||||||
|
" Block rules
|
||||||
|
syn region makoLine matchgroup=makoDelim start=#^\s*%# end=#$# keepend contains=@pythonTop,makoEnd
|
||||||
|
syn region makoBlock matchgroup=makoDelim start=#<%!\?# end=#%># keepend contains=@pythonTop,makoEnd
|
||||||
|
|
||||||
|
" Variables
|
||||||
|
syn region makoNested start="{" end="}" transparent display contained contains=makoNested,@pythonTop
|
||||||
|
syn region makoVariable matchgroup=makoDelim start=#\${# end=#}# contains=makoNested,@pythonTop
|
||||||
|
|
||||||
|
" Comments
|
||||||
|
syn region makoComment start="^\s*##" end="$"
|
||||||
|
syn region makoDocComment matchgroup=makoDelim start="<%doc>" end="</%doc>" keepend
|
||||||
|
|
||||||
|
" Literal Blocks
|
||||||
|
syn region makoText matchgroup=makoDelim start="<%text[^>]*>" end="</%text>"
|
||||||
|
|
||||||
|
" Attribute Sublexing
|
||||||
|
syn match makoAttributeKey containedin=makoTag contained "[a-zA-Z_][a-zA-Z0-9_]*="
|
||||||
|
syn region makoAttributeValue containedin=makoTag contained start=/"/ skip=/\\"/ end=/"/
|
||||||
|
syn region makoAttributeValue containedin=MakoTag contained start=/'/ skip=/\\'/ end=/'/
|
||||||
|
|
||||||
|
" Tags
|
||||||
|
syn region makoTag matchgroup=makoDelim start="<%\(def\|call\|page\|include\|namespace\|inherit\|block\|[a-zA-Z_][a-zA-Z0-9_]*:[a-zA-Z_][a-zA-Z0-9_]*\)\>" end="/\?>"
|
||||||
|
syn match makoDelim "</%\(def\|call\|namespace\|block\|[a-zA-Z_][a-zA-Z0-9_]*:[a-zA-Z_][a-zA-Z0-9_]*\)>"
|
||||||
|
|
||||||
|
syn region makoJavaScript matchgroup=makoDelim start=+<%block .*js.*>+ keepend end=+</%block>+ contains=@htmlJavaScript,htmlCssStyleComment,htmlScriptTag,@htmlPreproc,makoLine,makoBlock,makoVariable
|
||||||
|
syn region makoCssStyle matchgroup=makoDelim start=+<%block .*css.*>+ keepend end=+</%block>+ contains=@htmlCss,htmlTag,htmlEndTag,htmlCssStyleComment,@htmlPreproc,makoLine,makoBlock,makoVariable
|
||||||
|
|
||||||
|
" Newline Escapes
|
||||||
|
syn match makoEscape /\\$/
|
||||||
|
|
||||||
|
" Default highlighting links
|
||||||
|
if version >= 508 || !exists("did_mako_syn_inits")
|
||||||
|
if version < 508
|
||||||
|
let did_mako_syn_inits = 1
|
||||||
|
com -nargs=+ HiLink hi link <args>
|
||||||
|
else
|
||||||
|
com -nargs=+ HiLink hi def link <args>
|
||||||
|
endif
|
||||||
|
|
||||||
|
HiLink makoDocComment makoComment
|
||||||
|
HiLink makoDefEnd makoDelim
|
||||||
|
|
||||||
|
HiLink makoAttributeKey Type
|
||||||
|
HiLink makoAttributeValue String
|
||||||
|
HiLink makoText Normal
|
||||||
|
HiLink makoDelim Preproc
|
||||||
|
HiLink makoEnd Keyword
|
||||||
|
HiLink makoComment Comment
|
||||||
|
HiLink makoEscape Special
|
||||||
|
|
||||||
|
delc HiLink
|
||||||
|
endif
|
||||||
|
|
||||||
|
let b:current_syntax = "html"
|
||||||
|
|
||||||
|
endif
|
||||||
@@ -83,7 +83,10 @@ syn region markdownLink matchgroup=markdownLinkDelimiter start="(" end=")" conta
|
|||||||
syn region markdownId matchgroup=markdownIdDelimiter start="\[" end="\]" keepend contained
|
syn region markdownId matchgroup=markdownIdDelimiter start="\[" end="\]" keepend contained
|
||||||
syn region markdownAutomaticLink matchgroup=markdownUrlDelimiter start="<\%(\w\+:\|[[:alnum:]_+-]\+@\)\@=" end=">" keepend oneline
|
syn region markdownAutomaticLink matchgroup=markdownUrlDelimiter start="<\%(\w\+:\|[[:alnum:]_+-]\+@\)\@=" end=">" keepend oneline
|
||||||
|
|
||||||
let s:concealends = has('conceal') ? ' concealends' : ''
|
let s:concealends = ''
|
||||||
|
if has('conceal') && get(g:, 'markdown_syntax_conceal', 1) == 1
|
||||||
|
let s:concealends = ' concealends'
|
||||||
|
endif
|
||||||
exe 'syn region markdownItalic matchgroup=markdownItalicDelimiter start="\S\@<=\*\|\*\S\@=" end="\S\@<=\*\|\*\S\@=" keepend contains=markdownLineStart' . s:concealends
|
exe 'syn region markdownItalic matchgroup=markdownItalicDelimiter start="\S\@<=\*\|\*\S\@=" end="\S\@<=\*\|\*\S\@=" keepend contains=markdownLineStart' . s:concealends
|
||||||
exe 'syn region markdownItalic matchgroup=markdownItalicDelimiter start="\S\@<=_\|_\S\@=" end="\S\@<=_\|_\S\@=" keepend contains=markdownLineStart' . s:concealends
|
exe 'syn region markdownItalic matchgroup=markdownItalicDelimiter start="\S\@<=_\|_\S\@=" end="\S\@<=_\|_\S\@=" keepend contains=markdownLineStart' . s:concealends
|
||||||
exe 'syn region markdownBold matchgroup=markdownBoldDelimiter start="\S\@<=\*\*\|\*\*\S\@=" end="\S\@<=\*\*\|\*\*\S\@=" keepend contains=markdownLineStart,markdownItalic' . s:concealends
|
exe 'syn region markdownBold matchgroup=markdownBoldDelimiter start="\S\@<=\*\*\|\*\*\S\@=" end="\S\@<=\*\*\|\*\*\S\@=" keepend contains=markdownLineStart,markdownItalic' . s:concealends
|
||||||
|
|||||||
141
syntax/nginx.vim
141
syntax/nginx.vim
@@ -12,28 +12,32 @@ setlocal iskeyword+=/
|
|||||||
setlocal iskeyword+=:
|
setlocal iskeyword+=:
|
||||||
|
|
||||||
syn match ngxVariable '\$\(\w\+\|{\w\+}\)'
|
syn match ngxVariable '\$\(\w\+\|{\w\+}\)'
|
||||||
syn match ngxVariableBlock '\$\(\w\+\|{\w\+}\)' contained
|
|
||||||
syn match ngxVariableString '\$\(\w\+\|{\w\+}\)' contained
|
syn match ngxVariableString '\$\(\w\+\|{\w\+}\)' contained
|
||||||
syn region ngxBlock start=+^+ end=+{+ skip=+\${+ contains=ngxComment,ngxDirectiveBlock,ngxVariableBlock,ngxString oneline
|
|
||||||
syn region ngxString start=+\z(["']\)+ end=+\z1+ skip=+\\\\\|\\\z1+ contains=ngxVariableString
|
|
||||||
syn match ngxComment ' *#.*$'
|
syn match ngxComment ' *#.*$'
|
||||||
|
syn match ngxRewriteURI /\S\+/ contained contains=ngxVariableString nextgroup=ngxURI skipwhite
|
||||||
|
syn match ngxURI /\S\+/ contained contains=ngxVariableString skipwhite
|
||||||
|
syn match ngxLocationPath /[^ {]\+/ contained
|
||||||
|
syn region ngxString start=+\z(["']\)+ end=+\z1+ skip=+\\\\\|\\\z1+ contains=ngxVariableString
|
||||||
|
|
||||||
syn keyword ngxBoolean on
|
syn keyword ngxBoolean on
|
||||||
syn keyword ngxBoolean off
|
syn keyword ngxBoolean off
|
||||||
|
|
||||||
syn keyword ngxDirectiveBlock http contained
|
|
||||||
syn keyword ngxDirectiveBlock mail contained
|
syn keyword ngxDirectiveBlock http
|
||||||
syn keyword ngxDirectiveBlock events contained
|
syn keyword ngxDirectiveBlock mail
|
||||||
syn keyword ngxDirectiveBlock server contained
|
syn keyword ngxDirectiveBlock events
|
||||||
syn keyword ngxDirectiveBlock types contained
|
syn keyword ngxDirectiveBlock server
|
||||||
syn keyword ngxDirectiveBlock location contained
|
syn keyword ngxDirectiveBlock types
|
||||||
syn keyword ngxDirectiveBlock upstream contained
|
syn match ngxLocationOperator /\(=\|\~\*\|\^\~\|\~\)/ contained nextgroup=ngxLocationPath,ngxString skipwhite
|
||||||
syn keyword ngxDirectiveBlock charset_map contained
|
syn match ngxLocationNamedLoc /@\w\+/
|
||||||
syn keyword ngxDirectiveBlock limit_except contained
|
syn keyword ngxDirectiveBlock location nextgroup=ngxLocationNamedLoc,ngxLocationOperator,ngxLocationPath,ngxString skipwhite
|
||||||
syn keyword ngxDirectiveBlock if contained
|
syn keyword ngxDirectiveBlock upstream
|
||||||
syn keyword ngxDirectiveBlock geo contained
|
syn keyword ngxDirectiveBlock charset_map
|
||||||
syn keyword ngxDirectiveBlock map contained
|
syn keyword ngxDirectiveBlock limit_except
|
||||||
syn keyword ngxDirectiveBlock split_clients contained
|
syn keyword ngxDirectiveBlock if
|
||||||
|
syn keyword ngxDirectiveBlock geo
|
||||||
|
syn keyword ngxDirectiveBlock map
|
||||||
|
syn keyword ngxDirectiveBlock split_clients
|
||||||
|
|
||||||
syn keyword ngxDirectiveImportant include
|
syn keyword ngxDirectiveImportant include
|
||||||
syn keyword ngxDirectiveImportant root
|
syn keyword ngxDirectiveImportant root
|
||||||
@@ -50,16 +54,17 @@ syn keyword ngxDirectiveImportant try_files
|
|||||||
|
|
||||||
syn keyword ngxDirectiveControl break
|
syn keyword ngxDirectiveControl break
|
||||||
syn keyword ngxDirectiveControl return
|
syn keyword ngxDirectiveControl return
|
||||||
syn keyword ngxDirectiveControl rewrite
|
syn keyword ngxDirectiveControl rewrite nextgroup=ngxRewriteURI skipwhite
|
||||||
syn keyword ngxDirectiveControl set
|
syn keyword ngxDirectiveControl set
|
||||||
|
|
||||||
|
syn keyword ngxRewriteFlag last break redirect permanent
|
||||||
|
|
||||||
syn keyword ngxDirectiveError error_page
|
syn keyword ngxDirectiveError error_page
|
||||||
syn keyword ngxDirectiveError post_action
|
syn keyword ngxDirectiveError post_action
|
||||||
|
|
||||||
syn keyword ngxDirectiveDeprecated connections
|
syn keyword ngxDirectiveDeprecated connections
|
||||||
syn keyword ngxDirectiveDeprecated imap
|
syn keyword ngxDirectiveDeprecated imap
|
||||||
syn keyword ngxDirectiveDeprecated limit_zone
|
syn keyword ngxDirectiveDeprecated limit_zone
|
||||||
syn keyword ngxDirectiveDeprecated mysql_test
|
|
||||||
syn keyword ngxDirectiveDeprecated open_file_cache_retest
|
syn keyword ngxDirectiveDeprecated open_file_cache_retest
|
||||||
syn keyword ngxDirectiveDeprecated optimize_server_names
|
syn keyword ngxDirectiveDeprecated optimize_server_names
|
||||||
syn keyword ngxDirectiveDeprecated satisfy_any
|
syn keyword ngxDirectiveDeprecated satisfy_any
|
||||||
@@ -131,10 +136,12 @@ syn keyword ngxDirective fastcgi_cache
|
|||||||
syn keyword ngxDirective fastcgi_cache_bypass
|
syn keyword ngxDirective fastcgi_cache_bypass
|
||||||
syn keyword ngxDirective fastcgi_cache_key
|
syn keyword ngxDirective fastcgi_cache_key
|
||||||
syn keyword ngxDirective fastcgi_cache_lock
|
syn keyword ngxDirective fastcgi_cache_lock
|
||||||
|
syn keyword ngxDirective fastcgi_cache_lock_age
|
||||||
syn keyword ngxDirective fastcgi_cache_lock_timeout
|
syn keyword ngxDirective fastcgi_cache_lock_timeout
|
||||||
syn keyword ngxDirective fastcgi_cache_methods
|
syn keyword ngxDirective fastcgi_cache_methods
|
||||||
syn keyword ngxDirective fastcgi_cache_min_uses
|
syn keyword ngxDirective fastcgi_cache_min_uses
|
||||||
syn keyword ngxDirective fastcgi_cache_path
|
syn keyword ngxDirective fastcgi_cache_path
|
||||||
|
syn keyword ngxDirective fastcgi_cache_purge
|
||||||
syn keyword ngxDirective fastcgi_cache_revalidate
|
syn keyword ngxDirective fastcgi_cache_revalidate
|
||||||
syn keyword ngxDirective fastcgi_cache_use_stale
|
syn keyword ngxDirective fastcgi_cache_use_stale
|
||||||
syn keyword ngxDirective fastcgi_cache_valid
|
syn keyword ngxDirective fastcgi_cache_valid
|
||||||
@@ -147,6 +154,7 @@ syn keyword ngxDirective fastcgi_ignore_headers
|
|||||||
syn keyword ngxDirective fastcgi_index
|
syn keyword ngxDirective fastcgi_index
|
||||||
syn keyword ngxDirective fastcgi_intercept_errors
|
syn keyword ngxDirective fastcgi_intercept_errors
|
||||||
syn keyword ngxDirective fastcgi_keep_conn
|
syn keyword ngxDirective fastcgi_keep_conn
|
||||||
|
syn keyword ngxDirective fastcgi_limit_rate
|
||||||
syn keyword ngxDirective fastcgi_max_temp_file_size
|
syn keyword ngxDirective fastcgi_max_temp_file_size
|
||||||
syn keyword ngxDirective fastcgi_next_upstream
|
syn keyword ngxDirective fastcgi_next_upstream
|
||||||
syn keyword ngxDirective fastcgi_next_upstream_timeout
|
syn keyword ngxDirective fastcgi_next_upstream_timeout
|
||||||
@@ -157,6 +165,7 @@ syn keyword ngxDirective fastcgi_pass_header
|
|||||||
syn keyword ngxDirective fastcgi_pass_request_body
|
syn keyword ngxDirective fastcgi_pass_request_body
|
||||||
syn keyword ngxDirective fastcgi_pass_request_headers
|
syn keyword ngxDirective fastcgi_pass_request_headers
|
||||||
syn keyword ngxDirective fastcgi_read_timeout
|
syn keyword ngxDirective fastcgi_read_timeout
|
||||||
|
syn keyword ngxDirective fastcgi_request_buffering
|
||||||
syn keyword ngxDirective fastcgi_send_lowat
|
syn keyword ngxDirective fastcgi_send_lowat
|
||||||
syn keyword ngxDirective fastcgi_send_timeout
|
syn keyword ngxDirective fastcgi_send_timeout
|
||||||
syn keyword ngxDirective fastcgi_split_path_info
|
syn keyword ngxDirective fastcgi_split_path_info
|
||||||
@@ -187,6 +196,7 @@ syn keyword ngxDirective gzip_types
|
|||||||
syn keyword ngxDirective gzip_vary
|
syn keyword ngxDirective gzip_vary
|
||||||
syn keyword ngxDirective gzip_window
|
syn keyword ngxDirective gzip_window
|
||||||
syn keyword ngxDirective hash
|
syn keyword ngxDirective hash
|
||||||
|
syn keyword ngxDirective http2 " Not a real directive
|
||||||
syn keyword ngxDirective if_modified_since
|
syn keyword ngxDirective if_modified_since
|
||||||
syn keyword ngxDirective ignore_invalid_headers
|
syn keyword ngxDirective ignore_invalid_headers
|
||||||
syn keyword ngxDirective image_filter
|
syn keyword ngxDirective image_filter
|
||||||
@@ -201,6 +211,8 @@ syn keyword ngxDirective imap_client_buffer
|
|||||||
syn keyword ngxDirective index
|
syn keyword ngxDirective index
|
||||||
syn keyword ngxDirective iocp_threads
|
syn keyword ngxDirective iocp_threads
|
||||||
syn keyword ngxDirective ip_hash
|
syn keyword ngxDirective ip_hash
|
||||||
|
syn keyword ngxDirective js_run
|
||||||
|
syn keyword ngxDirective js_set
|
||||||
syn keyword ngxDirective keepalive
|
syn keyword ngxDirective keepalive
|
||||||
syn keyword ngxDirective keepalive_disable
|
syn keyword ngxDirective keepalive_disable
|
||||||
syn keyword ngxDirective keepalive_requests
|
syn keyword ngxDirective keepalive_requests
|
||||||
@@ -246,9 +258,12 @@ syn keyword ngxDirective modern_browser_value
|
|||||||
syn keyword ngxDirective mp4
|
syn keyword ngxDirective mp4
|
||||||
syn keyword ngxDirective mp4_buffer_size
|
syn keyword ngxDirective mp4_buffer_size
|
||||||
syn keyword ngxDirective mp4_max_buffer_size
|
syn keyword ngxDirective mp4_max_buffer_size
|
||||||
|
syn keyword ngxDirective mp4_limit_rate
|
||||||
|
syn keyword ngxDirective mp4_limit_rate_after
|
||||||
syn keyword ngxDirective msie_padding
|
syn keyword ngxDirective msie_padding
|
||||||
syn keyword ngxDirective msie_refresh
|
syn keyword ngxDirective msie_refresh
|
||||||
syn keyword ngxDirective multi_accept
|
syn keyword ngxDirective multi_accept
|
||||||
|
syn keyword ngxDirective mysql_test
|
||||||
syn keyword ngxDirective open_file_cache
|
syn keyword ngxDirective open_file_cache
|
||||||
syn keyword ngxDirective open_file_cache_errors
|
syn keyword ngxDirective open_file_cache_errors
|
||||||
syn keyword ngxDirective open_file_cache_events
|
syn keyword ngxDirective open_file_cache_events
|
||||||
@@ -269,7 +284,8 @@ syn keyword ngxDirective port_in_redirect
|
|||||||
syn keyword ngxDirective post_acceptex
|
syn keyword ngxDirective post_acceptex
|
||||||
syn keyword ngxDirective postpone_gzipping
|
syn keyword ngxDirective postpone_gzipping
|
||||||
syn keyword ngxDirective postpone_output
|
syn keyword ngxDirective postpone_output
|
||||||
syn keyword ngxDirective protocol
|
syn keyword ngxDirective protocol nextgroup=ngxMailProtocol skipwhite
|
||||||
|
syn keyword ngxMailProtocol imap pop3 smtp
|
||||||
syn keyword ngxDirective proxy
|
syn keyword ngxDirective proxy
|
||||||
syn keyword ngxDirective proxy_bind
|
syn keyword ngxDirective proxy_bind
|
||||||
syn keyword ngxDirective proxy_buffer
|
syn keyword ngxDirective proxy_buffer
|
||||||
@@ -473,6 +489,7 @@ syn keyword ngxDirective uwsgi_cache
|
|||||||
syn keyword ngxDirective uwsgi_cache_bypass
|
syn keyword ngxDirective uwsgi_cache_bypass
|
||||||
syn keyword ngxDirective uwsgi_cache_key
|
syn keyword ngxDirective uwsgi_cache_key
|
||||||
syn keyword ngxDirective uwsgi_cache_lock
|
syn keyword ngxDirective uwsgi_cache_lock
|
||||||
|
syn keyword ngxDirective uwsgi_cache_lock_age
|
||||||
syn keyword ngxDirective uwsgi_cache_lock_timeout
|
syn keyword ngxDirective uwsgi_cache_lock_timeout
|
||||||
syn keyword ngxDirective uwsgi_cache_methods
|
syn keyword ngxDirective uwsgi_cache_methods
|
||||||
syn keyword ngxDirective uwsgi_cache_min_uses
|
syn keyword ngxDirective uwsgi_cache_min_uses
|
||||||
@@ -494,14 +511,19 @@ syn keyword ngxDirective uwsgi_next_upstream_timeout
|
|||||||
syn keyword ngxDirective uwsgi_next_upstream_tries
|
syn keyword ngxDirective uwsgi_next_upstream_tries
|
||||||
syn keyword ngxDirective uwsgi_no_cache
|
syn keyword ngxDirective uwsgi_no_cache
|
||||||
syn keyword ngxDirective uwsgi_param
|
syn keyword ngxDirective uwsgi_param
|
||||||
|
syn keyword ngxDirective uwsgi_pass
|
||||||
syn keyword ngxDirective uwsgi_pass_header
|
syn keyword ngxDirective uwsgi_pass_header
|
||||||
syn keyword ngxDirective uwsgi_pass_request_body
|
syn keyword ngxDirective uwsgi_pass_request_body
|
||||||
syn keyword ngxDirective uwsgi_pass_request_headers
|
syn keyword ngxDirective uwsgi_pass_request_headers
|
||||||
syn keyword ngxDirective uwsgi_read_timeout
|
syn keyword ngxDirective uwsgi_read_timeout
|
||||||
|
syn keyword ngxDirective uwsgi_request_buffering
|
||||||
syn keyword ngxDirective uwsgi_send_timeout
|
syn keyword ngxDirective uwsgi_send_timeout
|
||||||
|
syn keyword ngxDirective uwsgi_ssl_certificate
|
||||||
|
syn keyword ngxDirective uwsgi_ssl_certificate_key
|
||||||
syn keyword ngxDirective uwsgi_ssl_ciphers
|
syn keyword ngxDirective uwsgi_ssl_ciphers
|
||||||
syn keyword ngxDirective uwsgi_ssl_crl
|
syn keyword ngxDirective uwsgi_ssl_crl
|
||||||
syn keyword ngxDirective uwsgi_ssl_name
|
syn keyword ngxDirective uwsgi_ssl_name
|
||||||
|
syn keyword ngxDirective uwsgi_ssl_password_file
|
||||||
syn keyword ngxDirective uwsgi_ssl_protocols
|
syn keyword ngxDirective uwsgi_ssl_protocols
|
||||||
syn keyword ngxDirective uwsgi_ssl_server_name
|
syn keyword ngxDirective uwsgi_ssl_server_name
|
||||||
syn keyword ngxDirective uwsgi_ssl_session_reuse
|
syn keyword ngxDirective uwsgi_ssl_session_reuse
|
||||||
@@ -553,6 +575,16 @@ syn keyword ngxDirectiveThirdParty accesskey_signature
|
|||||||
syn keyword ngxDirectiveThirdParty auth_pam
|
syn keyword ngxDirectiveThirdParty auth_pam
|
||||||
syn keyword ngxDirectiveThirdParty auth_pam_service_name
|
syn keyword ngxDirectiveThirdParty auth_pam_service_name
|
||||||
|
|
||||||
|
" Brotli Module <https://github.com/google/ngx_brotli>
|
||||||
|
" Nginx module for Brotli compression
|
||||||
|
syn keyword ngxDirectiveThirdParty brotli_static
|
||||||
|
syn keyword ngxDirectiveThirdParty brotli
|
||||||
|
syn keyword ngxDirectiveThirdParty brotli_types
|
||||||
|
syn keyword ngxDirectiveThirdParty brotli_buffers
|
||||||
|
syn keyword ngxDirectiveThirdParty brotli_comp_level
|
||||||
|
syn keyword ngxDirectiveThirdParty brotli_window
|
||||||
|
syn keyword ngxDirectiveThirdParty brotli_min_length
|
||||||
|
|
||||||
" Cache Purge Module <http://labs.frickle.com/nginx_ngx_cache_purge/>
|
" Cache Purge Module <http://labs.frickle.com/nginx_ngx_cache_purge/>
|
||||||
" Module adding ability to purge content from FastCGI and proxy caches.
|
" Module adding ability to purge content from FastCGI and proxy caches.
|
||||||
syn keyword ngxDirectiveThirdParty fastcgi_cache_purge
|
syn keyword ngxDirectiveThirdParty fastcgi_cache_purge
|
||||||
@@ -606,7 +638,7 @@ syn keyword ngxDirectiveThirdParty echo_subrequest
|
|||||||
syn keyword ngxDirectiveThirdParty echo_subrequest_async
|
syn keyword ngxDirectiveThirdParty echo_subrequest_async
|
||||||
|
|
||||||
" Events Module <http://docs.dutov.org/nginx_modules_events_en.html>
|
" Events Module <http://docs.dutov.org/nginx_modules_events_en.html>
|
||||||
" Provides options for start/stop events.
|
" Privides options for start/stop events.
|
||||||
syn keyword ngxDirectiveThirdParty on_start
|
syn keyword ngxDirectiveThirdParty on_start
|
||||||
syn keyword ngxDirectiveThirdParty on_stop
|
syn keyword ngxDirectiveThirdParty on_stop
|
||||||
|
|
||||||
@@ -671,6 +703,70 @@ syn keyword ngxDirectiveThirdParty js_utf8
|
|||||||
syn keyword ngxDirectiveThirdParty log_request_speed_filter
|
syn keyword ngxDirectiveThirdParty log_request_speed_filter
|
||||||
syn keyword ngxDirectiveThirdParty log_request_speed_filter_timeout
|
syn keyword ngxDirectiveThirdParty log_request_speed_filter_timeout
|
||||||
|
|
||||||
|
|
||||||
|
" Lua Module <https://github.com/openresty/lua-nginx-module>
|
||||||
|
" Embed the Power of Lua into NGINX HTTP servers
|
||||||
|
syn keyword ngxDirectiveThirdParty lua_use_default_type
|
||||||
|
syn keyword ngxDirectiveThirdParty lua_code_cache
|
||||||
|
syn keyword ngxDirectiveThirdParty lua_regex_cache_max_entries
|
||||||
|
syn keyword ngxDirectiveThirdParty lua_regex_match_limit
|
||||||
|
syn keyword ngxDirectiveThirdParty lua_package_path
|
||||||
|
syn keyword ngxDirectiveThirdParty lua_package_cpath
|
||||||
|
syn keyword ngxDirectiveThirdParty init_by_lua
|
||||||
|
syn keyword ngxDirectiveThirdParty init_by_lua_block
|
||||||
|
syn keyword ngxDirectiveThirdParty init_by_lua_file
|
||||||
|
syn keyword ngxDirectiveThirdParty init_worker_by_lua
|
||||||
|
syn keyword ngxDirectiveThirdParty init_worker_by_lua_block
|
||||||
|
syn keyword ngxDirectiveThirdParty init_worker_by_lua_file
|
||||||
|
syn keyword ngxDirectiveThirdParty set_by_lua
|
||||||
|
syn keyword ngxDirectiveThirdParty set_by_lua_block
|
||||||
|
syn keyword ngxDirectiveThirdParty set_by_lua_file
|
||||||
|
syn keyword ngxDirectiveThirdParty content_by_lua
|
||||||
|
syn keyword ngxDirectiveThirdParty content_by_lua_block
|
||||||
|
syn keyword ngxDirectiveThirdParty content_by_lua_file
|
||||||
|
syn keyword ngxDirectiveThirdParty rewrite_by_lua
|
||||||
|
syn keyword ngxDirectiveThirdParty rewrite_by_lua_block
|
||||||
|
syn keyword ngxDirectiveThirdParty rewrite_by_lua_file
|
||||||
|
syn keyword ngxDirectiveThirdParty access_by_lua
|
||||||
|
syn keyword ngxDirectiveThirdParty access_by_lua_block
|
||||||
|
syn keyword ngxDirectiveThirdParty access_by_lua_file
|
||||||
|
syn keyword ngxDirectiveThirdParty header_filter_by_lua
|
||||||
|
syn keyword ngxDirectiveThirdParty header_filter_by_lua_block
|
||||||
|
syn keyword ngxDirectiveThirdParty header_filter_by_lua_file
|
||||||
|
syn keyword ngxDirectiveThirdParty body_filter_by_lua
|
||||||
|
syn keyword ngxDirectiveThirdParty body_filter_by_lua_block
|
||||||
|
syn keyword ngxDirectiveThirdParty body_filter_by_lua_file
|
||||||
|
syn keyword ngxDirectiveThirdParty log_by_lua
|
||||||
|
syn keyword ngxDirectiveThirdParty log_by_lua_block
|
||||||
|
syn keyword ngxDirectiveThirdParty log_by_lua_file
|
||||||
|
syn keyword ngxDirectiveThirdParty balancer_by_lua_block
|
||||||
|
syn keyword ngxDirectiveThirdParty balancer_by_lua_file
|
||||||
|
syn keyword ngxDirectiveThirdParty lua_need_request_body
|
||||||
|
syn keyword ngxDirectiveThirdParty ssl_certificate_by_lua_block
|
||||||
|
syn keyword ngxDirectiveThirdParty ssl_certificate_by_lua_file
|
||||||
|
syn keyword ngxDirectiveThirdParty lua_shared_dict
|
||||||
|
syn keyword ngxDirectiveThirdParty lua_socket_connect_timeout
|
||||||
|
syn keyword ngxDirectiveThirdParty lua_socket_send_timeout
|
||||||
|
syn keyword ngxDirectiveThirdParty lua_socket_send_lowat
|
||||||
|
syn keyword ngxDirectiveThirdParty lua_socket_read_timeout
|
||||||
|
syn keyword ngxDirectiveThirdParty lua_socket_buffer_size
|
||||||
|
syn keyword ngxDirectiveThirdParty lua_socket_pool_size
|
||||||
|
syn keyword ngxDirectiveThirdParty lua_socket_keepalive_timeout
|
||||||
|
syn keyword ngxDirectiveThirdParty lua_socket_log_errors
|
||||||
|
syn keyword ngxDirectiveThirdParty lua_ssl_ciphers
|
||||||
|
syn keyword ngxDirectiveThirdParty lua_ssl_crl
|
||||||
|
syn keyword ngxDirectiveThirdParty lua_ssl_protocols
|
||||||
|
syn keyword ngxDirectiveThirdParty lua_ssl_trusted_certificate
|
||||||
|
syn keyword ngxDirectiveThirdParty lua_ssl_verify_depth
|
||||||
|
syn keyword ngxDirectiveThirdParty lua_http10_buffering
|
||||||
|
syn keyword ngxDirectiveThirdParty rewrite_by_lua_no_postpone
|
||||||
|
syn keyword ngxDirectiveThirdParty access_by_lua_no_postpone
|
||||||
|
syn keyword ngxDirectiveThirdParty lua_transform_underscores_in_response_headers
|
||||||
|
syn keyword ngxDirectiveThirdParty lua_check_client_abort
|
||||||
|
syn keyword ngxDirectiveThirdParty lua_max_pending_timers
|
||||||
|
syn keyword ngxDirectiveThirdParty lua_max_running_timers
|
||||||
|
|
||||||
|
|
||||||
" Memc Module <http://wiki.nginx.org/NginxHttpMemcModule>
|
" Memc Module <http://wiki.nginx.org/NginxHttpMemcModule>
|
||||||
" An extended version of the standard memcached module that supports set, add, delete, and many more memcached commands.
|
" An extended version of the standard memcached module that supports set, add, delete, and many more memcached commands.
|
||||||
syn keyword ngxDirectiveThirdParty memc_buffer_size
|
syn keyword ngxDirectiveThirdParty memc_buffer_size
|
||||||
@@ -821,12 +917,13 @@ syn keyword ngxDirectiveThirdParty xss_output_type
|
|||||||
|
|
||||||
hi link ngxComment Comment
|
hi link ngxComment Comment
|
||||||
hi link ngxVariable Identifier
|
hi link ngxVariable Identifier
|
||||||
hi link ngxVariableBlock Identifier
|
|
||||||
hi link ngxVariableString PreProc
|
hi link ngxVariableString PreProc
|
||||||
hi link ngxBlock Normal
|
|
||||||
hi link ngxString String
|
hi link ngxString String
|
||||||
|
hi link ngxLocationPath String
|
||||||
|
hi link ngxLocationNamedLoc Identifier
|
||||||
|
|
||||||
hi link ngxBoolean Boolean
|
hi link ngxBoolean Boolean
|
||||||
|
hi link ngxRewriteFlag Boolean
|
||||||
hi link ngxDirectiveBlock Statement
|
hi link ngxDirectiveBlock Statement
|
||||||
hi link ngxDirectiveImportant Type
|
hi link ngxDirectiveImportant Type
|
||||||
hi link ngxDirectiveControl Keyword
|
hi link ngxDirectiveControl Keyword
|
||||||
|
|||||||
@@ -21,25 +21,29 @@ endif
|
|||||||
if !exists("nim_highlight_space_errors")
|
if !exists("nim_highlight_space_errors")
|
||||||
let nim_highlight_space_errors = 1
|
let nim_highlight_space_errors = 1
|
||||||
endif
|
endif
|
||||||
|
if !exists("nim_highlight_special_vars")
|
||||||
|
let nim_highlight_special_vars = 1
|
||||||
|
endif
|
||||||
|
|
||||||
if exists("nim_highlight_all")
|
if exists("nim_highlight_all")
|
||||||
let nim_highlight_numbers = 1
|
let nim_highlight_numbers = 1
|
||||||
let nim_highlight_builtins = 1
|
let nim_highlight_builtins = 1
|
||||||
let nim_highlight_exceptions = 1
|
let nim_highlight_exceptions = 1
|
||||||
let nim_highlight_space_errors = 1
|
let nim_highlight_space_errors = 1
|
||||||
|
let nim_highlight_special_vars = 1
|
||||||
endif
|
endif
|
||||||
|
|
||||||
syn region nimBrackets contained extend keepend matchgroup=Bold start=+\(\\\)\@<!\[+ end=+]\|$+ skip=+\\\s*$\|\(\\\)\@<!\\]+ contains=@tclCommandCluster
|
syn region nimBrackets contained extend keepend matchgroup=Bold start=+\(\\\)\@<!\[+ end=+]\|$+ skip=+\\\s*$\|\(\\\)\@<!\\]+ contains=@tclCommandCluster
|
||||||
|
|
||||||
syn keyword nimKeyword addr and as asm atomic
|
syn keyword nimKeyword addr and as asm atomic
|
||||||
syn keyword nimKeyword bind block break
|
syn keyword nimKeyword bind block break
|
||||||
syn keyword nimKeyword case cast const continue converter
|
syn keyword nimKeyword case cast concept const continue converter
|
||||||
syn keyword nimKeyword discard distinct div do
|
syn keyword nimKeyword defer discard distinct div do
|
||||||
syn keyword nimKeyword elif else end enum except export
|
syn keyword nimKeyword elif else end enum except export
|
||||||
syn keyword nimKeyword finally for from
|
syn keyword nimKeyword finally for from func
|
||||||
syn keyword nimKeyword generic
|
syn keyword nimKeyword generic
|
||||||
syn keyword nimKeyword if import in include interface is isnot iterator
|
syn keyword nimKeyword if import in include interface is isnot iterator
|
||||||
syn keyword nimKeyword lambda let
|
syn keyword nimKeyword let
|
||||||
syn keyword nimKeyword mixin using mod
|
syn keyword nimKeyword mixin using mod
|
||||||
syn keyword nimKeyword nil not notin
|
syn keyword nimKeyword nil not notin
|
||||||
syn keyword nimKeyword object of or out
|
syn keyword nimKeyword object of or out
|
||||||
@@ -59,6 +63,7 @@ syn keyword nimRepeat for while
|
|||||||
syn keyword nimConditional if elif else case of
|
syn keyword nimConditional if elif else case of
|
||||||
syn keyword nimOperator and in is not or xor shl shr div
|
syn keyword nimOperator and in is not or xor shl shr div
|
||||||
syn match nimComment "#.*$" contains=nimTodo,@Spell
|
syn match nimComment "#.*$" contains=nimTodo,@Spell
|
||||||
|
syn region nimComment start="#\[" end="\]#" contains=nimTodo,@Spell
|
||||||
syn keyword nimTodo TODO FIXME XXX contained
|
syn keyword nimTodo TODO FIXME XXX contained
|
||||||
syn keyword nimBoolean true false
|
syn keyword nimBoolean true false
|
||||||
|
|
||||||
@@ -89,11 +94,9 @@ if nim_highlight_builtins == 1
|
|||||||
" builtin functions, types and objects, not really part of the syntax
|
" 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 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 char string cstring pointer range array openarray seq
|
||||||
syn keyword nimBuiltin set Byte Natural Positive TObject PObject Conversion TResult TAddress
|
syn keyword nimBuiltin set Byte Natural Positive Conversion
|
||||||
syn keyword nimBuiltin BiggestInt BiggestFloat cchar cschar cshort cint csize cuchar cushort
|
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 clong clonglong cfloat cdouble clongdouble cuint culong culonglong cchar
|
||||||
syn keyword nimBuiltin cstringArray TEndian PFloat32 PFloat64 PInt64 PInt32
|
|
||||||
syn keyword nimBuiltin TGC_Strategy TFile TFileMode TFileHandle isMainModule
|
|
||||||
syn keyword nimBuiltin CompileDate CompileTime nimVersion nimMajor
|
syn keyword nimBuiltin CompileDate CompileTime nimVersion nimMajor
|
||||||
syn keyword nimBuiltin nimMinor nimPatch cpuEndian hostOS hostCPU inf
|
syn keyword nimBuiltin nimMinor nimPatch cpuEndian hostOS hostCPU inf
|
||||||
syn keyword nimBuiltin neginf nan QuitSuccess QuitFailure dbgLineHook stdin
|
syn keyword nimBuiltin neginf nan QuitSuccess QuitFailure dbgLineHook stdin
|
||||||
@@ -107,7 +110,7 @@ if nim_highlight_builtins == 1
|
|||||||
syn keyword nimBuiltin swap getRefcount getCurrentException Msg
|
syn keyword nimBuiltin swap getRefcount getCurrentException Msg
|
||||||
syn keyword nimBuiltin getOccupiedMem getFreeMem getTotalMem isNil seqToPtr
|
syn keyword nimBuiltin getOccupiedMem getFreeMem getTotalMem isNil seqToPtr
|
||||||
syn keyword nimBuiltin find pop GC_disable GC_enable GC_fullCollect
|
syn keyword nimBuiltin find pop GC_disable GC_enable GC_fullCollect
|
||||||
syn keyword nimBuiltin GC_setStrategy GC_enableMarkAnd Sweep
|
syn keyword nimBuiltin GC_setStrategy GC_enableMarkAndSweep GC_Strategy
|
||||||
syn keyword nimBuiltin GC_disableMarkAnd Sweep GC_getStatistics GC_ref
|
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 GC_ref GC_ref GC_unref GC_unref GC_unref quit
|
||||||
syn keyword nimBuiltin OpenFile OpenFile CloseFile EndOfFile readChar
|
syn keyword nimBuiltin OpenFile OpenFile CloseFile EndOfFile readChar
|
||||||
@@ -115,6 +118,7 @@ if nim_highlight_builtins == 1
|
|||||||
syn keyword nimBuiltin getFileSize ReadBytes ReadChars readBuffer writeBytes
|
syn keyword nimBuiltin getFileSize ReadBytes ReadChars readBuffer writeBytes
|
||||||
syn keyword nimBuiltin writeChars writeBuffer setFilePos getFilePos
|
syn keyword nimBuiltin writeChars writeBuffer setFilePos getFilePos
|
||||||
syn keyword nimBuiltin fileHandle countdown countup items lines
|
syn keyword nimBuiltin fileHandle countdown countup items lines
|
||||||
|
syn keyword nimBuiltin FileMode File RootObj FileHandle ByteAddress Endianness
|
||||||
endif
|
endif
|
||||||
|
|
||||||
if nim_highlight_exceptions == 1
|
if nim_highlight_exceptions == 1
|
||||||
@@ -139,6 +143,10 @@ if nim_highlight_space_errors == 1
|
|||||||
syn match nimSpaceError display "\t"
|
syn match nimSpaceError display "\t"
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
if nim_highlight_special_vars
|
||||||
|
syn keyword nimSpecialVar result
|
||||||
|
endif
|
||||||
|
|
||||||
syn sync match nimSync grouphere NONE "):$"
|
syn sync match nimSync grouphere NONE "):$"
|
||||||
syn sync maxlines=200
|
syn sync maxlines=200
|
||||||
syn sync minlines=2000
|
syn sync minlines=2000
|
||||||
@@ -166,6 +174,7 @@ if version >= 508 || !exists("did_nim_syn_inits")
|
|||||||
HiLink nimComment Comment
|
HiLink nimComment Comment
|
||||||
HiLink nimTodo Todo
|
HiLink nimTodo Todo
|
||||||
HiLink nimDecorator Define
|
HiLink nimDecorator Define
|
||||||
|
HiLink nimSpecialVar Identifier
|
||||||
|
|
||||||
if nim_highlight_numbers == 1
|
if nim_highlight_numbers == 1
|
||||||
HiLink nimNumber Number
|
HiLink nimNumber Number
|
||||||
|
|||||||
375
syntax/ruby.vim
375
syntax/ruby.vim
@@ -11,16 +11,41 @@ if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'ruby') == -1
|
|||||||
" Thanks to perl.vim authors, and to Reimer Behrends. :-) (MN)
|
" Thanks to perl.vim authors, and to Reimer Behrends. :-) (MN)
|
||||||
" ----------------------------------------------------------------------------
|
" ----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
" Prelude {{{1
|
||||||
if exists("b:current_syntax")
|
if exists("b:current_syntax")
|
||||||
finish
|
finish
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
" Folding Config {{{1
|
||||||
if has("folding") && exists("ruby_fold")
|
if has("folding") && exists("ruby_fold")
|
||||||
setlocal foldmethod=syntax
|
setlocal foldmethod=syntax
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
let s:foldable_groups = split(
|
||||||
|
\ get(
|
||||||
|
\ b:,
|
||||||
|
\ 'ruby_foldable_groups',
|
||||||
|
\ get(g:, 'ruby_foldable_groups', 'ALL')
|
||||||
|
\ )
|
||||||
|
\ )
|
||||||
|
|
||||||
|
function! s:foldable(...) abort
|
||||||
|
if index(s:foldable_groups, 'ALL') > -1
|
||||||
|
return 1
|
||||||
|
endif
|
||||||
|
|
||||||
|
for l:i in a:000
|
||||||
|
if index(s:foldable_groups, l:i) > -1
|
||||||
|
return 1
|
||||||
|
endif
|
||||||
|
endfor
|
||||||
|
|
||||||
|
return 0
|
||||||
|
endfunction " }}}
|
||||||
|
|
||||||
syn cluster rubyNotTop contains=@rubyExtendedStringSpecial,@rubyRegexpSpecial,@rubyDeclaration,rubyConditional,rubyExceptional,rubyMethodExceptional,rubyTodo
|
syn cluster rubyNotTop contains=@rubyExtendedStringSpecial,@rubyRegexpSpecial,@rubyDeclaration,rubyConditional,rubyExceptional,rubyMethodExceptional,rubyTodo
|
||||||
|
|
||||||
|
" Whitespace Errors {{{1
|
||||||
if exists("ruby_space_errors")
|
if exists("ruby_space_errors")
|
||||||
if !exists("ruby_no_trail_space_error")
|
if !exists("ruby_no_trail_space_error")
|
||||||
syn match rubySpaceError display excludenl "\s\+$"
|
syn match rubySpaceError display excludenl "\s\+$"
|
||||||
@@ -30,14 +55,14 @@ if exists("ruby_space_errors")
|
|||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
|
|
||||||
" Operators
|
" Operators {{{1
|
||||||
if exists("ruby_operators")
|
if exists("ruby_operators")
|
||||||
syn match rubyOperator "[~!^|*/%+-]\|&\.\@!\|\%(class\s*\)\@<!<<\|<=>\|<=\|\%(<\|\<class\s\+\u\w*\s*\)\@<!<[^<]\@=\|===\|==\|=\~\|>>\|>=\|=\@<!>\|\*\*\|\.\.\.\|\.\.\|::"
|
syn match rubyOperator "[~!^|*/%+-]\|&\.\@!\|\%(class\s*\)\@<!<<\|<=>\|<=\|\%(<\|\<class\s\+\u\w*\s*\)\@<!<[^<]\@=\|===\|==\|=\~\|>>\|>=\|=\@1<!>\|\*\*\|\.\.\.\|\.\.\|::"
|
||||||
syn match rubyOperator "->\|-=\|/=\|\*\*=\|\*=\|&&=\|&=\|&&\|||=\||=\|||\|%=\|+=\|!\~\|!="
|
syn match rubyOperator "->\|-=\|/=\|\*\*=\|\*=\|&&=\|&=\|&&\|||=\||=\|||\|%=\|+=\|!\~\|!="
|
||||||
syn region rubyBracketOperator matchgroup=rubyOperator start="\%(\w[?!]\=\|[]})]\)\@<=\[\s*" end="\s*]" contains=ALLBUT,@rubyNotTop
|
syn region rubyBracketOperator matchgroup=rubyOperator start="\%(\w[?!]\=\|[]})]\)\@2<=\[\s*" end="\s*]" contains=ALLBUT,@rubyNotTop
|
||||||
endif
|
endif
|
||||||
|
|
||||||
" Expression Substitution and Backslash Notation
|
" Expression Substitution and Backslash Notation {{{1
|
||||||
syn match rubyStringEscape "\\\\\|\\[abefnrstv]\|\\\o\{1,3}\|\\x\x\{1,2}" contained display
|
syn match rubyStringEscape "\\\\\|\\[abefnrstv]\|\\\o\{1,3}\|\\x\x\{1,2}" contained display
|
||||||
syn match rubyStringEscape "\%(\\M-\\C-\|\\C-\\M-\|\\M-\\c\|\\c\\M-\|\\c\|\\C-\|\\M-\)\%(\\\o\{1,3}\|\\x\x\{1,2}\|\\\=\S\)" contained display
|
syn match rubyStringEscape "\%(\\M-\\C-\|\\C-\\M-\|\\M-\\c\|\\c\\M-\|\\c\|\\C-\|\\M-\)\%(\\\o\{1,3}\|\\x\x\{1,2}\|\\\=\S\)" contained display
|
||||||
syn match rubyQuoteEscape "\\[\\']" contained display
|
syn match rubyQuoteEscape "\\[\\']" contained display
|
||||||
@@ -47,18 +72,19 @@ syn match rubyInterpolation "#\%(\$\|@@\=\)\w\+" display contained con
|
|||||||
syn match rubyInterpolationDelimiter "#\ze\%(\$\|@@\=\)\w\+" display contained
|
syn match rubyInterpolationDelimiter "#\ze\%(\$\|@@\=\)\w\+" display contained
|
||||||
syn match rubyInterpolation "#\$\%(-\w\|\W\)" display contained contains=rubyInterpolationDelimiter,rubyPredefinedVariable,rubyInvalidVariable
|
syn match rubyInterpolation "#\$\%(-\w\|\W\)" display contained contains=rubyInterpolationDelimiter,rubyPredefinedVariable,rubyInvalidVariable
|
||||||
syn match rubyInterpolationDelimiter "#\ze\$\%(-\w\|\W\)" display contained
|
syn match rubyInterpolationDelimiter "#\ze\$\%(-\w\|\W\)" display contained
|
||||||
syn region rubyNoInterpolation start="\\#{" end="}" contained
|
syn region rubyNoInterpolation start="\\#{" end="}" contained
|
||||||
syn match rubyNoInterpolation "\\#{" display contained
|
syn match rubyNoInterpolation "\\#{" display contained
|
||||||
syn match rubyNoInterpolation "\\#\%(\$\|@@\=\)\w\+" display contained
|
syn match rubyNoInterpolation "\\#\%(\$\|@@\=\)\w\+" display contained
|
||||||
syn match rubyNoInterpolation "\\#\$\W" display contained
|
syn match rubyNoInterpolation "\\#\$\W" display contained
|
||||||
|
|
||||||
syn match rubyDelimEscape "\\[(<{\[)>}\]]" transparent display contained contains=NONE
|
syn match rubyDelimiterEscape "\\[(<{\[)>}\]]" transparent display contained contains=NONE
|
||||||
|
|
||||||
syn region rubyNestedParentheses start="(" skip="\\\\\|\\)" matchgroup=rubyString end=")" transparent contained
|
syn region rubyNestedParentheses start="(" skip="\\\\\|\\)" matchgroup=rubyString end=")" transparent contained
|
||||||
syn region rubyNestedCurlyBraces start="{" skip="\\\\\|\\}" matchgroup=rubyString end="}" transparent contained
|
syn region rubyNestedCurlyBraces start="{" skip="\\\\\|\\}" matchgroup=rubyString end="}" transparent contained
|
||||||
syn region rubyNestedAngleBrackets start="<" skip="\\\\\|\\>" matchgroup=rubyString end=">" transparent contained
|
syn region rubyNestedAngleBrackets start="<" skip="\\\\\|\\>" matchgroup=rubyString end=">" transparent contained
|
||||||
syn region rubyNestedSquareBrackets start="\[" skip="\\\\\|\\\]" matchgroup=rubyString end="\]" transparent contained
|
syn region rubyNestedSquareBrackets start="\[" skip="\\\\\|\\\]" matchgroup=rubyString end="\]" transparent contained
|
||||||
|
|
||||||
|
" Regular Expression Metacharacters {{{1
|
||||||
" These are mostly Oniguruma ready
|
" These are mostly Oniguruma ready
|
||||||
syn region rubyRegexpComment matchgroup=rubyRegexpSpecial start="(?#" skip="\\)" end=")" contained
|
syn region rubyRegexpComment matchgroup=rubyRegexpSpecial start="(?#" skip="\\)" end=")" contained
|
||||||
syn region rubyRegexpParens matchgroup=rubyRegexpSpecial start="(\(?:\|?<\=[=!]\|?>\|?<[a-z_]\w*>\|?[imx]*-[imx]*:\=\|\%(?#\)\@!\)" skip="\\)" end=")" contained transparent contains=@rubyRegexpSpecial
|
syn region rubyRegexpParens matchgroup=rubyRegexpSpecial start="(\(?:\|?<\=[=!]\|?>\|?<[a-z_]\w*>\|?[imx]*-[imx]*:\=\|\%(?#\)\@!\)" skip="\\)" end=")" contained transparent contains=@rubyRegexpSpecial
|
||||||
@@ -81,8 +107,8 @@ syn cluster rubyStringSpecial contains=rubyInterpolation,rubyNoInterpolati
|
|||||||
syn cluster rubyExtendedStringSpecial contains=@rubyStringSpecial,rubyNestedParentheses,rubyNestedCurlyBraces,rubyNestedAngleBrackets,rubyNestedSquareBrackets
|
syn cluster rubyExtendedStringSpecial contains=@rubyStringSpecial,rubyNestedParentheses,rubyNestedCurlyBraces,rubyNestedAngleBrackets,rubyNestedSquareBrackets
|
||||||
syn cluster rubyRegexpSpecial contains=rubyInterpolation,rubyNoInterpolation,rubyStringEscape,rubyRegexpSpecial,rubyRegexpEscape,rubyRegexpBrackets,rubyRegexpCharClass,rubyRegexpDot,rubyRegexpQuantifier,rubyRegexpAnchor,rubyRegexpParens,rubyRegexpComment
|
syn cluster rubyRegexpSpecial contains=rubyInterpolation,rubyNoInterpolation,rubyStringEscape,rubyRegexpSpecial,rubyRegexpEscape,rubyRegexpBrackets,rubyRegexpCharClass,rubyRegexpDot,rubyRegexpQuantifier,rubyRegexpAnchor,rubyRegexpParens,rubyRegexpComment
|
||||||
|
|
||||||
" Numbers and ASCII Codes
|
" Numbers and ASCII Codes {{{1
|
||||||
syn match rubyASCIICode "\%(\w\|[]})\"'/]\)\@<!\%(?\%(\\M-\\C-\|\\C-\\M-\|\\M-\\c\|\\c\\M-\|\\c\|\\C-\|\\M-\)\=\%(\\\o\{1,3}\|\\x\x\{1,2}\|\\\=\S\)\)"
|
syn match rubyASCIICode "\%(\w\|[]})\"'/]\)\@1<!\%(?\%(\\M-\\C-\|\\C-\\M-\|\\M-\\c\|\\c\\M-\|\\c\|\\C-\|\\M-\)\=\%(\\\o\{1,3}\|\\x\x\{1,2}\|\\\=\S\)\)"
|
||||||
syn match rubyInteger "\%(\%(\w\|[]})\"']\s*\)\@<!-\)\=\<0[xX]\x\+\%(_\x\+\)*r\=i\=\>" display
|
syn match rubyInteger "\%(\%(\w\|[]})\"']\s*\)\@<!-\)\=\<0[xX]\x\+\%(_\x\+\)*r\=i\=\>" display
|
||||||
syn match rubyInteger "\%(\%(\w\|[]})\"']\s*\)\@<!-\)\=\<\%(0[dD]\)\=\%(0\|[1-9]\d*\%(_\d\+\)*\)r\=i\=\>" display
|
syn match rubyInteger "\%(\%(\w\|[]})\"']\s*\)\@<!-\)\=\<\%(0[dD]\)\=\%(0\|[1-9]\d*\%(_\d\+\)*\)r\=i\=\>" display
|
||||||
syn match rubyInteger "\%(\%(\w\|[]})\"']\s*\)\@<!-\)\=\<0[oO]\=\o\+\%(_\o\+\)*r\=i\=\>" display
|
syn match rubyInteger "\%(\%(\w\|[]})\"']\s*\)\@<!-\)\=\<0[oO]\=\o\+\%(_\o\+\)*r\=i\=\>" display
|
||||||
@@ -90,20 +116,26 @@ syn match rubyInteger "\%(\%(\w\|[]})\"']\s*\)\@<!-\)\=\<0[bB][01]\+\%(_[01]\+\)
|
|||||||
syn match rubyFloat "\%(\%(\w\|[]})\"']\s*\)\@<!-\)\=\<\%(0\|[1-9]\d*\%(_\d\+\)*\)\.\d\+\%(_\d\+\)*r\=i\=\>" display
|
syn match rubyFloat "\%(\%(\w\|[]})\"']\s*\)\@<!-\)\=\<\%(0\|[1-9]\d*\%(_\d\+\)*\)\.\d\+\%(_\d\+\)*r\=i\=\>" display
|
||||||
syn match rubyFloat "\%(\%(\w\|[]})\"']\s*\)\@<!-\)\=\<\%(0\|[1-9]\d*\%(_\d\+\)*\)\%(\.\d\+\%(_\d\+\)*\)\=\%([eE][-+]\=\d\+\%(_\d\+\)*\)r\=i\=\>" display
|
syn match rubyFloat "\%(\%(\w\|[]})\"']\s*\)\@<!-\)\=\<\%(0\|[1-9]\d*\%(_\d\+\)*\)\%(\.\d\+\%(_\d\+\)*\)\=\%([eE][-+]\=\d\+\%(_\d\+\)*\)r\=i\=\>" display
|
||||||
|
|
||||||
" Identifiers
|
" Identifiers {{{1
|
||||||
syn match rubyLocalVariableOrMethod "\<[_[:lower:]][_[:alnum:]]*[?!=]\=" contains=NONE display transparent
|
syn match rubyLocalVariableOrMethod "\<[_[:lower:]][_[:alnum:]]*[?!=]\=" contains=NONE display transparent
|
||||||
syn match rubyBlockArgument "&[_[:lower:]][_[:alnum:]]" contains=NONE display transparent
|
syn match rubyBlockArgument "&[_[:lower:]][_[:alnum:]]" contains=NONE display transparent
|
||||||
|
|
||||||
syn match rubyConstant "\%(\%(^\|[^.]\)\.\s*\)\@<!\<\u\%(\w\|[^\x00-\x7F]\)*\>\%(\s*(\)\@!"
|
syn match rubyConstant "\%(\%(^\|[^.]\)\.\s*\)\@<!\<\u\%(\w\|[^\x00-\x7F]\)*\>\%(\s*(\)\@!"
|
||||||
syn match rubyClassVariable "@@\%(\h\|[^\x00-\x7F]\)\%(\w\|[^\x00-\x7F]\)*" display
|
syn match rubyClassVariable "@@\%(\h\|[^\x00-\x7F]\)\%(\w\|[^\x00-\x7F]\)*" display
|
||||||
syn match rubyInstanceVariable "@\%(\h\|[^\x00-\x7F]\)\%(\w\|[^\x00-\x7F]\)*" display
|
syn match rubyInstanceVariable "@\%(\h\|[^\x00-\x7F]\)\%(\w\|[^\x00-\x7F]\)*" display
|
||||||
syn match rubyGlobalVariable "$\%(\%(\h\|[^\x00-\x7F]\)\%(\w\|[^\x00-\x7F]\)*\|-.\)"
|
syn match rubyGlobalVariable "$\%(\%(\h\|[^\x00-\x7F]\)\%(\w\|[^\x00-\x7F]\)*\|-.\)"
|
||||||
syn match rubySymbol "[]})\"':]\@<!:\%(\^\|\~@\|\~\|<<\|<=>\|<=\|<\|===\|[=!]=\|[=!]\~\|!@\|!\|>>\|>=\|>\||\|-@\|-\|/\|\[]=\|\[]\|\*\*\|\*\|&\|%\|+@\|+\|`\)"
|
syn match rubySymbol "[]})\"':]\@1<!:\%(\^\|\~@\|\~\|<<\|<=>\|<=\|<\|===\|[=!]=\|[=!]\~\|!@\|!\|>>\|>=\|>\||\|-@\|-\|/\|\[]=\|\[]\|\*\*\|\*\|&\|%\|+@\|+\|`\)"
|
||||||
syn match rubySymbol "[]})\"':]\@<!:\$\%(-.\|[`~<=>_,;:!?/.'"@$*\&+0]\)"
|
syn match rubySymbol "[]})\"':]\@1<!:\$\%(-.\|[`~<=>_,;:!?/.'"@$*\&+0]\)"
|
||||||
syn match rubySymbol "[]})\"':]\@<!:\%(\$\|@@\=\)\=\%(\h\|[^\x00-\x7F]\)\%(\w\|[^\x00-\x7F]\)*"
|
syn match rubySymbol "[]})\"':]\@1<!:\%(\$\|@@\=\)\=\%(\h\|[^\x00-\x7F]\)\%(\w\|[^\x00-\x7F]\)*"
|
||||||
syn match rubySymbol "[]})\"':]\@<!:\%(\h\|[^\x00-\x7F]\)\%(\w\|[^\x00-\x7F]\)*\%([?!=]>\@!\)\="
|
syn match rubySymbol "[]})\"':]\@1<!:\%(\h\|[^\x00-\x7F]\)\%(\w\|[^\x00-\x7F]\)*\%([?!=]>\@!\)\="
|
||||||
syn region rubySymbol start="[]})\"':]\@<!:'" end="'" skip="\\\\\|\\'" contains=rubyQuoteEscape fold
|
|
||||||
syn region rubySymbol start="[]})\"':]\@<!:\"" end="\"" skip="\\\\\|\\\"" contains=@rubyStringSpecial fold
|
if s:foldable(':')
|
||||||
|
syn region rubySymbol start="[]})\"':]\@1<!:'" end="'" skip="\\\\\|\\'" contains=rubyQuoteEscape fold
|
||||||
|
syn region rubySymbol start="[]})\"':]\@1<!:\"" end="\"" skip="\\\\\|\\\"" contains=@rubyStringSpecial fold
|
||||||
|
else
|
||||||
|
syn region rubySymbol start="[]})\"':]\@1<!:'" end="'" skip="\\\\\|\\'" contains=rubyQuoteEscape
|
||||||
|
syn region rubySymbol start="[]})\"':]\@1<!:\"" end="\"" skip="\\\\\|\\\"" contains=@rubyStringSpecial
|
||||||
|
endif
|
||||||
|
|
||||||
syn match rubyCapitalizedMethod "\%(\%(^\|[^.]\)\.\s*\)\@<!\<\u\%(\w\|[^\x00-\x7F]\)*\>\%(\s*(\)*\s*(\@="
|
syn match rubyCapitalizedMethod "\%(\%(^\|[^.]\)\.\s*\)\@<!\<\u\%(\w\|[^\x00-\x7F]\)*\>\%(\s*(\)*\s*(\@="
|
||||||
|
|
||||||
@@ -120,96 +152,172 @@ syn match rubyPredefinedVariable "$\%(DEBUG\|FILENAME\|KCODE\|LOADED_FEATURES\|L
|
|||||||
syn match rubyPredefinedConstant "\%(\%(^\|[^.]\)\.\s*\)\@<!\<\%(ARGF\|ARGV\|ENV\|DATA\|FALSE\|NIL\|STDERR\|STDIN\|STDOUT\|TOPLEVEL_BINDING\|TRUE\)\>\%(\s*(\)\@!"
|
syn match rubyPredefinedConstant "\%(\%(^\|[^.]\)\.\s*\)\@<!\<\%(ARGF\|ARGV\|ENV\|DATA\|FALSE\|NIL\|STDERR\|STDIN\|STDOUT\|TOPLEVEL_BINDING\|TRUE\)\>\%(\s*(\)\@!"
|
||||||
syn match rubyPredefinedConstant "\%(\%(^\|[^.]\)\.\s*\)\@<!\<\%(RUBY_\%(VERSION\|RELEASE_DATE\|PLATFORM\|PATCHLEVEL\|REVISION\|DESCRIPTION\|COPYRIGHT\|ENGINE\)\)\>\%(\s*(\)\@!"
|
syn match rubyPredefinedConstant "\%(\%(^\|[^.]\)\.\s*\)\@<!\<\%(RUBY_\%(VERSION\|RELEASE_DATE\|PLATFORM\|PATCHLEVEL\|REVISION\|DESCRIPTION\|COPYRIGHT\|ENGINE\)\)\>\%(\s*(\)\@!"
|
||||||
|
|
||||||
" Normal Regular Expression
|
" Normal Regular Expression {{{1
|
||||||
syn region rubyRegexp matchgroup=rubyRegexpDelimiter start="\%(\%(^\|\<\%(and\|or\|while\|until\|unless\|if\|elsif\|when\|not\|then\|else\)\|[;\~=!|&(,{[<>?:*+-]\)\s*\)\@<=/" end="/[iomxneus]*" skip="\\\\\|\\/" contains=@rubyRegexpSpecial fold
|
if s:foldable('/')
|
||||||
syn region rubyRegexp matchgroup=rubyRegexpDelimiter start="\%(\h\k*\s\+\)\@<=/[ \t=]\@!" end="/[iomxneus]*" skip="\\\\\|\\/" contains=@rubyRegexpSpecial fold
|
syn region rubyRegexp matchgroup=rubyRegexpDelimiter start="\%(\%(^\|\<\%(and\|or\|while\|until\|unless\|if\|elsif\|when\|not\|then\|else\)\|[;\~=!|&(,{[<>?:*+-]\)\s*\)\@<=/" end="/[iomxneus]*" skip="\\\\\|\\/" contains=@rubyRegexpSpecial fold
|
||||||
|
syn region rubyRegexp matchgroup=rubyRegexpDelimiter start="\%(\h\k*\s\+\)\@<=/[ \t=]\@!" end="/[iomxneus]*" skip="\\\\\|\\/" contains=@rubyRegexpSpecial fold
|
||||||
|
else
|
||||||
|
syn region rubyRegexp matchgroup=rubyRegexpDelimiter start="\%(\%(^\|\<\%(and\|or\|while\|until\|unless\|if\|elsif\|when\|not\|then\|else\)\|[;\~=!|&(,{[<>?:*+-]\)\s*\)\@<=/" end="/[iomxneus]*" skip="\\\\\|\\/" contains=@rubyRegexpSpecial
|
||||||
|
syn region rubyRegexp matchgroup=rubyRegexpDelimiter start="\%(\h\k*\s\+\)\@<=/[ \t=]\@!" end="/[iomxneus]*" skip="\\\\\|\\/" contains=@rubyRegexpSpecial
|
||||||
|
endif
|
||||||
|
|
||||||
" Generalized Regular Expression
|
" Generalized Regular Expression {{{1
|
||||||
syn region rubyRegexp matchgroup=rubyRegexpDelimiter start="%r\z([~`!@#$%^&*_\-+=|\:;"',.?/]\)" end="\z1[iomxneus]*" skip="\\\\\|\\\z1" contains=@rubyRegexpSpecial fold
|
if s:foldable('%')
|
||||||
syn region rubyRegexp matchgroup=rubyRegexpDelimiter start="%r{" end="}[iomxneus]*" skip="\\\\\|\\}" contains=@rubyRegexpSpecial fold
|
syn region rubyRegexp matchgroup=rubyRegexpDelimiter start="%r\z([~`!@#$%^&*_\-+=|\:;"',.?/]\)" end="\z1[iomxneus]*" skip="\\\\\|\\\z1" contains=@rubyRegexpSpecial fold
|
||||||
syn region rubyRegexp matchgroup=rubyRegexpDelimiter start="%r<" end=">[iomxneus]*" skip="\\\\\|\\>" contains=@rubyRegexpSpecial,rubyNestedAngleBrackets,rubyDelimEscape fold
|
syn region rubyRegexp matchgroup=rubyRegexpDelimiter start="%r{" end="}[iomxneus]*" skip="\\\\\|\\}" contains=@rubyRegexpSpecial fold
|
||||||
syn region rubyRegexp matchgroup=rubyRegexpDelimiter start="%r\[" end="\][iomxneus]*" skip="\\\\\|\\\]" contains=@rubyRegexpSpecial fold
|
syn region rubyRegexp matchgroup=rubyRegexpDelimiter start="%r<" end=">[iomxneus]*" skip="\\\\\|\\>" contains=@rubyRegexpSpecial,rubyNestedAngleBrackets,rubyDelimiterEscape fold
|
||||||
syn region rubyRegexp matchgroup=rubyRegexpDelimiter start="%r(" end=")[iomxneus]*" skip="\\\\\|\\)" contains=@rubyRegexpSpecial fold
|
syn region rubyRegexp matchgroup=rubyRegexpDelimiter start="%r\[" end="\][iomxneus]*" skip="\\\\\|\\\]" contains=@rubyRegexpSpecial fold
|
||||||
syn region rubyRegexp matchgroup=rubyRegexpDelimiter start="%r\z(\s\)" end="\z1[iomxneus]*" skip="\\\\\|\\\z1" contains=@rubyRegexpSpecial fold
|
syn region rubyRegexp matchgroup=rubyRegexpDelimiter start="%r(" end=")[iomxneus]*" skip="\\\\\|\\)" contains=@rubyRegexpSpecial fold
|
||||||
|
syn region rubyRegexp matchgroup=rubyRegexpDelimiter start="%r\z(\s\)" end="\z1[iomxneus]*" skip="\\\\\|\\\z1" contains=@rubyRegexpSpecial fold
|
||||||
|
else
|
||||||
|
syn region rubyRegexp matchgroup=rubyRegexpDelimiter start="%r\z([~`!@#$%^&*_\-+=|\:;"',.?/]\)" end="\z1[iomxneus]*" skip="\\\\\|\\\z1" contains=@rubyRegexpSpecial
|
||||||
|
syn region rubyRegexp matchgroup=rubyRegexpDelimiter start="%r{" end="}[iomxneus]*" skip="\\\\\|\\}" contains=@rubyRegexpSpecial
|
||||||
|
syn region rubyRegexp matchgroup=rubyRegexpDelimiter start="%r<" end=">[iomxneus]*" skip="\\\\\|\\>" contains=@rubyRegexpSpecial,rubyNestedAngleBrackets,rubyDelimiterEscape
|
||||||
|
syn region rubyRegexp matchgroup=rubyRegexpDelimiter start="%r\[" end="\][iomxneus]*" skip="\\\\\|\\\]" contains=@rubyRegexpSpecial
|
||||||
|
syn region rubyRegexp matchgroup=rubyRegexpDelimiter start="%r(" end=")[iomxneus]*" skip="\\\\\|\\)" contains=@rubyRegexpSpecial
|
||||||
|
syn region rubyRegexp matchgroup=rubyRegexpDelimiter start="%r\z(\s\)" end="\z1[iomxneus]*" skip="\\\\\|\\\z1" contains=@rubyRegexpSpecial
|
||||||
|
endif
|
||||||
|
|
||||||
" Normal String
|
" Normal String {{{1
|
||||||
let s:spell_cluster = exists('ruby_spellcheck_strings') ? ',@Spell' : ''
|
let s:spell_cluster = exists('ruby_spellcheck_strings') ? ',@Spell' : ''
|
||||||
exe 'syn region rubyString matchgroup=rubyStringDelimiter start="\"" end="\"" skip="\\\\\|\\\"" fold contains=@rubyStringSpecial' . s:spell_cluster
|
exe 'syn region rubyString matchgroup=rubyStringDelimiter start="\"" end="\"" skip="\\\\\|\\\"" ' .
|
||||||
exe 'syn region rubyString matchgroup=rubyStringDelimiter start="''" end="''" skip="\\\\\|\\''" fold contains=rubyQuoteEscape' . s:spell_cluster
|
\ (s:foldable('%') ? 'fold' : '') . ' contains=@rubyStringSpecial' . s:spell_cluster
|
||||||
|
exe 'syn region rubyString matchgroup=rubyStringDelimiter start="''" end="''" skip="\\\\\|\\''" ' .
|
||||||
|
\ (s:foldable('%') ? 'fold' : '') . ' contains=rubyQuoteEscape' . s:spell_cluster
|
||||||
|
|
||||||
" Shell Command Output
|
" Shell Command Output {{{1
|
||||||
syn region rubyString matchgroup=rubyStringDelimiter start="`" end="`" skip="\\\\\|\\`" contains=@rubyStringSpecial fold
|
if s:foldable('%')
|
||||||
|
syn region rubyString matchgroup=rubyStringDelimiter start="`" end="`" skip="\\\\\|\\`" contains=@rubyStringSpecial fold
|
||||||
|
else
|
||||||
|
syn region rubyString matchgroup=rubyStringDelimiter start="`" end="`" skip="\\\\\|\\`" contains=@rubyStringSpecial
|
||||||
|
endif
|
||||||
|
|
||||||
" Generalized Single Quoted String, Symbol and Array of Strings
|
" Generalized Single Quoted String, Symbol and Array of Strings {{{1
|
||||||
syn region rubyString matchgroup=rubyStringDelimiter start="%[qw]\z([~`!@#$%^&*_\-+=|\:;"',.?/]\)" end="\z1" skip="\\\\\|\\\z1" fold
|
if s:foldable('%')
|
||||||
syn region rubyString matchgroup=rubyStringDelimiter start="%[qw]{" end="}" skip="\\\\\|\\}" fold contains=rubyNestedCurlyBraces,rubyDelimEscape
|
syn region rubyString matchgroup=rubyStringDelimiter start="%[qw]\z([~`!@#$%^&*_\-+=|\:;"',.?/]\)" end="\z1" skip="\\\\\|\\\z1" fold
|
||||||
syn region rubyString matchgroup=rubyStringDelimiter start="%[qw]<" end=">" skip="\\\\\|\\>" fold contains=rubyNestedAngleBrackets,rubyDelimEscape
|
syn region rubyString matchgroup=rubyStringDelimiter start="%[qw]{" end="}" skip="\\\\\|\\}" fold contains=rubyNestedCurlyBraces,rubyDelimiterEscape
|
||||||
syn region rubyString matchgroup=rubyStringDelimiter start="%[qw]\[" end="\]" skip="\\\\\|\\\]" fold contains=rubyNestedSquareBrackets,rubyDelimEscape
|
syn region rubyString matchgroup=rubyStringDelimiter start="%[qw]<" end=">" skip="\\\\\|\\>" fold contains=rubyNestedAngleBrackets,rubyDelimiterEscape
|
||||||
syn region rubyString matchgroup=rubyStringDelimiter start="%[qw](" end=")" skip="\\\\\|\\)" fold contains=rubyNestedParentheses,rubyDelimEscape
|
syn region rubyString matchgroup=rubyStringDelimiter start="%[qw]\[" end="\]" skip="\\\\\|\\\]" fold contains=rubyNestedSquareBrackets,rubyDelimiterEscape
|
||||||
syn region rubyString matchgroup=rubyStringDelimiter start="%q\z(\s\)" end="\z1" skip="\\\\\|\\\z1" fold
|
syn region rubyString matchgroup=rubyStringDelimiter start="%[qw](" end=")" skip="\\\\\|\\)" fold contains=rubyNestedParentheses,rubyDelimiterEscape
|
||||||
syn region rubySymbol matchgroup=rubySymbolDelimiter start="%s\z([~`!@#$%^&*_\-+=|\:;"',.?/]\)" end="\z1" skip="\\\\\|\\\z1" fold
|
syn region rubyString matchgroup=rubyStringDelimiter start="%q\z(\s\)" end="\z1" skip="\\\\\|\\\z1" fold
|
||||||
syn region rubySymbol matchgroup=rubySymbolDelimiter start="%s{" end="}" skip="\\\\\|\\}" fold contains=rubyNestedCurlyBraces,rubyDelimEscape
|
syn region rubySymbol matchgroup=rubySymbolDelimiter start="%s\z([~`!@#$%^&*_\-+=|\:;"',.?/]\)" end="\z1" skip="\\\\\|\\\z1" fold
|
||||||
syn region rubySymbol matchgroup=rubySymbolDelimiter start="%s<" end=">" skip="\\\\\|\\>" fold contains=rubyNestedAngleBrackets,rubyDelimEscape
|
syn region rubySymbol matchgroup=rubySymbolDelimiter start="%s{" end="}" skip="\\\\\|\\}" fold contains=rubyNestedCurlyBraces,rubyDelimiterEscape
|
||||||
syn region rubySymbol matchgroup=rubySymbolDelimiter start="%s\[" end="\]" skip="\\\\\|\\\]" fold contains=rubyNestedSquareBrackets,rubyDelimEscape
|
syn region rubySymbol matchgroup=rubySymbolDelimiter start="%s<" end=">" skip="\\\\\|\\>" fold contains=rubyNestedAngleBrackets,rubyDelimiterEscape
|
||||||
syn region rubySymbol matchgroup=rubySymbolDelimiter start="%s(" end=")" skip="\\\\\|\\)" fold contains=rubyNestedParentheses,rubyDelimEscape
|
syn region rubySymbol matchgroup=rubySymbolDelimiter start="%s\[" end="\]" skip="\\\\\|\\\]" fold contains=rubyNestedSquareBrackets,rubyDelimiterEscape
|
||||||
syn region rubyString matchgroup=rubyStringDelimiter start="%s\z(\s\)" end="\z1" skip="\\\\\|\\\z1" fold
|
syn region rubySymbol matchgroup=rubySymbolDelimiter start="%s(" end=")" skip="\\\\\|\\)" fold contains=rubyNestedParentheses,rubyDelimiterEscape
|
||||||
|
syn region rubyString matchgroup=rubyStringDelimiter start="%s\z(\s\)" end="\z1" skip="\\\\\|\\\z1" fold
|
||||||
|
else
|
||||||
|
syn region rubyString matchgroup=rubyStringDelimiter start="%[qw]\z([~`!@#$%^&*_\-+=|\:;"',.?/]\)" end="\z1" skip="\\\\\|\\\z1"
|
||||||
|
syn region rubyString matchgroup=rubyStringDelimiter start="%[qw]{" end="}" skip="\\\\\|\\}" contains=rubyNestedCurlyBraces,rubyDelimiterEscape
|
||||||
|
syn region rubyString matchgroup=rubyStringDelimiter start="%[qw]<" end=">" skip="\\\\\|\\>" contains=rubyNestedAngleBrackets,rubyDelimiterEscape
|
||||||
|
syn region rubyString matchgroup=rubyStringDelimiter start="%[qw]\[" end="\]" skip="\\\\\|\\\]" contains=rubyNestedSquareBrackets,rubyDelimiterEscape
|
||||||
|
syn region rubyString matchgroup=rubyStringDelimiter start="%[qw](" end=")" skip="\\\\\|\\)" contains=rubyNestedParentheses,rubyDelimiterEscape
|
||||||
|
syn region rubyString matchgroup=rubyStringDelimiter start="%q\z(\s\)" end="\z1" skip="\\\\\|\\\z1"
|
||||||
|
syn region rubySymbol matchgroup=rubySymbolDelimiter start="%s\z([~`!@#$%^&*_\-+=|\:;"',.?/]\)" end="\z1" skip="\\\\\|\\\z1"
|
||||||
|
syn region rubySymbol matchgroup=rubySymbolDelimiter start="%s{" end="}" skip="\\\\\|\\}" contains=rubyNestedCurlyBraces,rubyDelimiterEscape
|
||||||
|
syn region rubySymbol matchgroup=rubySymbolDelimiter start="%s<" end=">" skip="\\\\\|\\>" contains=rubyNestedAngleBrackets,rubyDelimiterEscape
|
||||||
|
syn region rubySymbol matchgroup=rubySymbolDelimiter start="%s\[" end="\]" skip="\\\\\|\\\]" contains=rubyNestedSquareBrackets,rubyDelimiterEscape
|
||||||
|
syn region rubySymbol matchgroup=rubySymbolDelimiter start="%s(" end=")" skip="\\\\\|\\)" contains=rubyNestedParentheses,rubyDelimiterEscape
|
||||||
|
syn region rubyString matchgroup=rubyStringDelimiter start="%s\z(\s\)" end="\z1" skip="\\\\\|\\\z1"
|
||||||
|
endif
|
||||||
|
|
||||||
" Generalized Double Quoted String and Array of Strings and Shell Command Output
|
" Generalized Double Quoted String and Array of Strings and Shell Command Output {{{1
|
||||||
" Note: %= is not matched here as the beginning of a double quoted string
|
" Note: %= is not matched here as the beginning of a double quoted string
|
||||||
syn region rubyString matchgroup=rubyStringDelimiter start="%\z([~`!@#$%^&*_\-+|\:;"',.?/]\)" end="\z1" skip="\\\\\|\\\z1" contains=@rubyStringSpecial fold
|
if s:foldable('%')
|
||||||
syn region rubyString matchgroup=rubyStringDelimiter start="%[QWx]\z([~`!@#$%^&*_\-+=|\:;"',.?/]\)" end="\z1" skip="\\\\\|\\\z1" contains=@rubyStringSpecial fold
|
syn region rubyString matchgroup=rubyStringDelimiter start="%\z([~`!@#$%^&*_\-+|\:;"',.?/]\)" end="\z1" skip="\\\\\|\\\z1" contains=@rubyStringSpecial fold
|
||||||
syn region rubyString matchgroup=rubyStringDelimiter start="%[QWx]\={" end="}" skip="\\\\\|\\}" contains=@rubyStringSpecial,rubyNestedCurlyBraces,rubyDelimEscape fold
|
syn region rubyString matchgroup=rubyStringDelimiter start="%[QWx]\z([~`!@#$%^&*_\-+=|\:;"',.?/]\)" end="\z1" skip="\\\\\|\\\z1" contains=@rubyStringSpecial fold
|
||||||
syn region rubyString matchgroup=rubyStringDelimiter start="%[QWx]\=<" end=">" skip="\\\\\|\\>" contains=@rubyStringSpecial,rubyNestedAngleBrackets,rubyDelimEscape fold
|
syn region rubyString matchgroup=rubyStringDelimiter start="%[QWx]\={" end="}" skip="\\\\\|\\}" contains=@rubyStringSpecial,rubyNestedCurlyBraces,rubyDelimiterEscape fold
|
||||||
syn region rubyString matchgroup=rubyStringDelimiter start="%[QWx]\=\[" end="\]" skip="\\\\\|\\\]" contains=@rubyStringSpecial,rubyNestedSquareBrackets,rubyDelimEscape fold
|
syn region rubyString matchgroup=rubyStringDelimiter start="%[QWx]\=<" end=">" skip="\\\\\|\\>" contains=@rubyStringSpecial,rubyNestedAngleBrackets,rubyDelimiterEscape fold
|
||||||
syn region rubyString matchgroup=rubyStringDelimiter start="%[QWx]\=(" end=")" skip="\\\\\|\\)" contains=@rubyStringSpecial,rubyNestedParentheses,rubyDelimEscape fold
|
syn region rubyString matchgroup=rubyStringDelimiter start="%[QWx]\=\[" end="\]" skip="\\\\\|\\\]" contains=@rubyStringSpecial,rubyNestedSquareBrackets,rubyDelimiterEscape fold
|
||||||
syn region rubyString matchgroup=rubyStringDelimiter start="%[Qx]\z(\s\)" end="\z1" skip="\\\\\|\\\z1" contains=@rubyStringSpecial fold
|
syn region rubyString matchgroup=rubyStringDelimiter start="%[QWx]\=(" end=")" skip="\\\\\|\\)" contains=@rubyStringSpecial,rubyNestedParentheses,rubyDelimiterEscape fold
|
||||||
|
syn region rubyString matchgroup=rubyStringDelimiter start="%[Qx]\z(\s\)" end="\z1" skip="\\\\\|\\\z1" contains=@rubyStringSpecial fold
|
||||||
|
else
|
||||||
|
syn region rubyString matchgroup=rubyStringDelimiter start="%\z([~`!@#$%^&*_\-+|\:;"',.?/]\)" end="\z1" skip="\\\\\|\\\z1" contains=@rubyStringSpecial
|
||||||
|
syn region rubyString matchgroup=rubyStringDelimiter start="%[QWx]\z([~`!@#$%^&*_\-+=|\:;"',.?/]\)" end="\z1" skip="\\\\\|\\\z1" contains=@rubyStringSpecial
|
||||||
|
syn region rubyString matchgroup=rubyStringDelimiter start="%[QWx]\={" end="}" skip="\\\\\|\\}" contains=@rubyStringSpecial,rubyNestedCurlyBraces,rubyDelimiterEscape
|
||||||
|
syn region rubyString matchgroup=rubyStringDelimiter start="%[QWx]\=<" end=">" skip="\\\\\|\\>" contains=@rubyStringSpecial,rubyNestedAngleBrackets,rubyDelimiterEscape
|
||||||
|
syn region rubyString matchgroup=rubyStringDelimiter start="%[QWx]\=\[" end="\]" skip="\\\\\|\\\]" contains=@rubyStringSpecial,rubyNestedSquareBrackets,rubyDelimiterEscape
|
||||||
|
syn region rubyString matchgroup=rubyStringDelimiter start="%[QWx]\=(" end=")" skip="\\\\\|\\)" contains=@rubyStringSpecial,rubyNestedParentheses,rubyDelimiterEscape
|
||||||
|
syn region rubyString matchgroup=rubyStringDelimiter start="%[Qx]\z(\s\)" end="\z1" skip="\\\\\|\\\z1" contains=@rubyStringSpecial
|
||||||
|
endif
|
||||||
|
|
||||||
" Array of Symbols
|
" Array of Symbols {{{1
|
||||||
syn region rubySymbol matchgroup=rubySymbolDelimiter start="%i\z([~`!@#$%^&*_\-+=|\:;"',.?/]\)" end="\z1" skip="\\\\\|\\\z1" fold
|
if s:foldable('%')
|
||||||
syn region rubySymbol matchgroup=rubySymbolDelimiter start="%i{" end="}" skip="\\\\\|\\}" fold contains=rubyNestedCurlyBraces,rubyDelimEscape
|
" Array of Symbols
|
||||||
syn region rubySymbol matchgroup=rubySymbolDelimiter start="%i<" end=">" skip="\\\\\|\\>" fold contains=rubyNestedAngleBrackets,rubyDelimEscape
|
syn region rubySymbol matchgroup=rubySymbolDelimiter start="%i\z([~`!@#$%^&*_\-+=|\:;"',.?/]\)" end="\z1" skip="\\\\\|\\\z1" fold
|
||||||
syn region rubySymbol matchgroup=rubySymbolDelimiter start="%i\[" end="\]" skip="\\\\\|\\\]" fold contains=rubyNestedSquareBrackets,rubyDelimEscape
|
syn region rubySymbol matchgroup=rubySymbolDelimiter start="%i{" end="}" skip="\\\\\|\\}" fold contains=rubyNestedCurlyBraces,rubyDelimiterEscape
|
||||||
syn region rubySymbol matchgroup=rubySymbolDelimiter start="%i(" end=")" skip="\\\\\|\\)" fold contains=rubyNestedParentheses,rubyDelimEscape
|
syn region rubySymbol matchgroup=rubySymbolDelimiter start="%i<" end=">" skip="\\\\\|\\>" fold contains=rubyNestedAngleBrackets,rubyDelimiterEscape
|
||||||
|
syn region rubySymbol matchgroup=rubySymbolDelimiter start="%i\[" end="\]" skip="\\\\\|\\\]" fold contains=rubyNestedSquareBrackets,rubyDelimiterEscape
|
||||||
|
syn region rubySymbol matchgroup=rubySymbolDelimiter start="%i(" end=")" skip="\\\\\|\\)" fold contains=rubyNestedParentheses,rubyDelimiterEscape
|
||||||
|
|
||||||
" Array of interpolated Symbols
|
" Array of interpolated Symbols
|
||||||
syn region rubySymbol matchgroup=rubySymbolDelimiter start="%I\z([~`!@#$%^&*_\-+=|\:;"',.?/]\)" end="\z1" skip="\\\\\|\\\z1" contains=@rubyStringSpecial fold
|
syn region rubySymbol matchgroup=rubySymbolDelimiter start="%I\z([~`!@#$%^&*_\-+=|\:;"',.?/]\)" end="\z1" skip="\\\\\|\\\z1" contains=@rubyStringSpecial fold
|
||||||
syn region rubySymbol matchgroup=rubySymbolDelimiter start="%I{" end="}" skip="\\\\\|\\}" contains=@rubyStringSpecial,rubyNestedCurlyBraces,rubyDelimEscape fold
|
syn region rubySymbol matchgroup=rubySymbolDelimiter start="%I{" end="}" skip="\\\\\|\\}" contains=@rubyStringSpecial,rubyNestedCurlyBraces,rubyDelimiterEscape fold
|
||||||
syn region rubySymbol matchgroup=rubySymbolDelimiter start="%I<" end=">" skip="\\\\\|\\>" contains=@rubyStringSpecial,rubyNestedAngleBrackets,rubyDelimEscape fold
|
syn region rubySymbol matchgroup=rubySymbolDelimiter start="%I<" end=">" skip="\\\\\|\\>" contains=@rubyStringSpecial,rubyNestedAngleBrackets,rubyDelimiterEscape fold
|
||||||
syn region rubySymbol matchgroup=rubySymbolDelimiter start="%I\[" end="\]" skip="\\\\\|\\\]" contains=@rubyStringSpecial,rubyNestedSquareBrackets,rubyDelimEscape fold
|
syn region rubySymbol matchgroup=rubySymbolDelimiter start="%I\[" end="\]" skip="\\\\\|\\\]" contains=@rubyStringSpecial,rubyNestedSquareBrackets,rubyDelimiterEscape fold
|
||||||
syn region rubySymbol matchgroup=rubySymbolDelimiter start="%I(" end=")" skip="\\\\\|\\)" contains=@rubyStringSpecial,rubyNestedParentheses,rubyDelimEscape fold
|
syn region rubySymbol matchgroup=rubySymbolDelimiter start="%I(" end=")" skip="\\\\\|\\)" contains=@rubyStringSpecial,rubyNestedParentheses,rubyDelimiterEscape fold
|
||||||
|
else
|
||||||
|
" Array of Symbols
|
||||||
|
syn region rubySymbol matchgroup=rubySymbolDelimiter start="%i\z([~`!@#$%^&*_\-+=|\:;"',.?/]\)" end="\z1" skip="\\\\\|\\\z1"
|
||||||
|
syn region rubySymbol matchgroup=rubySymbolDelimiter start="%i{" end="}" skip="\\\\\|\\}" contains=rubyNestedCurlyBraces,rubyDelimiterEscape
|
||||||
|
syn region rubySymbol matchgroup=rubySymbolDelimiter start="%i<" end=">" skip="\\\\\|\\>" contains=rubyNestedAngleBrackets,rubyDelimiterEscape
|
||||||
|
syn region rubySymbol matchgroup=rubySymbolDelimiter start="%i\[" end="\]" skip="\\\\\|\\\]" contains=rubyNestedSquareBrackets,rubyDelimiterEscape
|
||||||
|
syn region rubySymbol matchgroup=rubySymbolDelimiter start="%i(" end=")" skip="\\\\\|\\)" contains=rubyNestedParentheses,rubyDelimiterEscape
|
||||||
|
|
||||||
" Here Document
|
" Array of interpolated Symbols
|
||||||
|
syn region rubySymbol matchgroup=rubySymbolDelimiter start="%I\z([~`!@#$%^&*_\-+=|\:;"',.?/]\)" end="\z1" skip="\\\\\|\\\z1" contains=@rubyStringSpecial
|
||||||
|
syn region rubySymbol matchgroup=rubySymbolDelimiter start="%I{" end="}" skip="\\\\\|\\}" contains=@rubyStringSpecial,rubyNestedCurlyBraces,rubyDelimiterEscape
|
||||||
|
syn region rubySymbol matchgroup=rubySymbolDelimiter start="%I<" end=">" skip="\\\\\|\\>" contains=@rubyStringSpecial,rubyNestedAngleBrackets,rubyDelimiterEscape
|
||||||
|
syn region rubySymbol matchgroup=rubySymbolDelimiter start="%I\[" end="\]" skip="\\\\\|\\\]" contains=@rubyStringSpecial,rubyNestedSquareBrackets,rubyDelimiterEscape
|
||||||
|
syn region rubySymbol matchgroup=rubySymbolDelimiter start="%I(" end=")" skip="\\\\\|\\)" contains=@rubyStringSpecial,rubyNestedParentheses,rubyDelimiterEscape
|
||||||
|
endif
|
||||||
|
|
||||||
|
" Here Document {{{1
|
||||||
syn region rubyHeredocStart matchgroup=rubyStringDelimiter start=+\%(\%(class\s*\|\%([]})"'.]\|::\)\)\_s*\|\w\)\@<!<<[-~]\=\zs\%(\%(\h\|[^\x00-\x7F]\)\%(\w\|[^\x00-\x7F]\)*\)+ end=+$+ oneline contains=ALLBUT,@rubyNotTop
|
syn region rubyHeredocStart matchgroup=rubyStringDelimiter start=+\%(\%(class\s*\|\%([]})"'.]\|::\)\)\_s*\|\w\)\@<!<<[-~]\=\zs\%(\%(\h\|[^\x00-\x7F]\)\%(\w\|[^\x00-\x7F]\)*\)+ end=+$+ oneline contains=ALLBUT,@rubyNotTop
|
||||||
syn region rubyHeredocStart matchgroup=rubyStringDelimiter start=+\%(\%(class\s*\|\%([]})"'.]\|::\)\)\_s*\|\w\)\@<!<<[-~]\=\zs"\%([^"]*\)"+ end=+$+ oneline contains=ALLBUT,@rubyNotTop
|
syn region rubyHeredocStart matchgroup=rubyStringDelimiter start=+\%(\%(class\s*\|\%([]})"'.]\|::\)\)\_s*\|\w\)\@<!<<[-~]\=\zs"\%([^"]*\)"+ end=+$+ oneline contains=ALLBUT,@rubyNotTop
|
||||||
syn region rubyHeredocStart matchgroup=rubyStringDelimiter start=+\%(\%(class\s*\|\%([]})"'.]\|::\)\)\_s*\|\w\)\@<!<<[-~]\=\zs'\%([^']*\)'+ end=+$+ oneline contains=ALLBUT,@rubyNotTop
|
syn region rubyHeredocStart matchgroup=rubyStringDelimiter start=+\%(\%(class\s*\|\%([]})"'.]\|::\)\)\_s*\|\w\)\@<!<<[-~]\=\zs'\%([^']*\)'+ end=+$+ oneline contains=ALLBUT,@rubyNotTop
|
||||||
syn region rubyHeredocStart matchgroup=rubyStringDelimiter start=+\%(\%(class\s*\|\%([]})"'.]\|::\)\)\_s*\|\w\)\@<!<<[-~]\=\zs`\%([^`]*\)`+ end=+$+ oneline contains=ALLBUT,@rubyNotTop
|
syn region rubyHeredocStart matchgroup=rubyStringDelimiter start=+\%(\%(class\s*\|\%([]})"'.]\|::\)\)\_s*\|\w\)\@<!<<[-~]\=\zs`\%([^`]*\)`+ end=+$+ oneline contains=ALLBUT,@rubyNotTop
|
||||||
|
|
||||||
syn region rubyString start=+\%(\%(class\|::\)\_s*\|\%([]})"'.]\)\s\|\w\)\@<!<<\z(\%(\h\|[^\x00-\x7F]\)\%(\w\|[^\x00-\x7F]\)*\)\ze\%(.*<<[-~]\=['`"]\=\h\)\@!+hs=s+2 matchgroup=rubyStringDelimiter end=+^\z1$+ contains=rubyHeredocStart,rubyHeredoc,@rubyStringSpecial fold keepend
|
if s:foldable('<<')
|
||||||
syn region rubyString start=+\%(\%(class\|::\)\_s*\|\%([]})"'.]\)\s\|\w\)\@<!<<"\z([^"]*\)"\ze\%(.*<<[-~]\=['`"]\=\h\)\@!+hs=s+2 matchgroup=rubyStringDelimiter end=+^\z1$+ contains=rubyHeredocStart,rubyHeredoc,@rubyStringSpecial fold keepend
|
syn region rubyString start=+\%(\%(class\|::\)\_s*\|\%([]})"'.]\)\s\|\w\)\@<!<<\z(\%(\h\|[^\x00-\x7F]\)\%(\w\|[^\x00-\x7F]\)*\)\ze\%(.*<<[-~]\=['`"]\=\h\)\@!+hs=s+2 matchgroup=rubyStringDelimiter end=+^\z1$+ contains=rubyHeredocStart,rubyHeredoc,@rubyStringSpecial fold keepend
|
||||||
syn region rubyString start=+\%(\%(class\|::\)\_s*\|\%([]})"'.]\)\s\|\w\)\@<!<<'\z([^']*\)'\ze\%(.*<<[-~]\=['`"]\=\h\)\@!+hs=s+2 matchgroup=rubyStringDelimiter end=+^\z1$+ contains=rubyHeredocStart,rubyHeredoc fold keepend
|
syn region rubyString start=+\%(\%(class\|::\)\_s*\|\%([]})"'.]\)\s\|\w\)\@<!<<"\z([^"]*\)"\ze\%(.*<<[-~]\=['`"]\=\h\)\@!+hs=s+2 matchgroup=rubyStringDelimiter end=+^\z1$+ contains=rubyHeredocStart,rubyHeredoc,@rubyStringSpecial fold keepend
|
||||||
syn region rubyString start=+\%(\%(class\|::\)\_s*\|\%([]})"'.]\)\s\|\w\)\@<!<<`\z([^`]*\)`\ze\%(.*<<[-~]\=['`"]\=\h\)\@!+hs=s+2 matchgroup=rubyStringDelimiter end=+^\z1$+ contains=rubyHeredocStart,rubyHeredoc,@rubyStringSpecial fold keepend
|
syn region rubyString start=+\%(\%(class\|::\)\_s*\|\%([]})"'.]\)\s\|\w\)\@<!<<'\z([^']*\)'\ze\%(.*<<[-~]\=['`"]\=\h\)\@!+hs=s+2 matchgroup=rubyStringDelimiter end=+^\z1$+ contains=rubyHeredocStart,rubyHeredoc fold keepend
|
||||||
|
syn region rubyString start=+\%(\%(class\|::\)\_s*\|\%([]})"'.]\)\s\|\w\)\@<!<<`\z([^`]*\)`\ze\%(.*<<[-~]\=['`"]\=\h\)\@!+hs=s+2 matchgroup=rubyStringDelimiter end=+^\z1$+ contains=rubyHeredocStart,rubyHeredoc,@rubyStringSpecial fold keepend
|
||||||
|
|
||||||
syn region rubyString start=+\%(\%(class\|::\)\_s*\|\%([]}).]\)\s\|\w\)\@<!<<[-~]\z(\%(\h\|[^\x00-\x7F]\)\%(\w\|[^\x00-\x7F]\)*\)\ze\%(.*<<[-~]\=['`"]\=\h\)\@!+hs=s+3 matchgroup=rubyStringDelimiter end=+^\s*\zs\z1$+ contains=rubyHeredocStart,@rubyStringSpecial fold keepend
|
syn region rubyString start=+\%(\%(class\|::\)\_s*\|\%([]}).]\)\s\|\w\)\@<!<<[-~]\z(\%(\h\|[^\x00-\x7F]\)\%(\w\|[^\x00-\x7F]\)*\)\ze\%(.*<<[-~]\=['`"]\=\h\)\@!+hs=s+3 matchgroup=rubyStringDelimiter end=+^\s*\zs\z1$+ contains=rubyHeredocStart,@rubyStringSpecial fold keepend
|
||||||
syn region rubyString start=+\%(\%(class\|::\)\_s*\|\%([]}).]\)\s\|\w\)\@<!<<[-~]"\z([^"]*\)"\ze\%(.*<<[-~]\=['`"]\=\h\)\@!+hs=s+3 matchgroup=rubyStringDelimiter end=+^\s*\zs\z1$+ contains=rubyHeredocStart,@rubyStringSpecial fold keepend
|
syn region rubyString start=+\%(\%(class\|::\)\_s*\|\%([]}).]\)\s\|\w\)\@<!<<[-~]"\z([^"]*\)"\ze\%(.*<<[-~]\=['`"]\=\h\)\@!+hs=s+3 matchgroup=rubyStringDelimiter end=+^\s*\zs\z1$+ contains=rubyHeredocStart,@rubyStringSpecial fold keepend
|
||||||
syn region rubyString start=+\%(\%(class\|::\)\_s*\|\%([]}).]\)\s\|\w\)\@<!<<[-~]'\z([^']*\)'\ze\%(.*<<[-~]\=['`"]\=\h\)\@!+hs=s+3 matchgroup=rubyStringDelimiter end=+^\s*\zs\z1$+ contains=rubyHeredocStart fold keepend
|
syn region rubyString start=+\%(\%(class\|::\)\_s*\|\%([]}).]\)\s\|\w\)\@<!<<[-~]'\z([^']*\)'\ze\%(.*<<[-~]\=['`"]\=\h\)\@!+hs=s+3 matchgroup=rubyStringDelimiter end=+^\s*\zs\z1$+ contains=rubyHeredocStart fold keepend
|
||||||
syn region rubyString start=+\%(\%(class\|::\)\_s*\|\%([]}).]\)\s\|\w\)\@<!<<[-~]`\z([^`]*\)`\ze\%(.*<<[-~]\=['`"]\=\h\)\@!+hs=s+3 matchgroup=rubyStringDelimiter end=+^\s*\zs\z1$+ contains=rubyHeredocStart,@rubyStringSpecial fold keepend
|
syn region rubyString start=+\%(\%(class\|::\)\_s*\|\%([]}).]\)\s\|\w\)\@<!<<[-~]`\z([^`]*\)`\ze\%(.*<<[-~]\=['`"]\=\h\)\@!+hs=s+3 matchgroup=rubyStringDelimiter end=+^\s*\zs\z1$+ contains=rubyHeredocStart,@rubyStringSpecial fold keepend
|
||||||
|
else
|
||||||
|
syn region rubyString start=+\%(\%(class\|::\)\_s*\|\%([]})"'.]\)\s\|\w\)\@<!<<\z(\%(\h\|[^\x00-\x7F]\)\%(\w\|[^\x00-\x7F]\)*\)\ze\%(.*<<[-~]\=['`"]\=\h\)\@!+hs=s+2 matchgroup=rubyStringDelimiter end=+^\z1$+ contains=rubyHeredocStart,rubyHeredoc,@rubyStringSpecial keepend
|
||||||
|
syn region rubyString start=+\%(\%(class\|::\)\_s*\|\%([]})"'.]\)\s\|\w\)\@<!<<"\z([^"]*\)"\ze\%(.*<<[-~]\=['`"]\=\h\)\@!+hs=s+2 matchgroup=rubyStringDelimiter end=+^\z1$+ contains=rubyHeredocStart,rubyHeredoc,@rubyStringSpecial keepend
|
||||||
|
syn region rubyString start=+\%(\%(class\|::\)\_s*\|\%([]})"'.]\)\s\|\w\)\@<!<<'\z([^']*\)'\ze\%(.*<<[-~]\=['`"]\=\h\)\@!+hs=s+2 matchgroup=rubyStringDelimiter end=+^\z1$+ contains=rubyHeredocStart,rubyHeredoc keepend
|
||||||
|
syn region rubyString start=+\%(\%(class\|::\)\_s*\|\%([]})"'.]\)\s\|\w\)\@<!<<`\z([^`]*\)`\ze\%(.*<<[-~]\=['`"]\=\h\)\@!+hs=s+2 matchgroup=rubyStringDelimiter end=+^\z1$+ contains=rubyHeredocStart,rubyHeredoc,@rubyStringSpecial keepend
|
||||||
|
|
||||||
|
syn region rubyString start=+\%(\%(class\|::\)\_s*\|\%([]}).]\)\s\|\w\)\@<!<<[-~]\z(\%(\h\|[^\x00-\x7F]\)\%(\w\|[^\x00-\x7F]\)*\)\ze\%(.*<<[-~]\=['`"]\=\h\)\@!+hs=s+3 matchgroup=rubyStringDelimiter end=+^\s*\zs\z1$+ contains=rubyHeredocStart,@rubyStringSpecial keepend
|
||||||
|
syn region rubyString start=+\%(\%(class\|::\)\_s*\|\%([]}).]\)\s\|\w\)\@<!<<[-~]"\z([^"]*\)"\ze\%(.*<<[-~]\=['`"]\=\h\)\@!+hs=s+3 matchgroup=rubyStringDelimiter end=+^\s*\zs\z1$+ contains=rubyHeredocStart,@rubyStringSpecial keepend
|
||||||
|
syn region rubyString start=+\%(\%(class\|::\)\_s*\|\%([]}).]\)\s\|\w\)\@<!<<[-~]'\z([^']*\)'\ze\%(.*<<[-~]\=['`"]\=\h\)\@!+hs=s+3 matchgroup=rubyStringDelimiter end=+^\s*\zs\z1$+ contains=rubyHeredocStart keepend
|
||||||
|
syn region rubyString start=+\%(\%(class\|::\)\_s*\|\%([]}).]\)\s\|\w\)\@<!<<[-~]`\z([^`]*\)`\ze\%(.*<<[-~]\=['`"]\=\h\)\@!+hs=s+3 matchgroup=rubyStringDelimiter end=+^\s*\zs\z1$+ contains=rubyHeredocStart,@rubyStringSpecial keepend
|
||||||
|
endif
|
||||||
|
|
||||||
|
" eRuby Config {{{1
|
||||||
if exists('main_syntax') && main_syntax == 'eruby'
|
if exists('main_syntax') && main_syntax == 'eruby'
|
||||||
let b:ruby_no_expensive = 1
|
let b:ruby_no_expensive = 1
|
||||||
end
|
end
|
||||||
|
|
||||||
|
" Module, Class, Method and Alias Declarations {{{1
|
||||||
syn match rubyAliasDeclaration "[^[:space:];#.()]\+" contained contains=rubySymbol,rubyGlobalVariable,rubyPredefinedVariable nextgroup=rubyAliasDeclaration2 skipwhite
|
syn match rubyAliasDeclaration "[^[:space:];#.()]\+" contained contains=rubySymbol,rubyGlobalVariable,rubyPredefinedVariable nextgroup=rubyAliasDeclaration2 skipwhite
|
||||||
syn match rubyAliasDeclaration2 "[^[:space:];#.()]\+" contained contains=rubySymbol,rubyGlobalVariable,rubyPredefinedVariable
|
syn match rubyAliasDeclaration2 "[^[:space:];#.()]\+" contained contains=rubySymbol,rubyGlobalVariable,rubyPredefinedVariable
|
||||||
syn match rubyMethodDeclaration "[^[:space:];#(]\+" contained contains=rubyConstant,rubyBoolean,rubyPseudoVariable,rubyInstanceVariable,rubyClassVariable,rubyGlobalVariable
|
syn match rubyMethodDeclaration "[^[:space:];#(]\+" contained contains=rubyConstant,rubyBoolean,rubyPseudoVariable,rubyInstanceVariable,rubyClassVariable,rubyGlobalVariable
|
||||||
syn match rubyClassDeclaration "[^[:space:];#<]\+" contained contains=rubyConstant,rubyOperator
|
syn match rubyClassDeclaration "[^[:space:];#<]\+" contained contains=rubyConstant,rubyOperator
|
||||||
syn match rubyModuleDeclaration "[^[:space:];#<]\+" contained contains=rubyConstant,rubyOperator
|
syn match rubyModuleDeclaration "[^[:space:];#<]\+" contained contains=rubyConstant,rubyOperator
|
||||||
syn match rubyFunction "\<[_[:alpha:]][_[:alnum:]]*[?!=]\=[[:alnum:]_.:?!=]\@!" contained containedin=rubyMethodDeclaration
|
syn match rubyFunction "\<[_[:alpha:]][_[:alnum:]]*[?!=]\=[[:alnum:]_.:?!=]\@!" contained containedin=rubyMethodDeclaration
|
||||||
syn match rubyFunction "\%(\s\|^\)\@<=[_[:alpha:]][_[:alnum:]]*[?!=]\=\%(\s\|$\)\@=" contained containedin=rubyAliasDeclaration,rubyAliasDeclaration2
|
syn match rubyFunction "\%(\s\|^\)\@1<=[_[:alpha:]][_[:alnum:]]*[?!=]\=\%(\s\|$\)\@=" contained containedin=rubyAliasDeclaration,rubyAliasDeclaration2
|
||||||
syn match rubyFunction "\%([[:space:].]\|^\)\@<=\%(\[\]=\=\|\*\*\|[-+!~]@\=\|[*/%|&^~]\|<<\|>>\|[<>]=\=\|<=>\|===\|[=!]=\|[=!]\~\|!\|`\)\%([[:space:];#(]\|$\)\@=" contained containedin=rubyAliasDeclaration,rubyAliasDeclaration2,rubyMethodDeclaration
|
syn match rubyFunction "\%([[:space:].]\|^\)\@2<=\%(\[\]=\=\|\*\*\|[-+!~]@\=\|[*/%|&^~]\|<<\|>>\|[<>]=\=\|<=>\|===\|[=!]=\|[=!]\~\|!\|`\)\%([[:space:];#(]\|$\)\@=" contained containedin=rubyAliasDeclaration,rubyAliasDeclaration2,rubyMethodDeclaration
|
||||||
|
|
||||||
syn cluster rubyDeclaration contains=rubyAliasDeclaration,rubyAliasDeclaration2,rubyMethodDeclaration,rubyModuleDeclaration,rubyClassDeclaration,rubyFunction,rubyBlockParameter
|
syn cluster rubyDeclaration contains=rubyAliasDeclaration,rubyAliasDeclaration2,rubyMethodDeclaration,rubyModuleDeclaration,rubyClassDeclaration,rubyFunction,rubyBlockParameter
|
||||||
|
|
||||||
" Keywords
|
" Keywords {{{1
|
||||||
" Note: the following keywords have already been defined:
|
" Note: the following keywords have already been defined:
|
||||||
" begin case class def do end for if module unless until while
|
" begin case class def do end for if module unless until while
|
||||||
syn match rubyControl "\<\%(and\|break\|in\|next\|not\|or\|redo\|rescue\|retry\|return\)\>[?!]\@!"
|
syn match rubyControl "\<\%(and\|break\|in\|next\|not\|or\|redo\|rescue\|retry\|return\)\>[?!]\@!"
|
||||||
@@ -219,8 +327,9 @@ syn match rubyBoolean "\<\%(true\|false\)\>[?!]\@!"
|
|||||||
syn match rubyPseudoVariable "\<\%(nil\|self\|__ENCODING__\|__dir__\|__FILE__\|__LINE__\|__callee__\|__method__\)\>[?!]\@!" " TODO: reorganise
|
syn match rubyPseudoVariable "\<\%(nil\|self\|__ENCODING__\|__dir__\|__FILE__\|__LINE__\|__callee__\|__method__\)\>[?!]\@!" " TODO: reorganise
|
||||||
syn match rubyBeginEnd "\<\%(BEGIN\|END\)\>[?!]\@!"
|
syn match rubyBeginEnd "\<\%(BEGIN\|END\)\>[?!]\@!"
|
||||||
|
|
||||||
" Expensive Mode - match 'end' with the appropriate opening keyword for syntax
|
" Expensive Mode {{{1
|
||||||
" based folding and special highlighting of module/class/method definitions
|
" Match 'end' with the appropriate opening keyword for syntax based folding
|
||||||
|
" and special highlighting of module/class/method definitions
|
||||||
if !exists("b:ruby_no_expensive") && !exists("ruby_no_expensive")
|
if !exists("b:ruby_no_expensive") && !exists("ruby_no_expensive")
|
||||||
syn match rubyDefine "\<alias\>" nextgroup=rubyAliasDeclaration skipwhite skipnl
|
syn match rubyDefine "\<alias\>" nextgroup=rubyAliasDeclaration skipwhite skipnl
|
||||||
syn match rubyDefine "\<def\>" nextgroup=rubyMethodDeclaration skipwhite skipnl
|
syn match rubyDefine "\<def\>" nextgroup=rubyMethodDeclaration skipwhite skipnl
|
||||||
@@ -228,23 +337,66 @@ if !exists("b:ruby_no_expensive") && !exists("ruby_no_expensive")
|
|||||||
syn match rubyClass "\<class\>" nextgroup=rubyClassDeclaration skipwhite skipnl
|
syn match rubyClass "\<class\>" nextgroup=rubyClassDeclaration skipwhite skipnl
|
||||||
syn match rubyModule "\<module\>" nextgroup=rubyModuleDeclaration skipwhite skipnl
|
syn match rubyModule "\<module\>" nextgroup=rubyModuleDeclaration skipwhite skipnl
|
||||||
|
|
||||||
syn region rubyMethodBlock start="\<def\>" matchgroup=rubyDefine end="\%(\<def\_s\+\)\@<!\<end\>" contains=ALLBUT,@rubyNotTop fold
|
if s:foldable('def')
|
||||||
syn region rubyBlock start="\<class\>" matchgroup=rubyClass end="\<end\>" contains=ALLBUT,@rubyNotTop fold
|
syn region rubyMethodBlock start="\<def\>" matchgroup=rubyDefine end="\%(\<def\_s\+\)\@<!\<end\>" contains=ALLBUT,@rubyNotTop fold
|
||||||
syn region rubyBlock start="\<module\>" matchgroup=rubyModule end="\<end\>" contains=ALLBUT,@rubyNotTop fold
|
else
|
||||||
|
syn region rubyMethodBlock start="\<def\>" matchgroup=rubyDefine end="\%(\<def\_s\+\)\@<!\<end\>" contains=ALLBUT,@rubyNotTop
|
||||||
|
endif
|
||||||
|
|
||||||
|
if s:foldable('class')
|
||||||
|
syn region rubyBlock start="\<class\>" matchgroup=rubyClass end="\<end\>" contains=ALLBUT,@rubyNotTop fold
|
||||||
|
else
|
||||||
|
syn region rubyBlock start="\<class\>" matchgroup=rubyClass end="\<end\>" contains=ALLBUT,@rubyNotTop
|
||||||
|
endif
|
||||||
|
|
||||||
|
if s:foldable('module')
|
||||||
|
syn region rubyBlock start="\<module\>" matchgroup=rubyModule end="\<end\>" contains=ALLBUT,@rubyNotTop fold
|
||||||
|
else
|
||||||
|
syn region rubyBlock start="\<module\>" matchgroup=rubyModule end="\<end\>" contains=ALLBUT,@rubyNotTop
|
||||||
|
endif
|
||||||
|
|
||||||
" modifiers
|
" modifiers
|
||||||
syn match rubyConditionalModifier "\<\%(if\|unless\)\>" display
|
syn match rubyLineContinuation "\\$" nextgroup=rubyConditionalModifier,rubyRepeatModifier skipwhite skipnl
|
||||||
syn match rubyRepeatModifier "\<\%(while\|until\)\>" display
|
syn match rubyConditionalModifier "\<\%(if\|unless\)\>"
|
||||||
|
syn match rubyRepeatModifier "\<\%(while\|until\)\>"
|
||||||
|
|
||||||
|
if s:foldable('do')
|
||||||
|
syn region rubyDoBlock matchgroup=rubyControl start="\<do\>" end="\<end\>" contains=ALLBUT,@rubyNotTop fold
|
||||||
|
else
|
||||||
|
syn region rubyDoBlock matchgroup=rubyControl start="\<do\>" end="\<end\>" contains=ALLBUT,@rubyNotTop
|
||||||
|
endif
|
||||||
|
|
||||||
syn region rubyDoBlock matchgroup=rubyControl start="\<do\>" end="\<end\>" contains=ALLBUT,@rubyNotTop fold
|
|
||||||
" curly bracket block or hash literal
|
" curly bracket block or hash literal
|
||||||
syn region rubyCurlyBlock matchgroup=rubyCurlyBlockDelimiter start="{" end="}" contains=ALLBUT,@rubyNotTop fold
|
if s:foldable('{')
|
||||||
syn region rubyArrayLiteral matchgroup=rubyArrayDelimiter start="\%(\w\|[\]})]\)\@<!\[" end="]" contains=ALLBUT,@rubyNotTop fold
|
syn region rubyCurlyBlock matchgroup=rubyCurlyBlockDelimiter start="{" end="}" contains=ALLBUT,@rubyNotTop fold
|
||||||
|
else
|
||||||
|
syn region rubyCurlyBlock matchgroup=rubyCurlyBlockDelimiter start="{" end="}" contains=ALLBUT,@rubyNotTop
|
||||||
|
endif
|
||||||
|
|
||||||
|
if s:foldable('[')
|
||||||
|
syn region rubyArrayLiteral matchgroup=rubyArrayDelimiter start="\%(\w\|[\]})]\)\@<!\[" end="]" contains=ALLBUT,@rubyNotTop fold
|
||||||
|
else
|
||||||
|
syn region rubyArrayLiteral matchgroup=rubyArrayDelimiter start="\%(\w\|[\]})]\)\@<!\[" end="]" contains=ALLBUT,@rubyNotTop
|
||||||
|
endif
|
||||||
|
|
||||||
" statements without 'do'
|
" statements without 'do'
|
||||||
syn region rubyBlockExpression matchgroup=rubyControl start="\<begin\>" end="\<end\>" contains=ALLBUT,@rubyNotTop fold
|
if s:foldable('begin')
|
||||||
syn region rubyCaseExpression matchgroup=rubyConditional start="\<case\>" end="\<end\>" contains=ALLBUT,@rubyNotTop fold
|
syn region rubyBlockExpression matchgroup=rubyControl start="\<begin\>" end="\<end\>" contains=ALLBUT,@rubyNotTop fold
|
||||||
syn region rubyConditionalExpression matchgroup=rubyConditional start="\%(\%(^\|\.\.\.\=\|[{:,;([<>~\*%&^|+=-]\|\%(\<[_[:lower:]][_[:alnum:]]*\)\@<![?!]\)\s*\)\@<=\%(\\\n\s*\)\@<!\%(if\|unless\)\>" end="\%(\%(\%(\.\@<!\.\)\|::\)\s*\)\@<!\<end\>" contains=ALLBUT,@rubyNotTop fold
|
else
|
||||||
|
syn region rubyBlockExpression matchgroup=rubyControl start="\<begin\>" end="\<end\>" contains=ALLBUT,@rubyNotTop
|
||||||
|
endif
|
||||||
|
|
||||||
|
if s:foldable('case')
|
||||||
|
syn region rubyCaseExpression matchgroup=rubyConditional start="\<case\>" end="\<end\>" contains=ALLBUT,@rubyNotTop fold
|
||||||
|
else
|
||||||
|
syn region rubyCaseExpression matchgroup=rubyConditional start="\<case\>" end="\<end\>" contains=ALLBUT,@rubyNotTop
|
||||||
|
endif
|
||||||
|
|
||||||
|
if s:foldable('if')
|
||||||
|
syn region rubyConditionalExpression matchgroup=rubyConditional start="\%(\%(^\|\.\.\.\=\|[{:,;([<>~\*%&^|+=-]\|\%(\<[_[:lower:]][_[:alnum:]]*\)\@<![?!]\)\s*\)\@<=\%(if\|unless\)\>" end="\%(\%(\%(\.\@1<!\.\)\|::\)\s*\)\@<!\<end\>" contains=ALLBUT,@rubyNotTop fold
|
||||||
|
else
|
||||||
|
syn region rubyConditionalExpression matchgroup=rubyConditional start="\%(\%(^\|\.\.\.\=\|[{:,;([<>~\*%&^|+=-]\|\%(\<[_[:lower:]][_[:alnum:]]*\)\@<![?!]\)\s*\)\@<=\%(if\|unless\)\>" end="\%(\%(\%(\.\@1<!\.\)\|::\)\s*\)\@<!\<end\>" contains=ALLBUT,@rubyNotTop
|
||||||
|
endif
|
||||||
|
|
||||||
syn match rubyConditional "\<\%(then\|else\|when\)\>[?!]\@!" contained containedin=rubyCaseExpression
|
syn match rubyConditional "\<\%(then\|else\|when\)\>[?!]\@!" contained containedin=rubyCaseExpression
|
||||||
syn match rubyConditional "\<\%(then\|else\|elsif\)\>[?!]\@!" contained containedin=rubyConditionalExpression
|
syn match rubyConditional "\<\%(then\|else\|elsif\)\>[?!]\@!" contained containedin=rubyConditionalExpression
|
||||||
@@ -254,7 +406,12 @@ if !exists("b:ruby_no_expensive") && !exists("ruby_no_expensive")
|
|||||||
|
|
||||||
" statements with optional 'do'
|
" statements with optional 'do'
|
||||||
syn region rubyOptionalDoLine matchgroup=rubyRepeat start="\<for\>[?!]\@!" start="\%(\%(^\|\.\.\.\=\|[{:,;([<>~\*/%&^|+-]\|\%(\<[_[:lower:]][_[:alnum:]]*\)\@<![!=?]\)\s*\)\@<=\<\%(until\|while\)\>" matchgroup=rubyOptionalDo end="\%(\<do\>\)" end="\ze\%(;\|$\)" oneline contains=ALLBUT,@rubyNotTop
|
syn region rubyOptionalDoLine matchgroup=rubyRepeat start="\<for\>[?!]\@!" start="\%(\%(^\|\.\.\.\=\|[{:,;([<>~\*/%&^|+-]\|\%(\<[_[:lower:]][_[:alnum:]]*\)\@<![!=?]\)\s*\)\@<=\<\%(until\|while\)\>" matchgroup=rubyOptionalDo end="\%(\<do\>\)" end="\ze\%(;\|$\)" oneline contains=ALLBUT,@rubyNotTop
|
||||||
syn region rubyRepeatExpression start="\<for\>[?!]\@!" start="\%(\%(^\|\.\.\.\=\|[{:,;([<>~\*/%&^|+-]\|\%(\<[_[:lower:]][_[:alnum:]]*\)\@<![!=?]\)\s*\)\@<=\<\%(until\|while\)\>" matchgroup=rubyRepeat end="\<end\>" contains=ALLBUT,@rubyNotTop nextgroup=rubyOptionalDoLine fold
|
|
||||||
|
if s:foldable('for')
|
||||||
|
syn region rubyRepeatExpression start="\<for\>[?!]\@!" start="\%(\%(^\|\.\.\.\=\|[{:,;([<>~\*/%&^|+-]\|\%(\<[_[:lower:]][_[:alnum:]]*\)\@<![!=?]\)\s*\)\@<=\<\%(until\|while\)\>" matchgroup=rubyRepeat end="\<end\>" contains=ALLBUT,@rubyNotTop nextgroup=rubyOptionalDoLine fold
|
||||||
|
else
|
||||||
|
syn region rubyRepeatExpression start="\<for\>[?!]\@!" start="\%(\%(^\|\.\.\.\=\|[{:,;([<>~\*/%&^|+-]\|\%(\<[_[:lower:]][_[:alnum:]]*\)\@<![!=?]\)\s*\)\@<=\<\%(until\|while\)\>" matchgroup=rubyRepeat end="\<end\>" contains=ALLBUT,@rubyNotTop nextgroup=rubyOptionalDoLine
|
||||||
|
endif
|
||||||
|
|
||||||
if !exists("ruby_minlines")
|
if !exists("ruby_minlines")
|
||||||
let ruby_minlines = 500
|
let ruby_minlines = 500
|
||||||
@@ -269,7 +426,7 @@ else
|
|||||||
syn match rubyKeyword "\<\%(alias\|undef\)\>[?!]\@!"
|
syn match rubyKeyword "\<\%(alias\|undef\)\>[?!]\@!"
|
||||||
endif
|
endif
|
||||||
|
|
||||||
" Special Methods
|
" Special Methods {{{1
|
||||||
if !exists("ruby_no_special_methods")
|
if !exists("ruby_no_special_methods")
|
||||||
syn keyword rubyAccess public protected private public_class_method private_class_method public_constant private_constant module_function
|
syn keyword rubyAccess public protected private public_class_method private_class_method public_constant private_constant module_function
|
||||||
" attr is a common variable name
|
" attr is a common variable name
|
||||||
@@ -284,41 +441,36 @@ if !exists("ruby_no_special_methods")
|
|||||||
syn keyword rubyKeyword callcc caller lambda proc
|
syn keyword rubyKeyword callcc caller lambda proc
|
||||||
endif
|
endif
|
||||||
|
|
||||||
" Comments and Documentation
|
" Comments and Documentation {{{1
|
||||||
syn match rubySharpBang "\%^#!.*" display
|
syn match rubySharpBang "\%^#!.*" display
|
||||||
syn keyword rubyTodo FIXME NOTE TODO OPTIMIZE HACK REVIEW XXX todo contained
|
syn keyword rubyTodo FIXME NOTE TODO OPTIMIZE HACK REVIEW XXX todo contained
|
||||||
syn match rubyComment "#.*" contains=rubySharpBang,rubySpaceError,rubyTodo,@Spell
|
syn match rubyComment "#.*" contains=rubySharpBang,rubySpaceError,rubyTodo,@Spell
|
||||||
if !exists("ruby_no_comment_fold")
|
if !exists("ruby_no_comment_fold") && s:foldable('#')
|
||||||
syn region rubyMultilineComment start="^\s*#.*\n\%(^\s*#\)\@=" end="^\s*#.*\n\%(^\s*#\)\@!" contains=rubyComment transparent fold keepend
|
syn region rubyMultilineComment start="^\s*#.*\n\%(^\s*#\)\@=" end="^\s*#.*\n\%(^\s*#\)\@!" contains=rubyComment transparent fold keepend
|
||||||
syn region rubyDocumentation start="^=begin\ze\%(\s.*\)\=$" end="^=end\%(\s.*\)\=$" contains=rubySpaceError,rubyTodo,@Spell fold
|
syn region rubyDocumentation start="^=begin\ze\%(\s.*\)\=$" end="^=end\%(\s.*\)\=$" contains=rubySpaceError,rubyTodo,@Spell fold
|
||||||
else
|
else
|
||||||
syn region rubyDocumentation start="^=begin\s*$" end="^=end\s*$" contains=rubySpaceError,rubyTodo,@Spell
|
syn region rubyDocumentation start="^=begin\s*$" end="^=end\s*$" contains=rubySpaceError,rubyTodo,@Spell
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
" Keyword Nobbling {{{1
|
||||||
" Note: this is a hack to prevent 'keywords' being highlighted as such when called as methods with an explicit receiver
|
" Note: this is a hack to prevent 'keywords' being highlighted as such when called as methods with an explicit receiver
|
||||||
syn match rubyKeywordAsMethod "\%(\%(\.\@<!\.\)\|::\)\_s*\%(alias\|and\|begin\|break\|case\|class\|def\|defined\|do\|else\)\>" transparent contains=NONE
|
syn match rubyKeywordAsMethod "\%(\%(\.\@1<!\.\)\|::\)\_s*\%([_[:lower:]][_[:alnum:]]*\|\<\%(BEGIN\|END\)\>\)" transparent contains=NONE
|
||||||
syn match rubyKeywordAsMethod "\%(\%(\.\@<!\.\)\|::\)\_s*\%(elsif\|end\|ensure\|false\|for\|if\|in\|module\|next\|nil\)\>" transparent contains=NONE
|
syn match rubyKeywordAsMethod "\(defined?\|exit!\)\@!\<[_[:lower:]][_[:alnum:]]*[?!]" transparent contains=NONE
|
||||||
syn match rubyKeywordAsMethod "\%(\%(\.\@<!\.\)\|::\)\_s*\%(not\|or\|redo\|refine\|rescue\|retry\|return\|self\|super\|then\|true\)\>" transparent contains=NONE
|
|
||||||
syn match rubyKeywordAsMethod "\%(\%(\.\@<!\.\)\|::\)\_s*\%(undef\|unless\|until\|when\|while\|yield\|BEGIN\|END\|__FILE__\|__LINE__\)\>" transparent contains=NONE
|
|
||||||
|
|
||||||
syn match rubyKeywordAsMethod "\<\%(alias\|begin\|case\|class\|def\|do\|end\)[?!]" transparent contains=NONE
|
|
||||||
syn match rubyKeywordAsMethod "\<\%(if\|module\|refine\|undef\|unless\|until\|while\)[?!]" transparent contains=NONE
|
|
||||||
|
|
||||||
syn match rubyKeywordAsMethod "\%(\%(\.\@<!\.\)\|::\)\_s*\%(abort\|at_exit\|attr\|attr_accessor\|attr_reader\)\>" transparent contains=NONE
|
|
||||||
syn match rubyKeywordAsMethod "\%(\%(\.\@<!\.\)\|::\)\_s*\%(attr_writer\|autoload\|callcc\|catch\|caller\)\>" transparent contains=NONE
|
|
||||||
syn match rubyKeywordAsMethod "\%(\%(\.\@<!\.\)\|::\)\_s*\%(eval\|class_eval\|instance_eval\|module_eval\|exit\)\>" transparent contains=NONE
|
|
||||||
syn match rubyKeywordAsMethod "\%(\%(\.\@<!\.\)\|::\)\_s*\%(extend\|fail\|fork\|include\|lambda\)\>" transparent contains=NONE
|
|
||||||
syn match rubyKeywordAsMethod "\%(\%(\.\@<!\.\)\|::\)\_s*\%(load\|loop\|prepend\|private\|proc\|protected\)\>" transparent contains=NONE
|
|
||||||
syn match rubyKeywordAsMethod "\%(\%(\.\@<!\.\)\|::\)\_s*\%(public\|require\|require_relative\|raise\|throw\|trap\|using\)\>" transparent contains=NONE
|
|
||||||
|
|
||||||
|
" More Symbols {{{1
|
||||||
syn match rubySymbol "\%([{(,]\_s*\)\@<=\l\w*[!?]\=::\@!"he=e-1
|
syn match rubySymbol "\%([{(,]\_s*\)\@<=\l\w*[!?]\=::\@!"he=e-1
|
||||||
syn match rubySymbol "[]})\"':]\@<!\%(\h\|[^\x00-\x7F]\)\%(\w\|[^\x00-\x7F]\)*[!?]\=:[[:space:],]\@="he=e-1
|
syn match rubySymbol "[]})\"':]\@1<!\%(\h\|[^\x00-\x7F]\)\%(\w\|[^\x00-\x7F]\)*[!?]\=:[[:space:],]\@="he=e-1
|
||||||
syn match rubySymbol "\%([{(,]\_s*\)\@<=[[:space:],{]\l\w*[!?]\=::\@!"hs=s+1,he=e-1
|
syn match rubySymbol "\%([{(,]\_s*\)\@<=[[:space:],{]\l\w*[!?]\=::\@!"hs=s+1,he=e-1
|
||||||
syn match rubySymbol "[[:space:],{(]\%(\h\|[^\x00-\x7F]\)\%(\w\|[^\x00-\x7F]\)*[!?]\=:[[:space:],]\@="hs=s+1,he=e-1
|
syn match rubySymbol "[[:space:],{(]\%(\h\|[^\x00-\x7F]\)\%(\w\|[^\x00-\x7F]\)*[!?]\=:[[:space:],]\@="hs=s+1,he=e-1
|
||||||
|
|
||||||
" __END__ Directive
|
" __END__ Directive {{{1
|
||||||
syn region rubyData matchgroup=rubyDataDirective start="^__END__$" end="\%$" fold
|
if s:foldable('__END__')
|
||||||
|
syn region rubyData matchgroup=rubyDataDirective start="^__END__$" end="\%$" fold
|
||||||
|
else
|
||||||
|
syn region rubyData matchgroup=rubyDataDirective start="^__END__$" end="\%$"
|
||||||
|
endif
|
||||||
|
|
||||||
|
" Default Highlighting {{{1
|
||||||
hi def link rubyClass rubyDefine
|
hi def link rubyClass rubyDefine
|
||||||
hi def link rubyModule rubyDefine
|
hi def link rubyModule rubyDefine
|
||||||
hi def link rubyMethodExceptional rubyDefine
|
hi def link rubyMethodExceptional rubyDefine
|
||||||
@@ -389,8 +541,9 @@ hi def link rubyInvalidVariable Error
|
|||||||
hi def link rubyError Error
|
hi def link rubyError Error
|
||||||
hi def link rubySpaceError rubyError
|
hi def link rubySpaceError rubyError
|
||||||
|
|
||||||
|
" Postscript {{{1
|
||||||
let b:current_syntax = "ruby"
|
let b:current_syntax = "ruby"
|
||||||
|
|
||||||
" vim: nowrap sw=2 sts=2 ts=8 noet:
|
" vim: nowrap sw=2 sts=2 ts=8 noet fdm=marker:
|
||||||
|
|
||||||
endif
|
endif
|
||||||
|
|||||||
@@ -132,7 +132,7 @@ hi link scalaKeywordModifier Function
|
|||||||
syn keyword scalaSpecial this true false ne eq
|
syn keyword scalaSpecial this true false ne eq
|
||||||
syn keyword scalaSpecial new nextgroup=scalaInstanceDeclaration skipwhite
|
syn keyword scalaSpecial new nextgroup=scalaInstanceDeclaration skipwhite
|
||||||
syn match scalaSpecial "\%(=>\|⇒\|<-\|←\|->\|→\)"
|
syn match scalaSpecial "\%(=>\|⇒\|<-\|←\|->\|→\)"
|
||||||
syn match scalaSpecial /`[^`]*`/ " Backtick literals
|
syn match scalaSpecial /`[^`]\+`/ " Backtick literals
|
||||||
hi link scalaSpecial PreProc
|
hi link scalaSpecial PreProc
|
||||||
|
|
||||||
syn keyword scalaExternal package import
|
syn keyword scalaExternal package import
|
||||||
@@ -188,8 +188,8 @@ hi link scalaTypeAnnotationParameter Function
|
|||||||
syn match scalaShebang "\%^#!.*" display
|
syn match scalaShebang "\%^#!.*" display
|
||||||
syn region scalaMultilineComment start="/\*" end="\*/" contains=scalaMultilineComment,scalaDocLinks,scalaParameterAnnotation,scalaCommentAnnotation,scalaTodo,scalaCommentCodeBlock,@Spell keepend fold
|
syn region scalaMultilineComment start="/\*" end="\*/" contains=scalaMultilineComment,scalaDocLinks,scalaParameterAnnotation,scalaCommentAnnotation,scalaTodo,scalaCommentCodeBlock,@Spell keepend fold
|
||||||
syn match scalaCommentAnnotation "@[_A-Za-z0-9$]\+" contained
|
syn match scalaCommentAnnotation "@[_A-Za-z0-9$]\+" contained
|
||||||
syn match scalaParameterAnnotation "@param" nextgroup=scalaParamAnnotationValue skipwhite contained
|
syn match scalaParameterAnnotation "\%(@tparam\|@param\|@see\)" nextgroup=scalaParamAnnotationValue skipwhite contained
|
||||||
syn match scalaParamAnnotationValue /[`_A-Za-z0-9$]\+/ contained
|
syn match scalaParamAnnotationValue /[.`_A-Za-z0-9$]\+/ contained
|
||||||
syn region scalaDocLinks start="\[\[" end="\]\]" contained
|
syn region scalaDocLinks start="\[\[" end="\]\]" contained
|
||||||
syn region scalaCommentCodeBlock matchgroup=Keyword start="{{{" end="}}}" contained
|
syn region scalaCommentCodeBlock matchgroup=Keyword start="{{{" end="}}}" contained
|
||||||
syn match scalaTodo "\vTODO|FIXME|XXX" contained
|
syn match scalaTodo "\vTODO|FIXME|XXX" contained
|
||||||
|
|||||||
@@ -68,6 +68,12 @@ syn region slimInterpolation matchgroup=slimInterpolationDelimiter start="#{" en
|
|||||||
syn region slimInterpolation matchgroup=slimInterpolationDelimiter start="#{{" end="}}" contains=@hamlRubyTop containedin=javascriptStringS,javascriptStringD,slimWrappedAttrs
|
syn region slimInterpolation matchgroup=slimInterpolationDelimiter start="#{{" end="}}" contains=@hamlRubyTop containedin=javascriptStringS,javascriptStringD,slimWrappedAttrs
|
||||||
syn match slimInterpolationEscape "\\\@<!\%(\\\\\)*\\\%(\\\ze#{\|#\ze{\)"
|
syn match slimInterpolationEscape "\\\@<!\%(\\\\\)*\\\%(\\\ze#{\|#\ze{\)"
|
||||||
|
|
||||||
|
syn region slimPlainFilter matchgroup=slimFilter start="^\z(\s*\)\%(rdoc\|textile\|markdown\|wiki\):\s*$" end="^\%(\z1 \| *$\)\@!"
|
||||||
|
syn region slimJavascriptFilter matchgroup=slimFilter start="^\z(\s*\)javascript:\s*$" end="^\%(\z1 \| *$\)\@!" contains=@htmlJavaScript,slimInterpolation keepend
|
||||||
|
syn region slimCoffeeFilter matchgroup=slimFilter start="^\z(\s*\)coffee:\s*$" end="^\%(\z1 \| *$\)\@!" contains=@coffeeAll,slimInterpolation keepend
|
||||||
|
syn region slimCSSFilter matchgroup=slimFilter start="^\z(\s*\)css:\s*$" end="^\%(\z1 \| *$\)\@!" contains=@htmlCss,slimInterpolation keepend
|
||||||
|
syn region slimSassFilter matchgroup=slimFilter start="^\z(\s*\)sass:\s*$" end="^\%(\z1 \| *$\)\@!" contains=@hamlSassTop
|
||||||
|
|
||||||
syn region slimRuby matchgroup=slimRubyOutputChar start="\s*[=]\==[']\=" skip="\%\(,\s*\|\\\)$" end="$" contained contains=@slimRubyTop keepend
|
syn region slimRuby matchgroup=slimRubyOutputChar start="\s*[=]\==[']\=" skip="\%\(,\s*\|\\\)$" end="$" contained contains=@slimRubyTop keepend
|
||||||
syn region slimRuby matchgroup=slimRubyChar start="\s*-" skip="\%\(,\s*\|\\\)$" end="$" contained contains=@slimRubyTop keepend
|
syn region slimRuby matchgroup=slimRubyChar start="\s*-" skip="\%\(,\s*\|\\\)$" end="$" contained contains=@slimRubyTop keepend
|
||||||
|
|
||||||
@@ -100,6 +106,7 @@ hi def link slimTodo Todo
|
|||||||
hi def link slimWrappedAttrValueDelimiter Delimiter
|
hi def link slimWrappedAttrValueDelimiter Delimiter
|
||||||
hi def link slimWrappedAttrsDelimiter Delimiter
|
hi def link slimWrappedAttrsDelimiter Delimiter
|
||||||
hi def link slimInlineTagChar Delimiter
|
hi def link slimInlineTagChar Delimiter
|
||||||
|
hi def link slimFilter PreProc
|
||||||
|
|
||||||
let b:current_syntax = "slim"
|
let b:current_syntax = "slim"
|
||||||
|
|
||||||
|
|||||||
@@ -64,9 +64,9 @@ syntax match swiftNumber "\v<\d+>"
|
|||||||
syntax match swiftNumber "\v<(\d+_+)+\d+(\.\d+(_+\d+)*)?>"
|
syntax match swiftNumber "\v<(\d+_+)+\d+(\.\d+(_+\d+)*)?>"
|
||||||
syntax match swiftNumber "\v<\d+\.\d+>"
|
syntax match swiftNumber "\v<\d+\.\d+>"
|
||||||
syntax match swiftNumber "\v<\d*\.?\d+([Ee]-?)?\d+>"
|
syntax match swiftNumber "\v<\d*\.?\d+([Ee]-?)?\d+>"
|
||||||
syntax match swiftNumber "\v<0x\x+([Pp]-?)?\x+>"
|
syntax match swiftNumber "\v<0x[[:xdigit:]_]+([Pp]-?)?\x+>"
|
||||||
syntax match swiftNumber "\v<0b[01]+>"
|
syntax match swiftNumber "\v<0b[01_]+>"
|
||||||
syntax match swiftNumber "\v<0o\o+>"
|
syntax match swiftNumber "\v<0o[0-7_]+>"
|
||||||
|
|
||||||
" BOOLs
|
" BOOLs
|
||||||
syntax keyword swiftBoolean
|
syntax keyword swiftBoolean
|
||||||
|
|||||||
Reference in New Issue
Block a user