mirror of
https://github.com/sheerun/vim-polyglot.git
synced 2025-11-09 03:53:52 -05:00
Compare commits
19 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
30c1920e4f | ||
|
|
57cfac7ae3 | ||
|
|
085aad28a4 | ||
|
|
e108a087b4 | ||
|
|
b3257271db | ||
|
|
e9d8c39608 | ||
|
|
04e6a8a73c | ||
|
|
b6a2261cc2 | ||
|
|
811fe888a6 | ||
|
|
2b19388166 | ||
|
|
a531f6b104 | ||
|
|
90d87abd30 | ||
|
|
d6710f1b57 | ||
|
|
0db9bdbfd6 | ||
|
|
c069f0661a | ||
|
|
235a5631f9 | ||
|
|
edf1aa4a1c | ||
|
|
88bd82d6c9 | ||
|
|
2686fb60f4 |
4
.gitattributes
vendored
4
.gitattributes
vendored
@@ -2,3 +2,7 @@
|
|||||||
.gitattributes export-ignore
|
.gitattributes export-ignore
|
||||||
build export-ignore
|
build export-ignore
|
||||||
README.md export-ignore
|
README.md export-ignore
|
||||||
|
/spec export-ignore
|
||||||
|
Gemfile export-ignore
|
||||||
|
Gemfile.lock export-ignore
|
||||||
|
.travis.yml export-ignore
|
||||||
|
|||||||
@@ -33,6 +33,7 @@ Optionally download one of the [releases](https://github.com/sheerun/vim-polyglo
|
|||||||
- [css-color](https://github.com/ap/vim-css-color) (syntax)
|
- [css-color](https://github.com/ap/vim-css-color) (syntax)
|
||||||
- [csv](https://github.com/chrisbra/csv.vim) (syntax, ftplugin, ftdetect)
|
- [csv](https://github.com/chrisbra/csv.vim) (syntax, ftplugin, ftdetect)
|
||||||
- [cucumber](https://github.com/tpope/vim-cucumber) (syntax, indent, compiler, ftplugin, ftdetect)
|
- [cucumber](https://github.com/tpope/vim-cucumber) (syntax, indent, compiler, ftplugin, ftdetect)
|
||||||
|
- [dockerfile](https://github.com/honza/dockerfile.vim) (syntax, ftdetect)
|
||||||
- [elixir](https://github.com/elixir-lang/vim-elixir) (syntax, indent, compiler, ftplugin, ftdetect)
|
- [elixir](https://github.com/elixir-lang/vim-elixir) (syntax, indent, compiler, ftplugin, ftdetect)
|
||||||
- [erlang](https://github.com/oscarh/vimerl) (syntax, indent, compiler, autoload, ftplugin)
|
- [erlang](https://github.com/oscarh/vimerl) (syntax, indent, compiler, autoload, ftplugin)
|
||||||
- [git](https://github.com/tpope/vim-git) (syntax, indent, ftplugin, ftdetect)
|
- [git](https://github.com/tpope/vim-git) (syntax, indent, ftplugin, ftdetect)
|
||||||
@@ -51,12 +52,15 @@ Optionally download one of the [releases](https://github.com/sheerun/vim-polyglo
|
|||||||
- [nginx](https://github.com/mutewinter/nginx.vim) (syntax, ftdetect)
|
- [nginx](https://github.com/mutewinter/nginx.vim) (syntax, ftdetect)
|
||||||
- [ocaml](https://github.com/jrk/vim-ocaml) (syntax, indent, ftplugin)
|
- [ocaml](https://github.com/jrk/vim-ocaml) (syntax, indent, ftplugin)
|
||||||
- [octave](https://github.com/vim-scripts/octave.vim--) (syntax)
|
- [octave](https://github.com/vim-scripts/octave.vim--) (syntax)
|
||||||
|
- [perl](https://github.com/vim-perl/vim-perl) (syntax, indent, ftplugin)
|
||||||
- [php](https://github.com/StanAngeloff/php.vim) (syntax)
|
- [php](https://github.com/StanAngeloff/php.vim) (syntax)
|
||||||
- [puppet](https://github.com/ajf/puppet-vim) (syntax, indent, ftplugin, ftdetect)
|
- [puppet](https://github.com/ajf/puppet-vim) (syntax, indent, ftplugin, ftdetect)
|
||||||
- [protobuf](https://github.com/uarun/vim-protobuf) (syntax, ftdetect)
|
- [protobuf](https://github.com/uarun/vim-protobuf) (syntax, ftdetect)
|
||||||
- [python](https://github.com/vim-scripts/python.vim--Vasiliev) (syntax)
|
- [python](https://github.com/vim-scripts/python.vim--Vasiliev) (syntax)
|
||||||
- [rspec](https://github.com/skwp/vim-rspec) (syntax)
|
- [r-lang](https://github.com/vim-scripts/R.vim) (syntax, ftplugin)
|
||||||
|
- [rspec](https://github.com/sheerun/rspec.vim) (syntax, ftdetect)
|
||||||
- [ruby](https://github.com/vim-ruby/vim-ruby) (syntax, indent, compiler, autoload, ftplugin, ftdetect)
|
- [ruby](https://github.com/vim-ruby/vim-ruby) (syntax, indent, compiler, autoload, ftplugin, ftdetect)
|
||||||
|
- [rust](https://github.com/wting/rust.vim) (syntax, indent, compiler, 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, ftplugin, ftdetect)
|
- [scala](https://github.com/derekwyatt/vim-scala) (syntax, indent, ftplugin, ftdetect)
|
||||||
- [slim](https://github.com/slim-template/vim-slim) (syntax, indent, ftdetect)
|
- [slim](https://github.com/slim-template/vim-slim) (syntax, indent, ftdetect)
|
||||||
@@ -64,6 +68,7 @@ Optionally download one of the [releases](https://github.com/sheerun/vim-polyglo
|
|||||||
- [textile](https://github.com/timcharper/textile.vim) (syntax, ftplugin, ftdetect)
|
- [textile](https://github.com/timcharper/textile.vim) (syntax, ftplugin, ftdetect)
|
||||||
- [tmux](https://github.com/acustodioo/vim-tmux) (syntax, ftdetect)
|
- [tmux](https://github.com/acustodioo/vim-tmux) (syntax, ftdetect)
|
||||||
- [tomdoc](https://github.com/duwanis/tomdoc.vim) (syntax)
|
- [tomdoc](https://github.com/duwanis/tomdoc.vim) (syntax)
|
||||||
|
- [typescript](https://github.com/leafgarland/typescript-vim) (syntax, compiler, ftplugin, ftdetect)
|
||||||
- [vbnet](https://github.com/vim-scripts/vbnet.vim) (syntax)
|
- [vbnet](https://github.com/vim-scripts/vbnet.vim) (syntax)
|
||||||
- [twig](https://github.com/beyondwords/vim-twig) (syntax, ftplugin, ftdetect)
|
- [twig](https://github.com/beyondwords/vim-twig) (syntax, ftplugin, ftdetect)
|
||||||
- [xls](https://github.com/vim-scripts/XSLT-syntax) (syntax)
|
- [xls](https://github.com/vim-scripts/XSLT-syntax) (syntax)
|
||||||
|
|||||||
@@ -4,12 +4,12 @@
|
|||||||
" License: WTFPL
|
" License: WTFPL
|
||||||
|
|
||||||
" Load the coffee and html indent functions.
|
" Load the coffee and html indent functions.
|
||||||
unlet b:did_indent
|
silent! unlet b:did_indent
|
||||||
runtime indent/coffee.vim
|
runtime indent/coffee.vim
|
||||||
let s:coffeeIndentExpr = &l:indentexpr
|
let s:coffeeIndentExpr = &l:indentexpr
|
||||||
|
|
||||||
" Load html last so it can overwrite coffee settings.
|
" Load html last so it can overwrite coffee settings.
|
||||||
unlet b:did_indent
|
silent! unlet b:did_indent
|
||||||
runtime indent/html.vim
|
runtime indent/html.vim
|
||||||
let s:htmlIndentExpr = &l:indentexpr
|
let s:htmlIndentExpr = &l:indentexpr
|
||||||
|
|
||||||
|
|||||||
@@ -97,6 +97,7 @@ if has("gui_running") || &t_Co==256
|
|||||||
if out !~ '^cssDefinition ' | continue | endif
|
if out !~ '^cssDefinition ' | continue | endif
|
||||||
let out = substitute( out, ' \+xxx \+', ' ', '' )
|
let out = substitute( out, ' \+xxx \+', ' ', '' )
|
||||||
let out = substitute( out, ' contains=\zs', '@cssColors,', '' )
|
let out = substitute( out, ' contains=\zs', '@cssColors,', '' )
|
||||||
|
syn clear cssDefinition
|
||||||
exe 'syn region' out
|
exe 'syn region' out
|
||||||
endfor
|
endfor
|
||||||
endif
|
endif
|
||||||
|
|||||||
33
after/syntax/rust.vim
Normal file
33
after/syntax/rust.vim
Normal file
@@ -0,0 +1,33 @@
|
|||||||
|
if !exists('g:rust_conceal') || !has('conceal') || &enc != 'utf-8'
|
||||||
|
finish
|
||||||
|
endif
|
||||||
|
|
||||||
|
" For those who don't want to see `::`...
|
||||||
|
if exists('g:rust_conceal_mod_path')
|
||||||
|
syn match rustNiceOperator "::" conceal cchar=ㆍ
|
||||||
|
endif
|
||||||
|
|
||||||
|
syn match rustRightArrowHead contained ">" conceal cchar=
|
||||||
|
syn match rustRightArrowTail contained "-" conceal cchar=⟶
|
||||||
|
syn match rustNiceOperator "->" contains=rustRightArrowHead,rustRightArrowTail
|
||||||
|
|
||||||
|
syn match rustFatRightArrowHead contained ">" conceal cchar=
|
||||||
|
syn match rustFatRightArrowTail contained "=" conceal cchar=⟹
|
||||||
|
syn match rustNiceOperator "=>" contains=rustFatRightArrowHead,rustFatRightArrowTail
|
||||||
|
|
||||||
|
syn match rustNiceOperator /\<\@!_\(_*\>\)\@=/ conceal cchar=′
|
||||||
|
|
||||||
|
" For those who don't want to see `pub`...
|
||||||
|
if exists('g:rust_conceal_pub')
|
||||||
|
syn match rustPublicSigil contained "pu" conceal cchar=*
|
||||||
|
syn match rustPublicRest contained "b" conceal cchar=
|
||||||
|
syn match rustNiceOperator "pub " contains=rustPublicSigil,rustPublicRest
|
||||||
|
endif
|
||||||
|
|
||||||
|
hi link rustNiceOperator Operator
|
||||||
|
|
||||||
|
if !exists('g:rust_conceal_mod_path')
|
||||||
|
hi! link Conceal Operator
|
||||||
|
endif
|
||||||
|
|
||||||
|
setlocal conceallevel=2
|
||||||
@@ -1,2 +1,4 @@
|
|||||||
" adds support for cleverref package (`\cref` and `\Cref`)
|
" adds support for cleverref package
|
||||||
syn region texRefZone matchgroup=texStatement start="\\\(c\|C\)ref{" end="}\|%stopzone\>" contains=@texRefGroup
|
" \Cref, \cref, \cpageref, \labelcref, \labelcpageref
|
||||||
|
syn region texRefZone matchgroup=texStatement start="\\Cref{" end="}\|%stopzone\>" contains=@texRefGroup
|
||||||
|
syn region texRefZone matchgroup=texStatement start="\\\(label\|\)c\(page\|\)ref{" end="}\|%stopzone\>" contains=@texRefGroup
|
||||||
|
|||||||
@@ -28,43 +28,75 @@ if len(s:goarch) == 0
|
|||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
function! go#complete#PackageMembers(package, member)
|
||||||
|
silent! let content = system('godoc ' . a:package)
|
||||||
|
if v:shell_error || !len(content)
|
||||||
|
return []
|
||||||
|
endif
|
||||||
|
let lines = filter(split(content, "\n"),"v:val !~ '^\\s\\+$'")
|
||||||
|
try
|
||||||
|
let mx1 = '^\s\+\(\S+\)\s\+=\s\+.*'
|
||||||
|
let mx2 = '^\%(const\|var\|type\|func\) \([A-Z][^ (]\+\).*'
|
||||||
|
let candidates =
|
||||||
|
\ map(filter(copy(lines), 'v:val =~ mx1'), 'substitute(v:val, mx1, "\\1", "")')
|
||||||
|
\ + map(filter(copy(lines), 'v:val =~ mx2'), 'substitute(v:val, mx2, "\\1", "")')
|
||||||
|
return filter(candidates, '!stridx(v:val, a:member)')
|
||||||
|
catch
|
||||||
|
return []
|
||||||
|
endtry
|
||||||
|
endfunction
|
||||||
|
|
||||||
function! go#complete#Package(ArgLead, CmdLine, CursorPos)
|
function! go#complete#Package(ArgLead, CmdLine, CursorPos)
|
||||||
let dirs = []
|
let dirs = []
|
||||||
|
|
||||||
|
let words = split(a:CmdLine, '\s\+', 1)
|
||||||
|
if len(words) > 2
|
||||||
|
" Complete package members
|
||||||
|
return go#complete#PackageMembers(words[1], words[2])
|
||||||
|
endif
|
||||||
|
|
||||||
if executable('go')
|
if executable('go')
|
||||||
let goroot = substitute(system('go env GOROOT'), '\n', '', 'g')
|
let goroot = substitute(system('go env GOROOT'), '\n', '', 'g')
|
||||||
if v:shell_error
|
if v:shell_error
|
||||||
echo '\'go env GOROOT\' failed'
|
echomsg '\'go env GOROOT\' failed'
|
||||||
endif
|
endif
|
||||||
else
|
else
|
||||||
let goroot = $GOROOT
|
let goroot = $GOROOT
|
||||||
endif
|
endif
|
||||||
|
|
||||||
if len(goroot) != 0 && isdirectory(goroot)
|
if len(goroot) != 0 && isdirectory(goroot)
|
||||||
let dirs += [ goroot ]
|
let dirs += [goroot]
|
||||||
endif
|
endif
|
||||||
|
|
||||||
let workspaces = split($GOPATH, ':')
|
let pathsep = ':'
|
||||||
|
if s:goos == 'windows'
|
||||||
|
let pathsep = ';'
|
||||||
|
endif
|
||||||
|
let workspaces = split($GOPATH, pathsep)
|
||||||
if workspaces != []
|
if workspaces != []
|
||||||
let dirs += workspaces
|
let dirs += workspaces
|
||||||
endif
|
endif
|
||||||
|
|
||||||
if len(dirs) == 0
|
if len(dirs) == 0
|
||||||
" should not happen
|
" should not happen
|
||||||
return []
|
return []
|
||||||
endif
|
endif
|
||||||
|
|
||||||
let ret = {}
|
let ret = {}
|
||||||
for dir in dirs
|
for dir in dirs
|
||||||
let root = expand(dir . '/pkg/' . s:goos . '_' . s:goarch)
|
" this may expand to multiple lines
|
||||||
for i in split(globpath(root, a:ArgLead.'*'), "\n")
|
let root = split(expand(dir . '/pkg/' . s:goos . '_' . s:goarch), "\n")
|
||||||
if isdirectory(i)
|
call add(root, expand(dir . '/src'))
|
||||||
let i .= '/'
|
for r in root
|
||||||
elseif i !~ '\.a$'
|
for i in split(globpath(r, a:ArgLead.'*'), "\n")
|
||||||
continue
|
if isdirectory(i)
|
||||||
endif
|
let i .= '/'
|
||||||
let i = substitute(substitute(i[len(root)+1:], '[\\]', '/', 'g'), '\.a$', '', 'g')
|
elseif i !~ '\.a$'
|
||||||
let ret[i] = i
|
continue
|
||||||
|
endif
|
||||||
|
let i = substitute(substitute(i[len(r)+1:], '[\\]', '/', 'g'), '\.a$', '', 'g')
|
||||||
|
let ret[i] = i
|
||||||
|
endfor
|
||||||
endfor
|
endfor
|
||||||
endfor
|
endfor
|
||||||
return sort(keys(ret))
|
return sort(keys(ret))
|
||||||
|
|||||||
5
build
5
build
@@ -73,6 +73,7 @@ PACKS="
|
|||||||
css-color:ap/vim-css-color
|
css-color:ap/vim-css-color
|
||||||
csv:chrisbra/csv.vim
|
csv:chrisbra/csv.vim
|
||||||
cucumber:tpope/vim-cucumber
|
cucumber:tpope/vim-cucumber
|
||||||
|
dockerfile:honza/dockerfile.vim
|
||||||
elixir:elixir-lang/vim-elixir
|
elixir:elixir-lang/vim-elixir
|
||||||
erlang:oscarh/vimerl
|
erlang:oscarh/vimerl
|
||||||
git:tpope/vim-git
|
git:tpope/vim-git
|
||||||
@@ -91,12 +92,15 @@ PACKS="
|
|||||||
nginx:mutewinter/nginx.vim
|
nginx:mutewinter/nginx.vim
|
||||||
ocaml:jrk/vim-ocaml
|
ocaml:jrk/vim-ocaml
|
||||||
octave:vim-scripts/octave.vim--
|
octave:vim-scripts/octave.vim--
|
||||||
|
perl:vim-perl/vim-perl
|
||||||
php:StanAngeloff/php.vim
|
php:StanAngeloff/php.vim
|
||||||
puppet:ajf/puppet-vim
|
puppet:ajf/puppet-vim
|
||||||
protobuf:uarun/vim-protobuf
|
protobuf:uarun/vim-protobuf
|
||||||
python:vim-scripts/python.vim--Vasiliev
|
python:vim-scripts/python.vim--Vasiliev
|
||||||
|
r-lang:vim-scripts/R.vim
|
||||||
rspec:sheerun/rspec.vim
|
rspec:sheerun/rspec.vim
|
||||||
ruby:vim-ruby/vim-ruby
|
ruby:vim-ruby/vim-ruby
|
||||||
|
rust:wting/rust.vim
|
||||||
sbt:derekwyatt/vim-sbt
|
sbt:derekwyatt/vim-sbt
|
||||||
scala:derekwyatt/vim-scala
|
scala:derekwyatt/vim-scala
|
||||||
slim:slim-template/vim-slim
|
slim:slim-template/vim-slim
|
||||||
@@ -104,6 +108,7 @@ PACKS="
|
|||||||
textile:timcharper/textile.vim
|
textile:timcharper/textile.vim
|
||||||
tmux:acustodioo/vim-tmux
|
tmux:acustodioo/vim-tmux
|
||||||
tomdoc:duwanis/tomdoc.vim
|
tomdoc:duwanis/tomdoc.vim
|
||||||
|
typescript:leafgarland/typescript-vim
|
||||||
vbnet:vim-scripts/vbnet.vim
|
vbnet:vim-scripts/vbnet.vim
|
||||||
twig:beyondwords/vim-twig
|
twig:beyondwords/vim-twig
|
||||||
xls:vim-scripts/XSLT-syntax
|
xls:vim-scripts/XSLT-syntax
|
||||||
|
|||||||
@@ -27,8 +27,8 @@ function! s:GetMakePrg()
|
|||||||
\ ' -c' .
|
\ ' -c' .
|
||||||
\ ' ' . b:coffee_litcoffee .
|
\ ' ' . b:coffee_litcoffee .
|
||||||
\ ' ' . g:coffee_make_options .
|
\ ' ' . g:coffee_make_options .
|
||||||
\ ' ' . fnameescape(expand('%')) .
|
\ ' $*' .
|
||||||
\ ' $*'
|
\ ' ' . fnameescape(expand('%'))
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
" Set `makeprg` and return 1 if coffee is still the compiler, else return 0.
|
" Set `makeprg` and return 1 if coffee is still the compiler, else return 0.
|
||||||
|
|||||||
33
compiler/rustc.vim
Normal file
33
compiler/rustc.vim
Normal file
@@ -0,0 +1,33 @@
|
|||||||
|
" Vim compiler file
|
||||||
|
" Compiler: Rust Compiler
|
||||||
|
" Maintainer: Chris Morgan <me@chrismorgan.info>
|
||||||
|
" Latest Revision: 2013 Jul 12
|
||||||
|
|
||||||
|
if exists("current_compiler")
|
||||||
|
finish
|
||||||
|
endif
|
||||||
|
let current_compiler = "rustc"
|
||||||
|
|
||||||
|
let s:cpo_save = &cpo
|
||||||
|
set cpo&vim
|
||||||
|
|
||||||
|
if exists(":CompilerSet") != 2
|
||||||
|
command -nargs=* CompilerSet setlocal <args>
|
||||||
|
endif
|
||||||
|
|
||||||
|
if exists("g:rustc_makeprg_no_percent") && g:rustc_makeprg_no_percent == 1
|
||||||
|
CompilerSet makeprg=rustc
|
||||||
|
else
|
||||||
|
CompilerSet makeprg=rustc\ \%
|
||||||
|
endif
|
||||||
|
|
||||||
|
CompilerSet errorformat=
|
||||||
|
\%f:%l:%c:\ %t%*[^:]:\ %m,
|
||||||
|
\%f:%l:%c:\ %*\\d:%*\\d\ %t%*[^:]:\ %m,
|
||||||
|
\%-G%f:%l\ %s,
|
||||||
|
\%-G%*[\ ]^,
|
||||||
|
\%-G%*[\ ]^%*[~],
|
||||||
|
\%-G%*[\ ]...
|
||||||
|
|
||||||
|
let &cpo = s:cpo_save
|
||||||
|
unlet s:cpo_save
|
||||||
8
compiler/typescript.vim
Normal file
8
compiler/typescript.vim
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
if exists("current_compiler")
|
||||||
|
finish
|
||||||
|
endif
|
||||||
|
let current_compiler = "typescript"
|
||||||
|
|
||||||
|
CompilerSet makeprg=tsc\ $*\ %
|
||||||
|
|
||||||
|
CompilerSet errorformat=%+A\ %#%f\ %#(%l\\\,%c):\ %m,%C%m
|
||||||
@@ -12,6 +12,7 @@ endfunction
|
|||||||
autocmd BufNewFile,BufRead * call s:DetectCoffee()
|
autocmd BufNewFile,BufRead * call s:DetectCoffee()
|
||||||
au BufRead,BufNewFile *.csv,*.dat,*.tsv,*.tab set filetype=csv
|
au BufRead,BufNewFile *.csv,*.dat,*.tsv,*.tab set filetype=csv
|
||||||
autocmd BufNewFile,BufReadPost *.feature,*.story set filetype=cucumber
|
autocmd BufNewFile,BufReadPost *.feature,*.story set filetype=cucumber
|
||||||
|
au BufNewFile,BufRead Dockerfile set filetype=dockerfile
|
||||||
au BufRead,BufNewFile *.ex,*.exs set filetype=elixir
|
au BufRead,BufNewFile *.ex,*.exs set filetype=elixir
|
||||||
au FileType elixir setl sw=2 sts=2 et iskeyword+=!,?
|
au FileType elixir setl sw=2 sts=2 et iskeyword+=!,?
|
||||||
autocmd BufNewFile,BufRead *.git/{,modules/**/}{COMMIT_EDIT,MERGE_}MSG set ft=gitcommit
|
autocmd BufNewFile,BufRead *.git/{,modules/**/}{COMMIT_EDIT,MERGE_}MSG set ft=gitcommit
|
||||||
@@ -50,7 +51,7 @@ autocmd BufNewFile,BufRead *.haml,*.hamlbars setf haml
|
|||||||
autocmd BufNewFile,BufRead *.sass setf sass
|
autocmd BufNewFile,BufRead *.sass setf sass
|
||||||
autocmd BufNewFile,BufRead *.scss setf scss
|
autocmd BufNewFile,BufRead *.scss setf scss
|
||||||
if has("autocmd")
|
if has("autocmd")
|
||||||
au BufNewFile,BufRead *.{handlebars,hb,hbs,hbt}{,.erb} set ft=html syntax=handlebars | runtime! ftplugin/handlebars.vim ftplugin/handlebars*.vim ftplugin/handlebars/*.vim
|
au BufNewFile,BufRead *.{handlebars,hb,hbs,hbt}{,.erb} set ft=handlebars.html syntax=handlebars | runtime! ftplugin/handlebars.vim ftplugin/handlebars*.vim ftplugin/handlebars/*.vim
|
||||||
endif
|
endif
|
||||||
autocmd BufNewFile,BufReadPost *.jade set filetype=jade
|
autocmd BufNewFile,BufReadPost *.jade set filetype=jade
|
||||||
au BufNewFile,BufRead *.js setf javascript
|
au BufNewFile,BufRead *.js setf javascript
|
||||||
@@ -104,6 +105,7 @@ au BufNewFile,BufRead *.jbuilder set filetype=ruby
|
|||||||
au BufNewFile,BufRead Puppetfile set filetype=ruby
|
au BufNewFile,BufRead Puppetfile set filetype=ruby
|
||||||
au BufNewFile,BufRead [Bb]uildfile set filetype=ruby
|
au BufNewFile,BufRead [Bb]uildfile set filetype=ruby
|
||||||
au BufNewFile,BufRead Appraisals set filetype=ruby
|
au BufNewFile,BufRead Appraisals set filetype=ruby
|
||||||
|
au BufRead,BufNewFile *.rs,*.rc set filetype=rust
|
||||||
au BufRead,BufNewFile *.sbt set filetype=sbt
|
au BufRead,BufNewFile *.sbt set filetype=sbt
|
||||||
fun! s:DetectScala()
|
fun! s:DetectScala()
|
||||||
if getline(1) == '#!/usr/bin/env scala'
|
if getline(1) == '#!/usr/bin/env scala'
|
||||||
@@ -119,3 +121,4 @@ au BufRead,BufNewFile *.textile set filetype=textile
|
|||||||
autocmd BufNewFile,BufRead .tmux.conf*,tmux.conf* setf tmux
|
autocmd BufNewFile,BufRead .tmux.conf*,tmux.conf* setf tmux
|
||||||
autocmd BufNewFile,BufRead *.twig set filetype=twig
|
autocmd BufNewFile,BufRead *.twig set filetype=twig
|
||||||
autocmd BufNewFile,BufRead *.html.twig set filetype=html.twig
|
autocmd BufNewFile,BufRead *.html.twig set filetype=html.twig
|
||||||
|
autocmd BufNewFile,BufRead *.ts setlocal filetype=typescript
|
||||||
|
|||||||
@@ -11,10 +11,10 @@
|
|||||||
" though, implementation differs.
|
" though, implementation differs.
|
||||||
|
|
||||||
" Plugin folklore "{{{2
|
" Plugin folklore "{{{2
|
||||||
if v:version < 700 || exists('b:did_ftplugin')
|
if v:version < 700 || exists('b:did_csv_ftplugin')
|
||||||
finish
|
finish
|
||||||
endif
|
endif
|
||||||
let b:did_ftplugin = 1
|
let b:did_csv_ftplugin = 1
|
||||||
|
|
||||||
let s:cpo_save = &cpo
|
let s:cpo_save = &cpo
|
||||||
set cpo&vim
|
set cpo&vim
|
||||||
|
|||||||
@@ -12,11 +12,25 @@
|
|||||||
" It tries to preserve cursor position and avoids
|
" It tries to preserve cursor position and avoids
|
||||||
" replacing the buffer with stderr output.
|
" replacing the buffer with stderr output.
|
||||||
"
|
"
|
||||||
|
" Options:
|
||||||
|
"
|
||||||
|
" g:go_fmt_commands [default=1]
|
||||||
|
"
|
||||||
|
" Flag to indicate whether to enable the commands listed above.
|
||||||
|
"
|
||||||
if exists("b:did_ftplugin_go_fmt")
|
if exists("b:did_ftplugin_go_fmt")
|
||||||
finish
|
finish
|
||||||
endif
|
endif
|
||||||
|
|
||||||
command! -buffer Fmt call s:GoFormat()
|
|
||||||
|
if !exists("g:go_fmt_commands")
|
||||||
|
let g:go_fmt_commands = 1
|
||||||
|
endif
|
||||||
|
|
||||||
|
|
||||||
|
if g:go_fmt_commands
|
||||||
|
command! -buffer Fmt call s:GoFormat()
|
||||||
|
endif
|
||||||
|
|
||||||
function! s:GoFormat()
|
function! s:GoFormat()
|
||||||
let view = winsaveview()
|
let view = winsaveview()
|
||||||
|
|||||||
@@ -24,23 +24,40 @@
|
|||||||
" imported, an error will be displayed and the buffer will be
|
" imported, an error will be displayed and the buffer will be
|
||||||
" untouched.
|
" untouched.
|
||||||
"
|
"
|
||||||
" In addition to these commands, there are also two shortcuts mapped:
|
" If you would like to add shortcuts, you can do so by doing the following:
|
||||||
"
|
"
|
||||||
" \f - Runs :Import fmt
|
" Import fmt
|
||||||
" \F - Runs :Drop fmt
|
" au Filetype go nnoremap <buffer> <LocalLeader>f :Import fmt<CR>
|
||||||
"
|
"
|
||||||
" The backslash is the default maplocalleader, so it is possible that
|
" Drop fmt
|
||||||
|
" au Filetype go nnoremap <buffer> <LocalLeader>F :Drop fmt<CR>
|
||||||
|
"
|
||||||
|
" Import the word under your cursor
|
||||||
|
" au Filetype go nnoremap <buffer> <LocalLeader>k
|
||||||
|
" \ :exe 'Import ' . expand('<cword>')<CR>
|
||||||
|
"
|
||||||
|
" The backslash '\' is the default maplocalleader, so it is possible that
|
||||||
" your vim is set to use a different character (:help maplocalleader).
|
" your vim is set to use a different character (:help maplocalleader).
|
||||||
"
|
"
|
||||||
|
" Options:
|
||||||
|
"
|
||||||
|
" g:go_import_commands [default=1]
|
||||||
|
"
|
||||||
|
" Flag to indicate whether to enable the commands listed above.
|
||||||
|
"
|
||||||
if exists("b:did_ftplugin_go_import")
|
if exists("b:did_ftplugin_go_import")
|
||||||
finish
|
finish
|
||||||
endif
|
endif
|
||||||
|
|
||||||
command! -buffer -nargs=? -complete=customlist,go#complete#Package Drop call s:SwitchImport(0, '', <f-args>)
|
if !exists("g:go_import_commands")
|
||||||
command! -buffer -nargs=1 -complete=customlist,go#complete#Package Import call s:SwitchImport(1, '', <f-args>)
|
let g:go_import_commands = 1
|
||||||
command! -buffer -nargs=* -complete=customlist,go#complete#Package ImportAs call s:SwitchImport(1, <f-args>)
|
endif
|
||||||
map <buffer> <LocalLeader>f :Import fmt<CR>
|
|
||||||
map <buffer> <LocalLeader>F :Drop fmt<CR>
|
if g:go_import_commands
|
||||||
|
command! -buffer -nargs=? -complete=customlist,go#complete#Package Drop call s:SwitchImport(0, '', <f-args>)
|
||||||
|
command! -buffer -nargs=1 -complete=customlist,go#complete#Package Import call s:SwitchImport(1, '', <f-args>)
|
||||||
|
command! -buffer -nargs=* -complete=customlist,go#complete#Package ImportAs call s:SwitchImport(1, <f-args>)
|
||||||
|
endif
|
||||||
|
|
||||||
function! s:SwitchImport(enabled, localname, path)
|
function! s:SwitchImport(enabled, localname, path)
|
||||||
let view = winsaveview()
|
let view = winsaveview()
|
||||||
|
|||||||
@@ -45,6 +45,8 @@ endif
|
|||||||
|
|
||||||
setlocal comments=://-,:// commentstring=//\ %s
|
setlocal comments=://-,:// commentstring=//\ %s
|
||||||
|
|
||||||
|
setlocal suffixesadd=.jade
|
||||||
|
|
||||||
let b:undo_ftplugin = "setl cms< com< "
|
let b:undo_ftplugin = "setl cms< com< "
|
||||||
\ " | unlet! b:browsefilter b:match_words | " . s:undo_ftplugin
|
\ " | unlet! b:browsefilter b:match_words | " . s:undo_ftplugin
|
||||||
|
|
||||||
|
|||||||
@@ -3,6 +3,7 @@
|
|||||||
" Error Format {{{
|
" Error Format {{{
|
||||||
" Note: The error formats assume we're using the -file-line-error with
|
" Note: The error formats assume we're using the -file-line-error with
|
||||||
" [pdf]latex.
|
" [pdf]latex.
|
||||||
|
" Note: See |errorformat-LaTeX| for more info.
|
||||||
|
|
||||||
" Check for options
|
" Check for options
|
||||||
if !exists("g:LatexBox_show_warnings")
|
if !exists("g:LatexBox_show_warnings")
|
||||||
@@ -15,9 +16,14 @@ if !exists("g:LatexBox_ignore_warnings")
|
|||||||
\ 'specifier changed to']
|
\ 'specifier changed to']
|
||||||
endif
|
endif
|
||||||
|
|
||||||
" See |errorformat-LaTeX|
|
" Standard error message formats
|
||||||
|
" Note: We consider statements that starts with "!" as errors
|
||||||
setlocal efm=%E!\ LaTeX\ %trror:\ %m
|
setlocal efm=%E!\ LaTeX\ %trror:\ %m
|
||||||
setlocal efm+=%E%f:%l:\ %m
|
setlocal efm+=%E%f:%l:\ %m
|
||||||
|
setlocal efm+=%E!\ %m
|
||||||
|
|
||||||
|
" More info for undefined control sequences
|
||||||
|
setlocal efm+=%Z<argument>\ %m
|
||||||
|
|
||||||
" Show or ignore warnings
|
" Show or ignore warnings
|
||||||
if g:LatexBox_show_warnings
|
if g:LatexBox_show_warnings
|
||||||
@@ -28,22 +34,18 @@ if g:LatexBox_show_warnings
|
|||||||
setlocal efm+=%+WLaTeX\ %.%#Warning:\ %.%#line\ %l%.%#
|
setlocal efm+=%+WLaTeX\ %.%#Warning:\ %.%#line\ %l%.%#
|
||||||
setlocal efm+=%+W%.%#\ at\ lines\ %l--%*\\d
|
setlocal efm+=%+W%.%#\ at\ lines\ %l--%*\\d
|
||||||
setlocal efm+=%+WLaTeX\ %.%#Warning:\ %m
|
setlocal efm+=%+WLaTeX\ %.%#Warning:\ %m
|
||||||
setlocal efm+=%+W%.%#%.%#Warning:\ %m
|
setlocal efm+=%+W%.%#Warning:\ %m
|
||||||
else
|
else
|
||||||
setlocal efm+=%-WLaTeX\ %.%#Warning:\ %.%#line\ %l%.%#
|
setlocal efm+=%-WLaTeX\ %.%#Warning:\ %.%#line\ %l%.%#
|
||||||
setlocal efm+=%-W%.%#\ at\ lines\ %l--%*\\d
|
setlocal efm+=%-W%.%#\ at\ lines\ %l--%*\\d
|
||||||
setlocal efm+=%-WLaTeX\ %.%#Warning:\ %m
|
setlocal efm+=%-WLaTeX\ %.%#Warning:\ %m
|
||||||
setlocal efm+=%-W%.%#%.%#Warning:\ %m
|
setlocal efm+=%-W%.%#Warning:\ %m
|
||||||
endif
|
endif
|
||||||
|
|
||||||
" Consider the remaining statements that starts with "!" as errors
|
|
||||||
setlocal efm+=%E!\ %m
|
|
||||||
|
|
||||||
" Push file to file stack
|
" Push file to file stack
|
||||||
setlocal efm+=%+P**%f
|
setlocal efm+=%+P**%f
|
||||||
|
|
||||||
" Ignore unmatched lines
|
" Ignore unmatched lines
|
||||||
setlocal efm+=%-G\\s%#
|
|
||||||
setlocal efm+=%-G%.%#
|
setlocal efm+=%-G%.%#
|
||||||
" }}}
|
" }}}
|
||||||
|
|
||||||
@@ -213,7 +215,7 @@ function! LatexBox_View()
|
|||||||
if has('win32')
|
if has('win32')
|
||||||
let cmd = '!start /b' . cmd . ' >nul'
|
let cmd = '!start /b' . cmd . ' >nul'
|
||||||
else
|
else
|
||||||
let cmd = '!' . cmd . ' >/dev/null &'
|
let cmd = '!' . cmd . ' &>/dev/null &'
|
||||||
endif
|
endif
|
||||||
silent execute cmd
|
silent execute cmd
|
||||||
if !has("gui_running")
|
if !has("gui_running")
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ if !exists('g:LatexBox_cite_pattern')
|
|||||||
let g:LatexBox_cite_pattern = '\C\\\a*cite\a*\*\?\(\[[^\]]*\]\)*\_\s*{'
|
let g:LatexBox_cite_pattern = '\C\\\a*cite\a*\*\?\(\[[^\]]*\]\)*\_\s*{'
|
||||||
endif
|
endif
|
||||||
if !exists('g:LatexBox_ref_pattern')
|
if !exists('g:LatexBox_ref_pattern')
|
||||||
let g:LatexBox_ref_pattern = '\C\\v\?\(eq\|page\|[cC]\)\?ref\*\?\_\s*{'
|
let g:LatexBox_ref_pattern = '\C\\v\?\(eq\|page\|[cC]\|labelc\)\?ref\*\?\_\s*{'
|
||||||
endif
|
endif
|
||||||
|
|
||||||
if !exists('g:LatexBox_completion_environments')
|
if !exists('g:LatexBox_completion_environments')
|
||||||
@@ -196,37 +196,42 @@ function! s:FindBibData(...)
|
|||||||
endif
|
endif
|
||||||
|
|
||||||
if !filereadable(file)
|
if !filereadable(file)
|
||||||
return ''
|
return []
|
||||||
endif
|
endif
|
||||||
|
let lines = readfile(file)
|
||||||
|
let bibdata_list = []
|
||||||
|
|
||||||
|
"
|
||||||
|
" Search for added bibliographies
|
||||||
|
"
|
||||||
let bibliography_cmds = [
|
let bibliography_cmds = [
|
||||||
\ '\\bibliography',
|
\ '\\bibliography',
|
||||||
\ '\\addbibresource',
|
\ '\\addbibresource',
|
||||||
\ '\\addglobalbib',
|
\ '\\addglobalbib',
|
||||||
\ '\\addsectionbib',
|
\ '\\addsectionbib',
|
||||||
\ ]
|
\ ]
|
||||||
|
|
||||||
let lines = readfile(file)
|
|
||||||
|
|
||||||
let bibdata_list = []
|
|
||||||
|
|
||||||
for cmd in bibliography_cmds
|
for cmd in bibliography_cmds
|
||||||
let bibdata_list += map(filter(copy(lines),
|
let filtered = filter(copy(lines),
|
||||||
\ 'v:val =~ ''\C' . cmd . '\s*{[^}]\+}'''),
|
\ 'v:val =~ ''\C' . cmd . '\s*{[^}]\+}''')
|
||||||
|
let files = map(filtered,
|
||||||
\ 'matchstr(v:val, ''\C' . cmd . '\s*{\zs[^}]\+\ze}'')')
|
\ 'matchstr(v:val, ''\C' . cmd . '\s*{\zs[^}]\+\ze}'')')
|
||||||
|
for file in files
|
||||||
|
let bibdata_list += map(split(file, ','),
|
||||||
|
\ 'fnamemodify(v:val, '':r'')')
|
||||||
|
endfor
|
||||||
endfor
|
endfor
|
||||||
|
|
||||||
let bibdata_list += map(filter(copy(lines),
|
"
|
||||||
\ 'v:val =~ ''\C\\\%(input\|include\)\s*{[^}]\+}'''),
|
" Also search included files
|
||||||
\ 's:FindBibData(LatexBox_kpsewhich(matchstr(v:val,'
|
"
|
||||||
\ . '''\C\\\%(input\|include\)\s*{\zs[^}]\+\ze}'')))')
|
for input in filter(lines,
|
||||||
|
\ 'v:val =~ ''\C\\\%(input\|include\)\s*{[^}]\+}''')
|
||||||
|
let bibdata_list += s:FindBibData(LatexBox_kpsewhich(
|
||||||
|
\ matchstr(input,
|
||||||
|
\ '\C\\\%(input\|include\)\s*{\zs[^}]\+\ze}')))
|
||||||
|
endfor
|
||||||
|
|
||||||
let bibdata_list += map(filter(copy(lines),
|
return bibdata_list
|
||||||
\ 'v:val =~ ''\C\\\%(input\|include\)\s\+\S\+'''),
|
|
||||||
\ 's:FindBibData(LatexBox_kpsewhich(matchstr(v:val,'
|
|
||||||
\ . '''\C\\\%(input\|include\)\s\+\zs\S\+\ze'')))')
|
|
||||||
|
|
||||||
return join(bibdata_list, ',')
|
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
let s:bstfile = expand('<sfile>:p:h') . '/vimcomplete'
|
let s:bstfile = expand('<sfile>:p:h') . '/vimcomplete'
|
||||||
@@ -235,7 +240,7 @@ function! LatexBox_BibSearch(regexp)
|
|||||||
let res = []
|
let res = []
|
||||||
|
|
||||||
" Find data from bib files
|
" Find data from bib files
|
||||||
let bibdata = s:FindBibData()
|
let bibdata = join(s:FindBibData(), ',')
|
||||||
if bibdata != ''
|
if bibdata != ''
|
||||||
|
|
||||||
" write temporary aux file
|
" write temporary aux file
|
||||||
@@ -247,9 +252,18 @@ function! LatexBox_BibSearch(regexp)
|
|||||||
call writefile(['\citation{*}', '\bibstyle{' . s:bstfile . '}',
|
call writefile(['\citation{*}', '\bibstyle{' . s:bstfile . '}',
|
||||||
\ '\bibdata{' . bibdata . '}'], auxfile)
|
\ '\bibdata{' . bibdata . '}'], auxfile)
|
||||||
|
|
||||||
silent execute '! cd ' shellescape(LatexBox_GetTexRoot()) .
|
if has('win32')
|
||||||
\ ' ; bibtex -terse '
|
let l:old_shellslash = &l:shellslash
|
||||||
\ . fnamemodify(auxfile, ':t') . ' >/dev/null'
|
setlocal noshellslash
|
||||||
|
silent execute '! cd ' shellescape(LatexBox_GetTexRoot()) .
|
||||||
|
\ ' & bibtex -terse '
|
||||||
|
\ . fnamemodify(auxfile, ':t') . ' >nul'
|
||||||
|
let &l:shellslash = l:old_shellslash
|
||||||
|
else
|
||||||
|
silent execute '! cd ' shellescape(LatexBox_GetTexRoot()) .
|
||||||
|
\ ' ; bibtex -terse '
|
||||||
|
\ . fnamemodify(auxfile, ':t') . ' >/dev/null'
|
||||||
|
endif
|
||||||
|
|
||||||
let lines = split(substitute(join(readfile(bblfile), "\n"),
|
let lines = split(substitute(join(readfile(bblfile), "\n"),
|
||||||
\ '\n\n\@!\(\s\=\)\s*\|{\|}', '\1', 'g'), "\n")
|
\ '\n\n\@!\(\s\=\)\s*\|{\|}', '\1', 'g'), "\n")
|
||||||
@@ -258,6 +272,8 @@ function! LatexBox_BibSearch(regexp)
|
|||||||
let matches = matchlist(line,
|
let matches = matchlist(line,
|
||||||
\ '^\(.*\)||\(.*\)||\(.*\)||\(.*\)||\(.*\)')
|
\ '^\(.*\)||\(.*\)||\(.*\)||\(.*\)||\(.*\)')
|
||||||
if !empty(matches) && !empty(matches[1])
|
if !empty(matches) && !empty(matches[1])
|
||||||
|
let s:type_length = max([s:type_length,
|
||||||
|
\ len(matches[2]) + 3])
|
||||||
call add(res, {
|
call add(res, {
|
||||||
\ 'key': matches[1],
|
\ 'key': matches[1],
|
||||||
\ 'type': matches[2],
|
\ 'type': matches[2],
|
||||||
@@ -294,6 +310,7 @@ endfunction
|
|||||||
" }}}
|
" }}}
|
||||||
|
|
||||||
" BibTeX completion {{{
|
" BibTeX completion {{{
|
||||||
|
let s:type_length=0
|
||||||
function! LatexBox_BibComplete(regexp)
|
function! LatexBox_BibComplete(regexp)
|
||||||
|
|
||||||
" treat spaces as '.*' if needed
|
" treat spaces as '.*' if needed
|
||||||
@@ -305,9 +322,12 @@ function! LatexBox_BibComplete(regexp)
|
|||||||
endif
|
endif
|
||||||
|
|
||||||
let res = []
|
let res = []
|
||||||
|
let s:type_length = 4
|
||||||
for m in LatexBox_BibSearch(regexp)
|
for m in LatexBox_BibSearch(regexp)
|
||||||
let type = m['type'] == '' ? '[-]' : '[' . m['type'] . '] '
|
let type = m['type'] == '' ? '[-]' : '[' . m['type'] . '] '
|
||||||
|
let type = printf('%-' . s:type_length . 's', type)
|
||||||
let auth = m['author'] == '' ? '' : m['author'][:20] . ' '
|
let auth = m['author'] == '' ? '' : m['author'][:20] . ' '
|
||||||
|
let auth = substitute(auth, '\~', ' ', 'g')
|
||||||
let year = m['year'] == '' ? '' : '(' . m['year'] . ')'
|
let year = m['year'] == '' ? '' : '(' . m['year'] . ')'
|
||||||
let w = { 'word': m['key'],
|
let w = { 'word': m['key'],
|
||||||
\ 'abbr': type . auth . year,
|
\ 'abbr': type . auth . year,
|
||||||
@@ -437,7 +457,7 @@ function! s:GetLabelCache(file)
|
|||||||
|
|
||||||
if !has_key(s:LabelCache , a:file) || s:LabelCache[a:file][0] != getftime(a:file)
|
if !has_key(s:LabelCache , a:file) || s:LabelCache[a:file][0] != getftime(a:file)
|
||||||
" Open file in temporary split window for label extraction.
|
" Open file in temporary split window for label extraction.
|
||||||
silent execute '1sp +let\ labels=s:ExtractLabels()|let\ inputs=s:ExtractInputs()|quit! ' . a:file
|
silent execute '1sp +let\ labels=s:ExtractLabels()|let\ inputs=s:ExtractInputs()|quit! ' . fnameescape(a:file)
|
||||||
let s:LabelCache[a:file] = [ getftime(a:file), labels, inputs ]
|
let s:LabelCache[a:file] = [ getftime(a:file), labels, inputs ]
|
||||||
endif
|
endif
|
||||||
|
|
||||||
@@ -785,6 +805,41 @@ function! s:GetEnvironmentList(lead, cmdline, pos)
|
|||||||
endfor
|
endfor
|
||||||
return suggestions
|
return suggestions
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
|
function! s:LatexToggleStarEnv()
|
||||||
|
let [env, lnum, cnum, lnum2, cnum2] = LatexBox_GetCurrentEnvironment(1)
|
||||||
|
|
||||||
|
if env == '\('
|
||||||
|
return
|
||||||
|
elseif env == '\['
|
||||||
|
let begin = '\begin{equation}'
|
||||||
|
let end = '\end{equation}'
|
||||||
|
elseif env[-1:] == '*'
|
||||||
|
let begin = '\begin{' . env[:-2] . '}'
|
||||||
|
let end = '\end{' . env[:-2] . '}'
|
||||||
|
else
|
||||||
|
let begin = '\begin{' . env . '*}'
|
||||||
|
let end = '\end{' . env . '*}'
|
||||||
|
endif
|
||||||
|
|
||||||
|
if env == '\['
|
||||||
|
let line = getline(lnum2)
|
||||||
|
let line = strpart(line, 0, cnum2 - 1) . l:end . strpart(line, cnum2 + 1)
|
||||||
|
call setline(lnum2, line)
|
||||||
|
|
||||||
|
let line = getline(lnum)
|
||||||
|
let line = strpart(line, 0, cnum - 1) . l:begin . strpart(line, cnum + 1)
|
||||||
|
call setline(lnum, line)
|
||||||
|
else
|
||||||
|
let line = getline(lnum2)
|
||||||
|
let line = strpart(line, 0, cnum2 - 1) . l:end . strpart(line, cnum2 + len(env) + 5)
|
||||||
|
call setline(lnum2, line)
|
||||||
|
|
||||||
|
let line = getline(lnum)
|
||||||
|
let line = strpart(line, 0, cnum - 1) . l:begin . strpart(line, cnum + len(env) + 7)
|
||||||
|
call setline(lnum, line)
|
||||||
|
endif
|
||||||
|
endfunction
|
||||||
" }}}
|
" }}}
|
||||||
|
|
||||||
" Next Charaters Match {{{
|
" Next Charaters Match {{{
|
||||||
@@ -800,6 +855,7 @@ vnoremap <silent> <Plug>LatexWrapSelection :<c-u>call <SID>WrapSelection('')<C
|
|||||||
vnoremap <silent> <Plug>LatexEnvWrapSelection :<c-u>call <SID>PromptEnvWrapSelection()<CR>
|
vnoremap <silent> <Plug>LatexEnvWrapSelection :<c-u>call <SID>PromptEnvWrapSelection()<CR>
|
||||||
vnoremap <silent> <Plug>LatexEnvWrapFmtSelection :<c-u>call <SID>PromptEnvWrapSelection(1)<CR>
|
vnoremap <silent> <Plug>LatexEnvWrapFmtSelection :<c-u>call <SID>PromptEnvWrapSelection(1)<CR>
|
||||||
nnoremap <silent> <Plug>LatexChangeEnv :call <SID>ChangeEnvPrompt()<CR>
|
nnoremap <silent> <Plug>LatexChangeEnv :call <SID>ChangeEnvPrompt()<CR>
|
||||||
|
nnoremap <silent> <Plug>LatexToggleStarEnv :call <SID>LatexToggleStarEnv()<CR>
|
||||||
" }}}
|
" }}}
|
||||||
|
|
||||||
" vim:fdm=marker:ff=unix:noet:ts=4:sw=4
|
" vim:fdm=marker:ff=unix:noet:ts=4:sw=4
|
||||||
|
|||||||
@@ -153,13 +153,15 @@ function! LatexBox_FoldLevel(lnum)
|
|||||||
endif
|
endif
|
||||||
endfor
|
endfor
|
||||||
|
|
||||||
|
" Never fold \end{document}
|
||||||
|
if line =~# '^\s*\\end{document}'
|
||||||
|
return 0
|
||||||
|
endif
|
||||||
|
|
||||||
" Fold environments
|
" Fold environments
|
||||||
if g:LatexBox_fold_envs == 1
|
if g:LatexBox_fold_envs == 1
|
||||||
if line =~# s:envbeginpattern
|
if line =~# s:envbeginpattern
|
||||||
return "a1"
|
return "a1"
|
||||||
elseif line =~# '^\s*\\end{document}'
|
|
||||||
" Never fold \end{document}
|
|
||||||
return 0
|
|
||||||
elseif line =~# s:envendpattern
|
elseif line =~# s:envendpattern
|
||||||
return "s1"
|
return "s1"
|
||||||
endif
|
endif
|
||||||
|
|||||||
@@ -5,6 +5,9 @@
|
|||||||
if !exists('g:LatexBox_latexmk_options')
|
if !exists('g:LatexBox_latexmk_options')
|
||||||
let g:LatexBox_latexmk_options = ''
|
let g:LatexBox_latexmk_options = ''
|
||||||
endif
|
endif
|
||||||
|
if !exists('g:LatexBox_latexmk_env')
|
||||||
|
let g:LatexBox_latexmk_env = ''
|
||||||
|
endif
|
||||||
if !exists('g:LatexBox_latexmk_async')
|
if !exists('g:LatexBox_latexmk_async')
|
||||||
let g:LatexBox_latexmk_async = 0
|
let g:LatexBox_latexmk_async = 0
|
||||||
endif
|
endif
|
||||||
@@ -156,6 +159,9 @@ function! LatexBox_Latexmk(force)
|
|||||||
let env = 'max_print_line=' . max_print_line
|
let env = 'max_print_line=' . max_print_line
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
" Set environment options
|
||||||
|
let env .= ' ' . g:LatexBox_latexmk_env . ' '
|
||||||
|
|
||||||
" Set latexmk command with options
|
" Set latexmk command with options
|
||||||
if has('win32')
|
if has('win32')
|
||||||
" Make sure to switch drive as well as directory
|
" Make sure to switch drive as well as directory
|
||||||
|
|||||||
@@ -75,7 +75,9 @@ function! s:FindMatchingPair(mode)
|
|||||||
let lnum = line('.')
|
let lnum = line('.')
|
||||||
let cnum = searchpos('\A', 'cbnW', lnum)[1]
|
let cnum = searchpos('\A', 'cbnW', lnum)[1]
|
||||||
" if the previous char is a backslash
|
" if the previous char is a backslash
|
||||||
if strpart(getline(lnum), 0, cnum-1) !~ notbslash . '$' | let cnum = cnum-1 | endif
|
if strpart(getline(lnum), cnum-2, 1) == '\'
|
||||||
|
let cnum = cnum-1
|
||||||
|
endif
|
||||||
let delim = matchstr(getline(lnum), '\C^'. anymatch , cnum - 1)
|
let delim = matchstr(getline(lnum), '\C^'. anymatch , cnum - 1)
|
||||||
|
|
||||||
if empty(delim) || strlen(delim)+cnum-1< col('.')
|
if empty(delim) || strlen(delim)+cnum-1< col('.')
|
||||||
@@ -89,7 +91,9 @@ function! s:FindMatchingPair(mode)
|
|||||||
" if not found, move one char bacward and search
|
" if not found, move one char bacward and search
|
||||||
let cnum = searchpos('\A', 'bnW', lnum)[1]
|
let cnum = searchpos('\A', 'bnW', lnum)[1]
|
||||||
" if the previous char is a backslash
|
" if the previous char is a backslash
|
||||||
if strpart(getline(lnum), 0, cnum-1) !~ notbslash . '$' | let cnum = cnum-1 | endif
|
if strpart(getline(lnum), cnum-2, 1) == '\'
|
||||||
|
let cnum = cnum-1
|
||||||
|
endif
|
||||||
let delim = matchstr(getline(lnum), '\C^'. anymatch , cnum - 1)
|
let delim = matchstr(getline(lnum), '\C^'. anymatch , cnum - 1)
|
||||||
if empty(delim) || strlen(delim)+cnum< col('.') | return | endif
|
if empty(delim) || strlen(delim)+cnum< col('.') | return | endif
|
||||||
elseif a:mode =~ 'h'
|
elseif a:mode =~ 'h'
|
||||||
@@ -274,70 +278,18 @@ endfunction
|
|||||||
" Special UTF-8 conversion
|
" Special UTF-8 conversion
|
||||||
function! s:ConvertBack(line)
|
function! s:ConvertBack(line)
|
||||||
let line = a:line
|
let line = a:line
|
||||||
if !exists('g:LatexBox_plaintext_toc')
|
if exists('g:LatexBox_plaintext_toc')
|
||||||
let line = substitute(line, "\\\\IeC\s*{\\\\'a}", 'á', 'g')
|
"
|
||||||
let line = substitute(line, "\\\\IeC\s*{\\\\`a}", 'à', 'g')
|
" Substitute stuff like '\IeC{\"u}' to plain 'u'
|
||||||
let line = substitute(line, "\\\\IeC\s*{\\\\^a}", 'à', 'g')
|
"
|
||||||
let line = substitute(line, "\\\\IeC\s*{\\\\¨a}", 'ä', 'g')
|
let line = substitute(line, '\\IeC\s*{\\.\(.\)}', '\1', 'g')
|
||||||
let line = substitute(line, "\\\\IeC\s*{\\\\\"a}", 'ä', 'g')
|
|
||||||
|
|
||||||
let line = substitute(line, "\\\\IeC\s*{\\\\'e}", 'é', 'g')
|
|
||||||
let line = substitute(line, "\\\\IeC\s*{\\\\`e}", 'è', 'g')
|
|
||||||
let line = substitute(line, "\\\\IeC\s*{\\\\^e}", 'ê', 'g')
|
|
||||||
let line = substitute(line, "\\\\IeC\s*{\\\\¨e}", 'ë', 'g')
|
|
||||||
let line = substitute(line, "\\\\IeC\s*{\\\\\"e}", 'ë', 'g')
|
|
||||||
|
|
||||||
let line = substitute(line, "\\\\IeC\s*{\\\\'i}", 'í', 'g')
|
|
||||||
let line = substitute(line, "\\\\IeC\s*{\\\\`i}", 'î', 'g')
|
|
||||||
let line = substitute(line, "\\\\IeC\s*{\\\\^i}", 'ì', 'g')
|
|
||||||
let line = substitute(line, "\\\\IeC\s*{\\\\¨i}", 'ï', 'g')
|
|
||||||
let line = substitute(line, "\\\\IeC\s*{\\\\\"i}", 'ï', 'g')
|
|
||||||
|
|
||||||
let line = substitute(line, "\\\\IeC\s*{\\\\'o}", 'ó', 'g')
|
|
||||||
let line = substitute(line, "\\\\IeC\s*{\\\\`o}", 'ò', 'g')
|
|
||||||
let line = substitute(line, "\\\\IeC\s*{\\\\^o}", 'ô', 'g')
|
|
||||||
let line = substitute(line, "\\\\IeC\s*{\\\\¨o}", 'ö', 'g')
|
|
||||||
let line = substitute(line, "\\\\IeC\s*{\\\\\"o}", 'ö', 'g')
|
|
||||||
|
|
||||||
let line = substitute(line, "\\\\IeC\s*{\\\\'u}", 'ú', 'g')
|
|
||||||
let line = substitute(line, "\\\\IeC\s*{\\\\`u}", 'ù', 'g')
|
|
||||||
let line = substitute(line, "\\\\IeC\s*{\\\\^u}", 'û', 'g')
|
|
||||||
let line = substitute(line, "\\\\IeC\s*{\\\\¨u}", 'ü', 'g')
|
|
||||||
let line = substitute(line, "\\\\IeC\s*{\\\\\"u}", 'ü', 'g')
|
|
||||||
|
|
||||||
let line = substitute(line, "\\\\IeC\s*{\\\\'A}", 'Á', 'g')
|
|
||||||
let line = substitute(line, "\\\\IeC\s*{\\\\`A}", 'À', 'g')
|
|
||||||
let line = substitute(line, "\\\\IeC\s*{\\\\^A}", 'À', 'g')
|
|
||||||
let line = substitute(line, "\\\\IeC\s*{\\\\¨A}", 'Ä', 'g')
|
|
||||||
let line = substitute(line, "\\\\IeC\s*{\\\\\"A}", 'Ä', 'g')
|
|
||||||
|
|
||||||
let line = substitute(line, "\\\\IeC\s*{\\\\'E}", 'É', 'g')
|
|
||||||
let line = substitute(line, "\\\\IeC\s*{\\\\`E}", 'È', 'g')
|
|
||||||
let line = substitute(line, "\\\\IeC\s*{\\\\^E}", 'Ê', 'g')
|
|
||||||
let line = substitute(line, "\\\\IeC\s*{\\\\¨E}", 'Ë', 'g')
|
|
||||||
let line = substitute(line, "\\\\IeC\s*{\\\\\"E}", 'Ë', 'g')
|
|
||||||
|
|
||||||
let line = substitute(line, "\\\\IeC\s*{\\\\'I}", 'Í', 'g')
|
|
||||||
let line = substitute(line, "\\\\IeC\s*{\\\\`I}", 'Î', 'g')
|
|
||||||
let line = substitute(line, "\\\\IeC\s*{\\\\^I}", 'Ì', 'g')
|
|
||||||
let line = substitute(line, "\\\\IeC\s*{\\\\¨I}", 'Ï', 'g')
|
|
||||||
let line = substitute(line, "\\\\IeC\s*{\\\\\"I}", 'Ï', 'g')
|
|
||||||
|
|
||||||
let line = substitute(line, "\\\\IeC\s*{\\\\'O}", 'Ó', 'g')
|
|
||||||
let line = substitute(line, "\\\\IeC\s*{\\\\`O}", 'Ò', 'g')
|
|
||||||
let line = substitute(line, "\\\\IeC\s*{\\\\^O}", 'Ô', 'g')
|
|
||||||
let line = substitute(line, "\\\\IeC\s*{\\\\¨O}", 'Ö', 'g')
|
|
||||||
let line = substitute(line, "\\\\IeC\s*{\\\\\"O}", 'Ö', 'g')
|
|
||||||
|
|
||||||
let line = substitute(line, "\\\\IeC\s*{\\\\'U}", 'Ú', 'g')
|
|
||||||
let line = substitute(line, "\\\\IeC\s*{\\\\`U}", 'Ù', 'g')
|
|
||||||
let line = substitute(line, "\\\\IeC\s*{\\\\^U}", 'Û', 'g')
|
|
||||||
let line = substitute(line, "\\\\IeC\s*{\\\\¨U}", 'Ü', 'g')
|
|
||||||
let line = substitute(line, "\\\\IeC\s*{\\\\\"U}", 'Ü', 'g')
|
|
||||||
else
|
else
|
||||||
" substitute stuff like '\IeC{\"u}' (utf-8 umlauts in section heading)
|
"
|
||||||
" to plain 'u'
|
" Substitute stuff like '\IeC{\"u}' to corresponding unicode symbols
|
||||||
let line = substitute(line, "\\\\IeC\s*{\\\\.\\(.\\)}", '\1', 'g')
|
"
|
||||||
|
for [pat, symbol] in s:ConvBackPats
|
||||||
|
let line = substitute(line, pat, symbol, 'g')
|
||||||
|
endfor
|
||||||
endif
|
endif
|
||||||
return line
|
return line
|
||||||
endfunction
|
endfunction
|
||||||
@@ -360,7 +312,7 @@ function! s:ReadTOC(auxfile, texfile, ...)
|
|||||||
if included != ''
|
if included != ''
|
||||||
" append the input TOX to `toc` and `fileindices`
|
" append the input TOX to `toc` and `fileindices`
|
||||||
let newaux = prefix . '/' . included
|
let newaux = prefix . '/' . included
|
||||||
let newtex = fnamemodify(fnamemodify(newaux, ':t:r') . '.tex', ':p')
|
let newtex = fnamemodify(newaux, ':r') . '.tex'
|
||||||
call s:ReadTOC(newaux, newtex, toc, fileindices)
|
call s:ReadTOC(newaux, newtex, toc, fileindices)
|
||||||
continue
|
continue
|
||||||
endif
|
endif
|
||||||
@@ -376,7 +328,7 @@ function! s:ReadTOC(auxfile, texfile, ...)
|
|||||||
continue
|
continue
|
||||||
endif
|
endif
|
||||||
|
|
||||||
let tree = LatexBox_TexToTree(line)
|
let tree = LatexBox_TexToTree(s:ConvertBack(line))
|
||||||
|
|
||||||
if len(tree) < 3
|
if len(tree) < 3
|
||||||
" unknown entry type: just skip it
|
" unknown entry type: just skip it
|
||||||
@@ -392,26 +344,25 @@ function! s:ReadTOC(auxfile, texfile, ...)
|
|||||||
let page = ''
|
let page = ''
|
||||||
endif
|
endif
|
||||||
" parse section number
|
" parse section number
|
||||||
|
let secnum = ''
|
||||||
if len(tree[1]) > 3 && empty(tree[1][1])
|
if len(tree[1]) > 3 && empty(tree[1][1])
|
||||||
call remove(tree[1], 1)
|
call remove(tree[1], 1)
|
||||||
endif
|
endif
|
||||||
if len(tree[1]) > 1
|
if len(tree[1]) > 1 && tree[1][0] =~ '\(numberline\|tocsection\)'
|
||||||
if !empty(tree[1][1])
|
if !empty(tree[1][1])
|
||||||
let secnum = LatexBox_TreeToTex(tree[1][1])
|
let secnum = LatexBox_TreeToTex(tree[1][1])
|
||||||
let secnum = s:ConvertBack(secnum)
|
|
||||||
let secnum = substitute(secnum, '\\\S\+\s', '', 'g')
|
let secnum = substitute(secnum, '\\\S\+\s', '', 'g')
|
||||||
let secnum = substitute(secnum, '\\\S\+{\(.\{-}\)}', '\1', 'g')
|
let secnum = substitute(secnum, '\\\S\+{\(.\{-}\)}', '\1', 'g')
|
||||||
let secnum = substitute(secnum, '^{\+\|}\+$', '', 'g')
|
let secnum = substitute(secnum, '^{\+\|}\+$', '', 'g')
|
||||||
endif
|
endif
|
||||||
let tree = tree[1][2:]
|
let tree = tree[1][2:]
|
||||||
else
|
else
|
||||||
let secnum = ''
|
|
||||||
let tree = tree[1]
|
let tree = tree[1]
|
||||||
endif
|
endif
|
||||||
" parse section title
|
" parse section title
|
||||||
let text = LatexBox_TreeToTex(tree)
|
let text = LatexBox_TreeToTex(tree)
|
||||||
let text = s:ConvertBack(text)
|
|
||||||
let text = substitute(text, '^{\+\|}\+$', '', 'g')
|
let text = substitute(text, '^{\+\|}\+$', '', 'g')
|
||||||
|
let text = substitute(text, '\*', '', 'g')
|
||||||
|
|
||||||
" add TOC entry
|
" add TOC entry
|
||||||
call add(fileindices[texfile], len(toc))
|
call add(fileindices[texfile], len(toc))
|
||||||
@@ -486,28 +437,90 @@ endfunction
|
|||||||
function! s:FindClosestSection(toc, fileindices)
|
function! s:FindClosestSection(toc, fileindices)
|
||||||
let file = expand('%:p')
|
let file = expand('%:p')
|
||||||
if !has_key(a:fileindices, file)
|
if !has_key(a:fileindices, file)
|
||||||
echoe 'Current file is not included in main tex file ' . LatexBox_GetMainTexFile() . '.'
|
return 0
|
||||||
endif
|
endif
|
||||||
|
|
||||||
let imax = len(a:fileindices[file])
|
let imax = len(a:fileindices[file])
|
||||||
let imin = 0
|
if imax > 0
|
||||||
while imin < imax - 1
|
let imin = 0
|
||||||
let i = (imax + imin) / 2
|
while imin < imax - 1
|
||||||
let tocindex = a:fileindices[file][i]
|
let i = (imax + imin) / 2
|
||||||
let entry = a:toc[tocindex]
|
let tocindex = a:fileindices[file][i]
|
||||||
let titlestr = entry['text']
|
let entry = a:toc[tocindex]
|
||||||
let titlestr = escape(titlestr, '\')
|
let titlestr = entry['text']
|
||||||
let titlestr = substitute(titlestr, ' ', '\\_\\s\\+', 'g')
|
let titlestr = escape(titlestr, '\')
|
||||||
let [lnum, cnum] = searchpos('\\' . entry['level'] . '\_\s*{' . titlestr . '}', 'nW')
|
let titlestr = substitute(titlestr, ' ', '\\_\\s\\+', 'g')
|
||||||
if lnum
|
let [lnum, cnum] = searchpos('\\' . entry['level'] . '\_\s*{' . titlestr . '}', 'nW')
|
||||||
let imax = i
|
if lnum
|
||||||
else
|
let imax = i
|
||||||
let imin = i
|
else
|
||||||
endif
|
let imin = i
|
||||||
endwhile
|
endif
|
||||||
|
endwhile
|
||||||
return a:fileindices[file][imin]
|
return a:fileindices[file][imin]
|
||||||
|
else
|
||||||
|
return 0
|
||||||
|
endif
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
|
let s:ConvBackPats = map([
|
||||||
|
\ ['\\''A}' , 'Á'],
|
||||||
|
\ ['\\`A}' , 'À'],
|
||||||
|
\ ['\\^A}' , 'À'],
|
||||||
|
\ ['\\¨A}' , 'Ä'],
|
||||||
|
\ ['\\"A}' , 'Ä'],
|
||||||
|
\ ['\\''a}' , 'á'],
|
||||||
|
\ ['\\`a}' , 'à'],
|
||||||
|
\ ['\\^a}' , 'à'],
|
||||||
|
\ ['\\¨a}' , 'ä'],
|
||||||
|
\ ['\\"a}' , 'ä'],
|
||||||
|
\ ['\\''E}' , 'É'],
|
||||||
|
\ ['\\`E}' , 'È'],
|
||||||
|
\ ['\\^E}' , 'Ê'],
|
||||||
|
\ ['\\¨E}' , 'Ë'],
|
||||||
|
\ ['\\"E}' , 'Ë'],
|
||||||
|
\ ['\\''e}' , 'é'],
|
||||||
|
\ ['\\`e}' , 'è'],
|
||||||
|
\ ['\\^e}' , 'ê'],
|
||||||
|
\ ['\\¨e}' , 'ë'],
|
||||||
|
\ ['\\"e}' , 'ë'],
|
||||||
|
\ ['\\''I}' , 'Í'],
|
||||||
|
\ ['\\`I}' , 'Î'],
|
||||||
|
\ ['\\^I}' , 'Ì'],
|
||||||
|
\ ['\\¨I}' , 'Ï'],
|
||||||
|
\ ['\\"I}' , 'Ï'],
|
||||||
|
\ ['\\''i}' , 'í'],
|
||||||
|
\ ['\\`i}' , 'î'],
|
||||||
|
\ ['\\^i}' , 'ì'],
|
||||||
|
\ ['\\¨i}' , 'ï'],
|
||||||
|
\ ['\\"i}' , 'ï'],
|
||||||
|
\ ['\\''{\?\\i }' , 'í'],
|
||||||
|
\ ['\\''O}' , 'Ó'],
|
||||||
|
\ ['\\`O}' , 'Ò'],
|
||||||
|
\ ['\\^O}' , 'Ô'],
|
||||||
|
\ ['\\¨O}' , 'Ö'],
|
||||||
|
\ ['\\"O}' , 'Ö'],
|
||||||
|
\ ['\\''o}' , 'ó'],
|
||||||
|
\ ['\\`o}' , 'ò'],
|
||||||
|
\ ['\\^o}' , 'ô'],
|
||||||
|
\ ['\\¨o}' , 'ö'],
|
||||||
|
\ ['\\"o}' , 'ö'],
|
||||||
|
\ ['\\''U}' , 'Ú'],
|
||||||
|
\ ['\\`U}' , 'Ù'],
|
||||||
|
\ ['\\^U}' , 'Û'],
|
||||||
|
\ ['\\¨U}' , 'Ü'],
|
||||||
|
\ ['\\"U}' , 'Ü'],
|
||||||
|
\ ['\\''u}' , 'ú'],
|
||||||
|
\ ['\\`u}' , 'ù'],
|
||||||
|
\ ['\\^u}' , 'û'],
|
||||||
|
\ ['\\¨u}' , 'ü'],
|
||||||
|
\ ['\\"u}' , 'ü'],
|
||||||
|
\ ['\\`N}' , 'Ǹ'],
|
||||||
|
\ ['\\\~N}' , 'Ñ'],
|
||||||
|
\ ['\\''n}' , 'ń'],
|
||||||
|
\ ['\\`n}' , 'ǹ'],
|
||||||
|
\ ['\\\~n}' , 'ñ'],
|
||||||
|
\], '[''\C\(\\IeC\s*{\)\?'' . v:val[0], v:val[1]]')
|
||||||
" }}}
|
" }}}
|
||||||
|
|
||||||
" TOC Command {{{
|
" TOC Command {{{
|
||||||
|
|||||||
@@ -80,24 +80,14 @@ function! s:TOCActivate(close)
|
|||||||
|
|
||||||
execute b:calling_win . 'wincmd w'
|
execute b:calling_win . 'wincmd w'
|
||||||
|
|
||||||
let bnr = bufnr(entry['file'])
|
let files = [entry['file']]
|
||||||
if bnr == -1
|
for line in filter(readfile(entry['file']), 'v:val =~ ''\\input{''')
|
||||||
execute 'badd ' . entry['file']
|
call add(files, matchstr(line, '{\zs.*\ze\(\.tex\)\?}') . '.tex')
|
||||||
let bnr = bufnr(entry['file'])
|
endfor
|
||||||
endif
|
|
||||||
|
|
||||||
execute 'buffer! ' . bnr
|
" Find section in buffer (or inputted files)
|
||||||
|
call s:TOCFindMatch('\\' . entry['level'] . '\_\s*{' . titlestr . '}',
|
||||||
" skip duplicates
|
\ duplicates, files)
|
||||||
while duplicates > 0
|
|
||||||
if search('\\' . entry['level'] . '\_\s*{' . titlestr . '}', 'ws')
|
|
||||||
let duplicates -= 1
|
|
||||||
endif
|
|
||||||
endwhile
|
|
||||||
|
|
||||||
if search('\\' . entry['level'] . '\_\s*{' . titlestr . '}', 'ws')
|
|
||||||
normal zv
|
|
||||||
endif
|
|
||||||
|
|
||||||
if a:close
|
if a:close
|
||||||
if g:LatexBox_split_resize
|
if g:LatexBox_split_resize
|
||||||
@@ -109,6 +99,30 @@ function! s:TOCActivate(close)
|
|||||||
endif
|
endif
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
|
" {{{2 TOCFindMatch
|
||||||
|
function! s:TOCFindMatch(strsearch,duplicates,files)
|
||||||
|
|
||||||
|
call s:TOCOpenBuf(a:files[0])
|
||||||
|
let dups = a:duplicates
|
||||||
|
|
||||||
|
" Skip duplicates
|
||||||
|
while dups > 0
|
||||||
|
if search(a:strsearch, 'w')
|
||||||
|
let dups -= 1
|
||||||
|
else
|
||||||
|
break
|
||||||
|
endif
|
||||||
|
endwhile
|
||||||
|
|
||||||
|
if search(a:strsearch, 'w')
|
||||||
|
normal! zv
|
||||||
|
return
|
||||||
|
endif
|
||||||
|
|
||||||
|
call s:TOCFindMatch(a:strsearch,dups,a:files[1:])
|
||||||
|
|
||||||
|
endfunction
|
||||||
|
|
||||||
" {{{2 TOCFoldLevel
|
" {{{2 TOCFoldLevel
|
||||||
function! TOCFoldLevel(lnum)
|
function! TOCFoldLevel(lnum)
|
||||||
let line = getline(a:lnum)
|
let line = getline(a:lnum)
|
||||||
@@ -140,12 +154,25 @@ function! TOCFoldLevel(lnum)
|
|||||||
" Return previous fold level
|
" Return previous fold level
|
||||||
return "="
|
return "="
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
" {{{2 TOCFoldText
|
" {{{2 TOCFoldText
|
||||||
function! TOCFoldText()
|
function! TOCFoldText()
|
||||||
let parts = matchlist(getline(v:foldstart), '^\(.*\)\t\(.*\)$')
|
let parts = matchlist(getline(v:foldstart), '^\(.*\)\t\(.*\)$')
|
||||||
return printf('%-8s%-72s', parts[1], parts[2])
|
return printf('%-8s%-72s', parts[1], parts[2])
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
|
" {{{2 TOCOpenBuf
|
||||||
|
function! s:TOCOpenBuf(file)
|
||||||
|
|
||||||
|
let bnr = bufnr(a:file)
|
||||||
|
if bnr == -1
|
||||||
|
execute 'badd ' . a:file
|
||||||
|
let bnr = bufnr(a:file)
|
||||||
|
endif
|
||||||
|
execute 'buffer! ' . bnr
|
||||||
|
|
||||||
|
endfunction
|
||||||
|
|
||||||
" }}}1
|
" }}}1
|
||||||
|
|
||||||
" {{{1 Mappings
|
" {{{1 Mappings
|
||||||
|
|||||||
88
ftplugin/perl.vim
Normal file
88
ftplugin/perl.vim
Normal file
@@ -0,0 +1,88 @@
|
|||||||
|
" Vim filetype plugin file
|
||||||
|
" Language: Perl
|
||||||
|
" Maintainer: vim-perl <vim-perl@googlegroups.com>
|
||||||
|
" Homepage: http://github.com/vim-perl/vim-perl
|
||||||
|
" Bugs/requests: http://github.com/vim-perl/vim-perl/issues
|
||||||
|
" Last Change: {{LAST_CHANGE}}
|
||||||
|
|
||||||
|
if exists("b:did_ftplugin") | finish | endif
|
||||||
|
let b:did_ftplugin = 1
|
||||||
|
|
||||||
|
" Make sure the continuation lines below do not cause problems in
|
||||||
|
" compatibility mode.
|
||||||
|
let s:save_cpo = &cpo
|
||||||
|
set cpo-=C
|
||||||
|
|
||||||
|
setlocal formatoptions-=t
|
||||||
|
setlocal formatoptions+=crqol
|
||||||
|
setlocal keywordprg=perldoc\ -f
|
||||||
|
|
||||||
|
setlocal comments=:#
|
||||||
|
setlocal commentstring=#%s
|
||||||
|
|
||||||
|
" Change the browse dialog on Win32 to show mainly Perl-related files
|
||||||
|
if has("gui_win32")
|
||||||
|
let b:browsefilter = "Perl Source Files (*.pl)\t*.pl\n" .
|
||||||
|
\ "Perl Modules (*.pm)\t*.pm\n" .
|
||||||
|
\ "Perl Documentation Files (*.pod)\t*.pod\n" .
|
||||||
|
\ "All Files (*.*)\t*.*\n"
|
||||||
|
endif
|
||||||
|
|
||||||
|
" Provided by Ned Konz <ned at bike-nomad dot com>
|
||||||
|
"---------------------------------------------
|
||||||
|
setlocal include=\\<\\(use\\\|require\\)\\>
|
||||||
|
setlocal includeexpr=substitute(substitute(substitute(v:fname,'::','/','g'),'->\*','',''),'$','.pm','')
|
||||||
|
setlocal define=[^A-Za-z_]
|
||||||
|
setlocal iskeyword+=:
|
||||||
|
|
||||||
|
" The following line changes a global variable but is necessary to make
|
||||||
|
" gf and similar commands work. Thanks to Andrew Pimlott for pointing
|
||||||
|
" out the problem. If this causes a problem for you, add an
|
||||||
|
" after/ftplugin/perl.vim file that contains
|
||||||
|
" set isfname-=:
|
||||||
|
set isfname+=:
|
||||||
|
|
||||||
|
" Set this once, globally.
|
||||||
|
if !exists("perlpath")
|
||||||
|
if executable("perl")
|
||||||
|
try
|
||||||
|
if &shellxquote != '"'
|
||||||
|
let perlpath = system('perl -e "print join(q/,/,@INC)"')
|
||||||
|
else
|
||||||
|
let perlpath = system("perl -e 'print join(q/,/,@INC)'")
|
||||||
|
endif
|
||||||
|
let perlpath = substitute(perlpath,',.$',',,','')
|
||||||
|
catch /E145:/
|
||||||
|
let perlpath = ".,,"
|
||||||
|
endtry
|
||||||
|
else
|
||||||
|
" If we can't call perl to get its path, just default to using the
|
||||||
|
" current directory and the directory of the current file.
|
||||||
|
let perlpath = ".,,"
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
|
||||||
|
" Append perlpath to the existing path value, if it is set. Since we don't
|
||||||
|
" use += to do it because of the commas in perlpath, we have to handle the
|
||||||
|
" global / local settings, too.
|
||||||
|
if &l:path == ""
|
||||||
|
if &g:path == ""
|
||||||
|
let &l:path=perlpath
|
||||||
|
else
|
||||||
|
let &l:path=&g:path.",".perlpath
|
||||||
|
endif
|
||||||
|
else
|
||||||
|
let &l:path=&l:path.",".perlpath
|
||||||
|
endif
|
||||||
|
"---------------------------------------------
|
||||||
|
|
||||||
|
" Undo the stuff we changed.
|
||||||
|
let b:undo_ftplugin = "setlocal fo< com< cms< inc< inex< def< isf< kp< path<" .
|
||||||
|
\ " | unlet! b:browsefilter"
|
||||||
|
|
||||||
|
" proper matching for matchit plugin
|
||||||
|
let b:match_skip = 's:comment\|string\|perlQQ\|perlShellCommand\|perlHereDoc\|perlSubstitution\|perlTranslation\|perlMatch\|perlFormatField'
|
||||||
|
|
||||||
|
" Restore the saved compatibility options.
|
||||||
|
let &cpo = s:save_cpo
|
||||||
|
unlet s:save_cpo
|
||||||
77
ftplugin/perl6.vim
Normal file
77
ftplugin/perl6.vim
Normal file
@@ -0,0 +1,77 @@
|
|||||||
|
" Vim filetype plugin file
|
||||||
|
" Language: Perl 6
|
||||||
|
" Maintainer: vim-perl <vim-perl@googlegroups.com>
|
||||||
|
" Homepage: http://github.com/vim-perl/vim-perl
|
||||||
|
" Bugs/requests: http://github.com/vim-perl/vim-perl/issues
|
||||||
|
" Last Change: {{LAST_CHANGE}}
|
||||||
|
" Contributors: Hinrik Örn Sigurðsson <hinrik.sig@gmail.com>
|
||||||
|
"
|
||||||
|
" Based on ftplugin/perl.vim by Dan Sharp <dwsharp at hotmail dot com>
|
||||||
|
|
||||||
|
if exists("b:did_ftplugin") | finish | endif
|
||||||
|
let b:did_ftplugin = 1
|
||||||
|
|
||||||
|
" Make sure the continuation lines below do not cause problems in
|
||||||
|
" compatibility mode.
|
||||||
|
let s:save_cpo = &cpo
|
||||||
|
set cpo-=C
|
||||||
|
|
||||||
|
setlocal formatoptions-=t
|
||||||
|
setlocal formatoptions+=crqol
|
||||||
|
setlocal keywordprg=p6doc
|
||||||
|
|
||||||
|
setlocal comments=:#
|
||||||
|
setlocal commentstring=#%s
|
||||||
|
|
||||||
|
" Change the browse dialog on Win32 to show mainly Perl-related files
|
||||||
|
if has("gui_win32")
|
||||||
|
let b:browsefilter = "Perl Source Files (*.pl)\t*.pl\n" .
|
||||||
|
\ "Perl Modules (*.pm)\t*.pm\n" .
|
||||||
|
\ "Perl Documentation Files (*.pod)\t*.pod\n" .
|
||||||
|
\ "All Files (*.*)\t*.*\n"
|
||||||
|
endif
|
||||||
|
|
||||||
|
" Provided by Ned Konz <ned at bike-nomad dot com>
|
||||||
|
"---------------------------------------------
|
||||||
|
setlocal include=\\<\\(use\\\|require\\)\\>
|
||||||
|
setlocal includeexpr=substitute(substitute(v:fname,'::','/','g'),'$','.pm','')
|
||||||
|
setlocal define=[^A-Za-z_]
|
||||||
|
|
||||||
|
" The following line changes a global variable but is necessary to make
|
||||||
|
" gf and similar commands work. Thanks to Andrew Pimlott for pointing out
|
||||||
|
" the problem. If this causes a " problem for you, add an
|
||||||
|
" after/ftplugin/perl6.vim file that contains
|
||||||
|
" set isfname-=:
|
||||||
|
set isfname+=:
|
||||||
|
setlocal iskeyword=48-57,_,A-Z,a-z,:,-
|
||||||
|
|
||||||
|
" Set this once, globally.
|
||||||
|
if !exists("perlpath")
|
||||||
|
if executable("perl6")
|
||||||
|
try
|
||||||
|
if &shellxquote != '"'
|
||||||
|
let perlpath = system('perl6 -e "@*INC.join(q/,/).say"')
|
||||||
|
else
|
||||||
|
let perlpath = system("perl6 -e '@*INC.join(q/,/).say'")
|
||||||
|
endif
|
||||||
|
let perlpath = substitute(perlpath,',.$',',,','')
|
||||||
|
catch /E145:/
|
||||||
|
let perlpath = ".,,"
|
||||||
|
endtry
|
||||||
|
else
|
||||||
|
" If we can't call perl to get its path, just default to using the
|
||||||
|
" current directory and the directory of the current file.
|
||||||
|
let perlpath = ".,,"
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
|
||||||
|
let &l:path=perlpath
|
||||||
|
"---------------------------------------------
|
||||||
|
|
||||||
|
" Undo the stuff we changed.
|
||||||
|
let b:undo_ftplugin = "setlocal fo< com< cms< inc< inex< def< isk<" .
|
||||||
|
\ " | unlet! b:browsefilter"
|
||||||
|
|
||||||
|
" Restore the saved compatibility options.
|
||||||
|
let &cpo = s:save_cpo
|
||||||
|
unlet s:save_cpo
|
||||||
69
ftplugin/r.vim
Normal file
69
ftplugin/r.vim
Normal file
@@ -0,0 +1,69 @@
|
|||||||
|
" ftplugin for R files
|
||||||
|
"
|
||||||
|
" Author: Iago Mosqueira <i.mosqueira@ic.ac.uk>
|
||||||
|
" Author: Johannes Ranke <jranke@uni-bremen.de>
|
||||||
|
" Author: Fernando Henrique Ferraz Pereira da Rosa <feferraz@ime.usp.br>
|
||||||
|
" Maintainer: Johannes Ranke <jranke@uni-bremen.de>
|
||||||
|
" Last Change: 2007 Nov 21
|
||||||
|
" SVN: $Id: r.vim 75 2007-11-21 13:34:02Z ranke $
|
||||||
|
"
|
||||||
|
" Code written in vim is sent to R through a perl pipe
|
||||||
|
" [funnel.pl, by Larry Clapp <vim@theclapp.org>], as individual lines,
|
||||||
|
" blocks, or the whole file.
|
||||||
|
|
||||||
|
" Press <F2> to open a new xterm with a new R interpreter listening
|
||||||
|
" to its standard input (you can type R commands into the xterm)
|
||||||
|
" as well as to code pasted from within vim.
|
||||||
|
"
|
||||||
|
" After selecting a visual block, 'r' sends it to the R interpreter
|
||||||
|
"
|
||||||
|
" In insert mode, <M-Enter> sends the active line to R and moves to the next
|
||||||
|
" line (write and process mode).
|
||||||
|
"
|
||||||
|
" Maps:
|
||||||
|
" <F2> Start a listening R interpreter in new xterm
|
||||||
|
" <F3> Start a listening R-devel interpreter in new xterm
|
||||||
|
" <F4> Start a listening R --vanilla interpreter in new xterm
|
||||||
|
" <F5> Run current file
|
||||||
|
" <F9> Run line under cursor
|
||||||
|
" r Run visual block
|
||||||
|
" <M-Enter> Write and process
|
||||||
|
|
||||||
|
" Only do this when not yet done for this buffer
|
||||||
|
if exists("b:did_ftplugin")
|
||||||
|
finish
|
||||||
|
endif
|
||||||
|
|
||||||
|
" Don't load another plugin for this buffer
|
||||||
|
let b:did_ftplugin = 1
|
||||||
|
|
||||||
|
" Disable backup for .r-pipe
|
||||||
|
setl backupskip=.*pipe
|
||||||
|
|
||||||
|
" Set tabstop so it is compatible with the emacs edited code. Personally, I
|
||||||
|
" prefer shiftwidth=2, which I have in my .vimrc anyway
|
||||||
|
set expandtab
|
||||||
|
set shiftwidth=4
|
||||||
|
set tabstop=8
|
||||||
|
|
||||||
|
" Start a listening R interpreter in new xterm
|
||||||
|
noremap <buffer> <F2> :!xterm -T 'R' -e funnel.pl ~/.r-pipe "R && echo -e 'Interpreter has finished. Exiting. Goodbye.\n'"&<CR><CR>
|
||||||
|
|
||||||
|
" Start a listening R-devel interpreter in new xterm
|
||||||
|
noremap <buffer> <F3> :!xterm -T 'R' -e funnel.pl ~/.r-pipe "R-devel && echo 'Interpreter has finished. Exiting. Goodbye.'"&<CR><CR>
|
||||||
|
|
||||||
|
" Start a listening R --vanilla interpreter in new xterm
|
||||||
|
noremap <buffer> <F4> :!xterm -T 'R' -e funnel.pl ~/.r-pipe "R -vanilla && echo 'Interpreter has finished. Exiting. Goodbye.'"&<CR><CR>
|
||||||
|
|
||||||
|
" Send line under cursor to R
|
||||||
|
noremap <buffer> <F9> :execute line(".") 'w >> ~/.r-pipe'<CR>
|
||||||
|
inoremap <buffer> <F9> <Esc> :execute line(".") 'w >> ~/.r-pipe'<CR>
|
||||||
|
|
||||||
|
" Send visual selected block to R
|
||||||
|
vnoremap <buffer> r :w >> ~/.r-pipe<CR>
|
||||||
|
|
||||||
|
" Write and process mode (somehow mapping <C-Enter> does not work)
|
||||||
|
inoremap <M-Enter> <Esc>:execute line(".") 'w >> ~/.r-pipe'<CR>o
|
||||||
|
|
||||||
|
" Send current file to R
|
||||||
|
noremap <buffer> <F5> :execute '1 ,' line("$") 'w >> ~/.r-pipe' <CR><CR>
|
||||||
48
ftplugin/rhelp.vim
Normal file
48
ftplugin/rhelp.vim
Normal file
@@ -0,0 +1,48 @@
|
|||||||
|
" ftplugin for R help files
|
||||||
|
"
|
||||||
|
" Author: Johannes Ranke <jranke@uni-bremen.de>
|
||||||
|
" Last Change: 2007 Nov 21
|
||||||
|
" SVN: $Id: rhelp.vim 75 2007-11-21 13:34:02Z ranke $
|
||||||
|
"
|
||||||
|
" Usage:
|
||||||
|
"
|
||||||
|
" Press <F2> to open a new xterm with a new R interpreter listening
|
||||||
|
" to its standard input (you can type R commands into the xterm)
|
||||||
|
" as well as to code pasted from within vim.
|
||||||
|
"
|
||||||
|
" After selecting a visual block, 'r' sends it to the R interpreter
|
||||||
|
"
|
||||||
|
" Add to filetypes.vim, if you don't use vim 7
|
||||||
|
" au BufNewFile,BufRead *.Rd,*.rd setf rhelp
|
||||||
|
"
|
||||||
|
" Maps:
|
||||||
|
" <F2> Start a listening R interpreter in new xterm
|
||||||
|
" <F9> Run line under cursor
|
||||||
|
" r Run visual block
|
||||||
|
" <M-Enter> Write and process R code
|
||||||
|
|
||||||
|
" Only do this when not yet done for this buffer
|
||||||
|
if exists("b:did_ftplugin")
|
||||||
|
finish
|
||||||
|
endif
|
||||||
|
|
||||||
|
" Don't load another plugin for this buffer
|
||||||
|
let b:did_ftplugin = 1
|
||||||
|
|
||||||
|
" Set tabbing
|
||||||
|
set expandtab
|
||||||
|
set tabstop=2
|
||||||
|
set shiftwidth=2
|
||||||
|
|
||||||
|
" Start a listening R interpreter in new xterm
|
||||||
|
noremap <buffer> <F2> :!xterm -T 'R' -e funnel.pl ~/.r-pipe "R && echo -e 'Interpreter has finished. Exiting. Goodbye.\n'"&<CR><CR>
|
||||||
|
|
||||||
|
" Send line under cursor to R
|
||||||
|
noremap <buffer> <F9> :execute line(".") 'w >> ~/.r-pipe'<CR>
|
||||||
|
inoremap <buffer> <F9> <Esc> :execute line(".") 'w >> ~/.r-pipe'<CR>
|
||||||
|
|
||||||
|
" Send visual selected block to R
|
||||||
|
vnoremap <buffer> r :w >> ~/.r-pipe<CR>
|
||||||
|
|
||||||
|
" Write and process mode (somehow mapping <C-Enter> does not work)
|
||||||
|
inoremap <M-Enter> <Esc>:execute line(".") 'w >> ~/.r-pipe'<CR>o
|
||||||
59
ftplugin/rnoweb.vim
Normal file
59
ftplugin/rnoweb.vim
Normal file
@@ -0,0 +1,59 @@
|
|||||||
|
" ftplugin for Sweave files containing both LaTeX and R code
|
||||||
|
"
|
||||||
|
" Maintainer: Johannes Ranke <jranke@uni-bremen.de>
|
||||||
|
" Last Change: 2007 Nov 21
|
||||||
|
" SVN: $Id: rnoweb.vim 75 2007-11-21 13:34:02Z ranke $
|
||||||
|
"
|
||||||
|
" Usage:
|
||||||
|
"
|
||||||
|
" Press <F2> to open a new xterm with a new R interpreter listening
|
||||||
|
" to its standard input (you can type R commands into the xterm)
|
||||||
|
" as well as to code pasted from within vim.
|
||||||
|
"
|
||||||
|
" A Makefile for producing R noweb files is in included in my Vim script
|
||||||
|
" R.vim:
|
||||||
|
" http://www.vim.org/scripts/script.php?script_id=1048
|
||||||
|
" You can also look in my SVN repository under:
|
||||||
|
" http://kri/viewcvs/*checkout*/Makefile.rnoweb?root=vim
|
||||||
|
"
|
||||||
|
"
|
||||||
|
" After selecting a visual block, 'r' sends it to the R interpreter
|
||||||
|
"
|
||||||
|
" Add to filetypes.vim, if you don't use vim 7
|
||||||
|
" au BufNewFile,BufRead *.Rnw,*.rnw setf rnoweb
|
||||||
|
" and/or
|
||||||
|
" au BufNewFile,BufRead *.Snw,*.snw setf rnoweb
|
||||||
|
"
|
||||||
|
" Maps:
|
||||||
|
" <F2> Start a listening R interpreter in new xterm
|
||||||
|
" <F9> Run line under cursor
|
||||||
|
" r Run visual block
|
||||||
|
" <M-Enter> Write and process R code
|
||||||
|
|
||||||
|
" Only do this when not yet done for this buffer
|
||||||
|
if exists("b:did_ftplugin")
|
||||||
|
finish
|
||||||
|
endif
|
||||||
|
|
||||||
|
" Don't load another plugin for this buffer
|
||||||
|
let b:did_ftplugin = 1
|
||||||
|
|
||||||
|
" Disable backup for .r-pipe
|
||||||
|
setl backupskip=.*pipe
|
||||||
|
|
||||||
|
" Set R friendly tabbing
|
||||||
|
set expandtab
|
||||||
|
set shiftwidth=2
|
||||||
|
|
||||||
|
" Start a listening R interpreter in new xterm
|
||||||
|
noremap <buffer> <F2> :!xterm -T 'R' -e funnel.pl ~/.r-pipe "R && echo -e 'Interpreter has finished. Exiting. Goodbye.\n'"&<CR><CR>
|
||||||
|
|
||||||
|
" Send line under cursor to R
|
||||||
|
noremap <buffer> <F9> :execute line(".") 'w >> ~/.r-pipe'<CR>
|
||||||
|
inoremap <buffer> <F9> <Esc> :execute line(".") 'w >> ~/.r-pipe'<CR>
|
||||||
|
|
||||||
|
" Send visual selected block to R
|
||||||
|
vnoremap <buffer> r :w >> ~/.r-pipe<CR>
|
||||||
|
|
||||||
|
" Write and process mode (somehow mapping <C-Enter> does not work)
|
||||||
|
inoremap <M-Enter> <Esc>:execute line(".") 'w >> ~/.r-pipe'<CR>o
|
||||||
45
ftplugin/rust.vim
Normal file
45
ftplugin/rust.vim
Normal file
@@ -0,0 +1,45 @@
|
|||||||
|
" Vim syntax file
|
||||||
|
" Language: Rust
|
||||||
|
" Maintainer: Chris Morgan <me@chrismorgan.info>
|
||||||
|
" Last Change: 2013 Jul 10
|
||||||
|
|
||||||
|
if exists("b:did_ftplugin")
|
||||||
|
finish
|
||||||
|
endif
|
||||||
|
let b:did_ftplugin = 1
|
||||||
|
|
||||||
|
" The rust source code at present seems to typically omit a leader on /*!
|
||||||
|
" comments, so we'll use that as our default, but make it easy to switch.
|
||||||
|
" This does not affect indentation at all (I tested it with and without
|
||||||
|
" leader), merely whether a leader is inserted by default or not.
|
||||||
|
if exists("g:rust_bang_comment_leader") && g:rust_bang_comment_leader == 1
|
||||||
|
" Why is the `,s0:/*,mb:\ ,ex:*/` there, you ask? I don't understand why,
|
||||||
|
" but without it, */ gets indented one space even if there were no
|
||||||
|
" leaders. I'm fairly sure that's a Vim bug.
|
||||||
|
setlocal comments=s1:/*,mb:*,ex:*/,s0:/*,mb:\ ,ex:*/,:///,://!,://
|
||||||
|
else
|
||||||
|
setlocal comments=s0:/*!,m:\ ,ex:*/,s1:/*,mb:*,ex:*/,:///,://!,://
|
||||||
|
endif
|
||||||
|
setlocal commentstring=//%s
|
||||||
|
setlocal formatoptions-=t formatoptions+=croqnl
|
||||||
|
" j was only added in 7.3.541, so stop complaints about its nonexistence
|
||||||
|
silent! setlocal formatoptions+=j
|
||||||
|
|
||||||
|
" This includeexpr isn't perfect, but it's a good start
|
||||||
|
setlocal includeexpr=substitute(v:fname,'::','/','g')
|
||||||
|
|
||||||
|
" NOT adding .rc as it's being phased out (0.7)
|
||||||
|
setlocal suffixesadd=.rs
|
||||||
|
|
||||||
|
if exists("g:ftplugin_rust_source_path")
|
||||||
|
let &l:path=g:ftplugin_rust_source_path . ',' . &l:path
|
||||||
|
endif
|
||||||
|
|
||||||
|
if exists("g:loaded_delimitMate")
|
||||||
|
if exists("b:delimitMate_excluded_regions")
|
||||||
|
let b:rust_original_delimitMate_excluded_regions = b:delimitMate_excluded_regions
|
||||||
|
endif
|
||||||
|
let b:delimitMate_excluded_regions = delimitMate#Get("excluded_regions") . ',rustLifetimeCandidate,rustGenericLifetimeCandidate'
|
||||||
|
endif
|
||||||
|
|
||||||
|
let b:undo_ftplugin = "setlocal formatoptions< comments< commentstring< includeexpr< suffixesadd< | if exists('b:rust_original_delimitMate_excluded_regions') | let b:delimitMate_excluded_regions = b:rust_original_delimitMate_excluded_regions | unlet b:rust_original_delimitMate_excluded_regions | elseif exists('b:delimitMate_excluded_regions') | unlet b:delimitMate_excluded_regions | endif"
|
||||||
13
ftplugin/tt2html.vim
Normal file
13
ftplugin/tt2html.vim
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
" Language: TT2 embedded with HTML
|
||||||
|
" Maintainer: vim-perl <vim-perl@googlegroups.com>
|
||||||
|
" Homepage: http://github.com/vim-perl/vim-perl
|
||||||
|
" Bugs/requests: http://github.com/vim-perl/vim-perl/issues
|
||||||
|
" Last Change: {{LAST_CHANGE}}
|
||||||
|
|
||||||
|
" Only do this when not done yet for this buffer
|
||||||
|
if exists("b:did_ftplugin")
|
||||||
|
finish
|
||||||
|
endif
|
||||||
|
|
||||||
|
" Just use the HTML plugin for now.
|
||||||
|
runtime! ftplugin/html.vim ftplugin/html_*.vim ftplugin/html/*.vim
|
||||||
10
ftplugin/typescript.vim
Normal file
10
ftplugin/typescript.vim
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
compiler typescript
|
||||||
|
|
||||||
|
setlocal autoindent
|
||||||
|
setlocal smartindent
|
||||||
|
setlocal indentexpr&
|
||||||
|
|
||||||
|
setlocal cindent
|
||||||
|
setlocal cino=j1J1
|
||||||
|
|
||||||
|
setlocal commentstring=//\ %s
|
||||||
14
ftplugin/xs.vim
Normal file
14
ftplugin/xs.vim
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
" Vim filetype plugin file
|
||||||
|
" Language: XS (Perl extension interface language)
|
||||||
|
" Maintainer: vim-perl <vim-perl@googlegroups.com>
|
||||||
|
" Homepage: http://github.com/vim-perl/vim-perl
|
||||||
|
" Bugs/requests: http://github.com/vim-perl/vim-perl/issues
|
||||||
|
" Last Change: {{LAST_CHANGE}}
|
||||||
|
|
||||||
|
" Only do this when not done yet for this buffer
|
||||||
|
if exists("b:did_ftplugin")
|
||||||
|
finish
|
||||||
|
endif
|
||||||
|
|
||||||
|
" Just use the C plugin for now.
|
||||||
|
runtime! ftplugin/c.vim ftplugin/c_*.vim ftplugin/c/*.vim
|
||||||
@@ -99,6 +99,16 @@ let s:SYNTAX_COMMENT = 'coffee\%(Comment\|BlockComment\|HeregexComment\)'
|
|||||||
" Syntax names for strings and comments
|
" Syntax names for strings and comments
|
||||||
let s:SYNTAX_STRING_COMMENT = s:SYNTAX_STRING . '\|' . s:SYNTAX_COMMENT
|
let s:SYNTAX_STRING_COMMENT = s:SYNTAX_STRING . '\|' . s:SYNTAX_COMMENT
|
||||||
|
|
||||||
|
" Compatibility code for shiftwidth() as recommended by the docs, but modified
|
||||||
|
" so there isn't as much of a penalty if shiftwidth() exists.
|
||||||
|
if exists('*shiftwidth')
|
||||||
|
let s:ShiftWidth = function('shiftwidth')
|
||||||
|
else
|
||||||
|
function! s:ShiftWidth()
|
||||||
|
return &shiftwidth
|
||||||
|
endfunction
|
||||||
|
endif
|
||||||
|
|
||||||
" Get the linked syntax name of a character.
|
" Get the linked syntax name of a character.
|
||||||
function! s:SyntaxName(lnum, col)
|
function! s:SyntaxName(lnum, col)
|
||||||
return synIDattr(synID(a:lnum, a:col, 1), 'name')
|
return synIDattr(synID(a:lnum, a:col, 1), 'name')
|
||||||
@@ -329,16 +339,16 @@ function! GetCoffeeIndent(curlnum)
|
|||||||
|
|
||||||
" Always indent after these operators.
|
" Always indent after these operators.
|
||||||
if prevline =~ s:BEGIN_BLOCK_OP
|
if prevline =~ s:BEGIN_BLOCK_OP
|
||||||
return indent(prevnlnum) + shiftwidth()
|
return indent(prevnlnum) + s:ShiftWidth()
|
||||||
endif
|
endif
|
||||||
|
|
||||||
" Indent if the previous line starts a function block, but don't force
|
" Indent if the previous line starts a function block, but don't force
|
||||||
" indenting if the line is non-blank (for empty function bodies.)
|
" indenting if the line is non-blank (for empty function bodies.)
|
||||||
if prevline =~ s:FUNCTION
|
if prevline =~ s:FUNCTION
|
||||||
if strlen(getline(a:curlnum)) > indent(a:curlnum)
|
if strlen(getline(a:curlnum)) > indent(a:curlnum)
|
||||||
return min([indent(prevnlnum) + shiftwidth(), indent(a:curlnum)])
|
return min([indent(prevnlnum) + s:ShiftWidth(), indent(a:curlnum)])
|
||||||
else
|
else
|
||||||
return indent(prevnlnum) + shiftwidth()
|
return indent(prevnlnum) + s:ShiftWidth()
|
||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
|
|
||||||
@@ -365,7 +375,7 @@ function! GetCoffeeIndent(curlnum)
|
|||||||
endif
|
endif
|
||||||
|
|
||||||
" Otherwise indent a level.
|
" Otherwise indent a level.
|
||||||
return indent(prevnlnum) + shiftwidth()
|
return indent(prevnlnum) + s:ShiftWidth()
|
||||||
endif
|
endif
|
||||||
|
|
||||||
" Check if the previous line starts with a keyword that begins a block.
|
" Check if the previous line starts with a keyword that begins a block.
|
||||||
@@ -374,7 +384,7 @@ function! GetCoffeeIndent(curlnum)
|
|||||||
" isn't a single-line statement.
|
" isn't a single-line statement.
|
||||||
if curline !~ '\C^\<then\>' && !s:SearchCode(prevnlnum, '\C\<then\>') &&
|
if curline !~ '\C^\<then\>' && !s:SearchCode(prevnlnum, '\C\<then\>') &&
|
||||||
\ prevline !~ s:SINGLE_LINE_ELSE
|
\ prevline !~ s:SINGLE_LINE_ELSE
|
||||||
return indent(prevnlnum) + shiftwidth()
|
return indent(prevnlnum) + s:ShiftWidth()
|
||||||
else
|
else
|
||||||
exec 'return' s:GetDefaultPolicy(a:curlnum)
|
exec 'return' s:GetDefaultPolicy(a:curlnum)
|
||||||
endif
|
endif
|
||||||
@@ -383,7 +393,7 @@ function! GetCoffeeIndent(curlnum)
|
|||||||
" Indent a dot access if it's the first.
|
" Indent a dot access if it's the first.
|
||||||
if curline =~ s:DOT_ACCESS
|
if curline =~ s:DOT_ACCESS
|
||||||
if prevline !~ s:DOT_ACCESS
|
if prevline !~ s:DOT_ACCESS
|
||||||
return indent(prevnlnum) + shiftwidth()
|
return indent(prevnlnum) + s:ShiftWidth()
|
||||||
else
|
else
|
||||||
exec 'return' s:GetDefaultPolicy(a:curlnum)
|
exec 'return' s:GetDefaultPolicy(a:curlnum)
|
||||||
endif
|
endif
|
||||||
@@ -396,7 +406,7 @@ function! GetCoffeeIndent(curlnum)
|
|||||||
\ s:SearchCode(prevnlnum, '\C\<then\>') &&
|
\ s:SearchCode(prevnlnum, '\C\<then\>') &&
|
||||||
\ !s:SearchCode(prevnlnum, s:CONTAINED_THEN)
|
\ !s:SearchCode(prevnlnum, s:CONTAINED_THEN)
|
||||||
" Don't force indenting.
|
" Don't force indenting.
|
||||||
return min([indent(a:curlnum), indent(prevnlnum) - shiftwidth()])
|
return min([indent(a:curlnum), indent(prevnlnum) - s:ShiftWidth()])
|
||||||
else
|
else
|
||||||
exec 'return' s:GetDefaultPolicy(a:curlnum)
|
exec 'return' s:GetDefaultPolicy(a:curlnum)
|
||||||
endif
|
endif
|
||||||
@@ -410,7 +420,7 @@ function! GetCoffeeIndent(curlnum)
|
|||||||
" If inside brackets, indent relative to the brackets, but don't outdent an
|
" If inside brackets, indent relative to the brackets, but don't outdent an
|
||||||
" already indented line.
|
" already indented line.
|
||||||
if matchlnum
|
if matchlnum
|
||||||
return max([indent(a:curlnum), indent(matchlnum) + shiftwidth()])
|
return max([indent(a:curlnum), indent(matchlnum) + s:ShiftWidth()])
|
||||||
endif
|
endif
|
||||||
|
|
||||||
" No special rules applied, so use the default policy.
|
" No special rules applied, so use the default policy.
|
||||||
|
|||||||
@@ -25,6 +25,7 @@ let s:block_skip = "synIDattr(synID(line('.'),col('.'),1),'name') =~? '" . s:s
|
|||||||
let s:block_start = 'do\|fn'
|
let s:block_start = 'do\|fn'
|
||||||
let s:block_middle = 'else\|match\|elsif\|catch\|after\|rescue'
|
let s:block_middle = 'else\|match\|elsif\|catch\|after\|rescue'
|
||||||
let s:block_end = 'end'
|
let s:block_end = 'end'
|
||||||
|
let s:pipeline = '^\s*|>.*$'
|
||||||
|
|
||||||
let s:indent_keywords = '\<\%(' . s:block_start . '\|' . s:block_middle . '\)$'
|
let s:indent_keywords = '\<\%(' . s:block_start . '\|' . s:block_middle . '\)$'
|
||||||
let s:deindent_keywords = '^\s*\<\%(' . s:block_end . '\|' . s:block_middle . '\)\>'
|
let s:deindent_keywords = '^\s*\<\%(' . s:block_end . '\|' . s:block_middle . '\)\>'
|
||||||
@@ -38,9 +39,39 @@ function! GetElixirIndent(...)
|
|||||||
return 0
|
return 0
|
||||||
endif
|
endif
|
||||||
|
|
||||||
if synIDattr(synID(v:lnum, 1, 1), "name") !~ '\(Comment\|String\)$'
|
if synIDattr(synID(v:lnum, 1, 1), "name") !~ s:skip_syntax
|
||||||
|
let splited_line = split(getline(lnum), '\zs')
|
||||||
|
let opened_symbol = 0
|
||||||
|
let opened_symbol += count(splited_line, '[') - count(splited_line, ']')
|
||||||
|
let opened_symbol += count(splited_line, '{') - count(splited_line, '}')
|
||||||
|
|
||||||
|
let ind += opened_symbol * &sw
|
||||||
|
|
||||||
if getline(lnum) =~ s:indent_keywords .
|
if getline(lnum) =~ s:indent_keywords .
|
||||||
\ '\|^\s*\%(^.*[\[{(].*[,:]\|.*->\)$'
|
\ '\|^\s*\%(.*->\)$'
|
||||||
|
let ind += &sw
|
||||||
|
endif
|
||||||
|
|
||||||
|
" if line starts with pipeline
|
||||||
|
" and last line doesn't start with pipeline
|
||||||
|
if getline(v:lnum) =~ s:pipeline &&
|
||||||
|
\ getline(lnum) !~ s:pipeline
|
||||||
|
let ind += &sw
|
||||||
|
endif
|
||||||
|
|
||||||
|
" if last line starts with pipeline
|
||||||
|
" and currentline doesn't start with pipeline
|
||||||
|
if getline(lnum) =~ s:pipeline &&
|
||||||
|
\ getline(v:lnum) !~ s:pipeline
|
||||||
|
let ind -= &sw
|
||||||
|
endif
|
||||||
|
|
||||||
|
" if last line starts with pipeline
|
||||||
|
" and current line doesn't start with pipeline
|
||||||
|
" but last line started a block
|
||||||
|
if getline(lnum) =~ s:pipeline &&
|
||||||
|
\ getline(v:lnum) !~ s:pipeline &&
|
||||||
|
\ getline(lnum) =~ s:block_start
|
||||||
let ind += &sw
|
let ind += &sw
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
|||||||
@@ -167,6 +167,16 @@ call add(s:tags, 'tr')
|
|||||||
call add(s:tags, 'th')
|
call add(s:tags, 'th')
|
||||||
call add(s:tags, 'td')
|
call add(s:tags, 'td')
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
let s:omittable = [
|
||||||
|
\ ['address', 'article', 'aside', 'blockquote', 'dir', 'div', 'dl', 'fieldset', 'footer', 'form', 'h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'header', 'hr', 'menu', 'nav', 'ol', 'p', 'pre', 'section', 'table', 'ul'],
|
||||||
|
\ ['dt', 'dd'],
|
||||||
|
\ ['li'],
|
||||||
|
\ ['thead', 'tbody', 'tfoot'],
|
||||||
|
\ ['th', 'td'],
|
||||||
|
\]
|
||||||
|
|
||||||
if exists('g:html_exclude_tags')
|
if exists('g:html_exclude_tags')
|
||||||
for tag in g:html_exclude_tags
|
for tag in g:html_exclude_tags
|
||||||
call remove(s:tags, index(s:tags, tag))
|
call remove(s:tags, index(s:tags, tag))
|
||||||
@@ -331,11 +341,35 @@ fun! HtmlIndentGet(lnum)
|
|||||||
let ind = ind - 1
|
let ind = ind - 1
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
let lind = indent(lnum)
|
||||||
|
|
||||||
|
" for tags in s:omittable
|
||||||
|
" let tags_exp = '<\(' . join(tags, '\|') . '\)>'
|
||||||
|
" let close_tags_exp = '</\(' . join(tags, '\|') . '\)>'
|
||||||
|
" if getline(a:lnum) =~ tags_exp
|
||||||
|
" let block_start = search('^'.repeat(' ', lind + (&sw * ind - 1)).'\S' , 'bnW')
|
||||||
|
" let prev_tag = search(tags_exp, 'bW', block_start)
|
||||||
|
" let prev_closetag = search(close_tags_exp, 'W', a:lnum)
|
||||||
|
" if prev_tag && !prev_closetag
|
||||||
|
" let ind = ind - 1
|
||||||
|
" endif
|
||||||
|
" endif
|
||||||
|
|
||||||
|
" if getline(a:lnum) =~ '</\w\+>'
|
||||||
|
" let block_start = search('^'.repeat(' ', lind + (&sw * ind - 1)).'\S' , 'bnW')
|
||||||
|
" let prev_tag = search(tags_exp, 'bW', block_start)
|
||||||
|
" let prev_closetag = search(close_tags_exp, 'W', a:lnum)
|
||||||
|
" if prev_tag && !prev_closetag
|
||||||
|
" let ind = ind - 1
|
||||||
|
" endif
|
||||||
|
" endif
|
||||||
|
" endfor
|
||||||
|
|
||||||
if restore_ic == 0
|
if restore_ic == 0
|
||||||
setlocal noic
|
setlocal noic
|
||||||
endif
|
endif
|
||||||
|
|
||||||
return indent(lnum) + (&sw * ind)
|
return lind + (&sw * ind)
|
||||||
endfun
|
endfun
|
||||||
|
|
||||||
let &cpo = s:cpo_save
|
let &cpo = s:cpo_save
|
||||||
|
|||||||
183
indent/perl.vim
Normal file
183
indent/perl.vim
Normal file
@@ -0,0 +1,183 @@
|
|||||||
|
" Vim indent file
|
||||||
|
" Language: Perl 5
|
||||||
|
" Maintainer: vim-perl <vim-perl@googlegroups.com>
|
||||||
|
" Homepage: http://github.com/vim-perl/vim-perl
|
||||||
|
" Bugs/requests: http://github.com/vim-perl/vim-perl/issues
|
||||||
|
" Last Change: {{LAST_CHANGE}}
|
||||||
|
|
||||||
|
" Suggestions and improvements by :
|
||||||
|
" Aaron J. Sherman (use syntax for hints)
|
||||||
|
" Artem Chuprina (play nice with folding)
|
||||||
|
|
||||||
|
" TODO things that are not or not properly indented (yet) :
|
||||||
|
" - Continued statements
|
||||||
|
" print "foo",
|
||||||
|
" "bar";
|
||||||
|
" print "foo"
|
||||||
|
" if bar();
|
||||||
|
" - Multiline regular expressions (m//x)
|
||||||
|
" (The following probably needs modifying the perl syntax file)
|
||||||
|
" - qw() lists
|
||||||
|
" - Heredocs with terminators that don't match \I\i*
|
||||||
|
|
||||||
|
" Only load this indent file when no other was loaded.
|
||||||
|
if exists("b:did_indent")
|
||||||
|
finish
|
||||||
|
endif
|
||||||
|
let b:did_indent = 1
|
||||||
|
|
||||||
|
" Is syntax highlighting active ?
|
||||||
|
let b:indent_use_syntax = has("syntax")
|
||||||
|
|
||||||
|
setlocal indentexpr=GetPerlIndent()
|
||||||
|
setlocal indentkeys+=0=,0),0],0=or,0=and
|
||||||
|
if !b:indent_use_syntax
|
||||||
|
setlocal indentkeys+=0=EO
|
||||||
|
endif
|
||||||
|
|
||||||
|
let s:cpo_save = &cpo
|
||||||
|
set cpo-=C
|
||||||
|
|
||||||
|
function! GetPerlIndent()
|
||||||
|
|
||||||
|
" Get the line to be indented
|
||||||
|
let cline = getline(v:lnum)
|
||||||
|
|
||||||
|
" Indent POD markers to column 0
|
||||||
|
if cline =~ '^\s*=\L\@!'
|
||||||
|
return 0
|
||||||
|
endif
|
||||||
|
|
||||||
|
" Don't reindent comments on first column
|
||||||
|
if cline =~ '^#.'
|
||||||
|
return 0
|
||||||
|
endif
|
||||||
|
|
||||||
|
" Get current syntax item at the line's first char
|
||||||
|
let csynid = ''
|
||||||
|
if b:indent_use_syntax
|
||||||
|
let csynid = synIDattr(synID(v:lnum,1,0),"name")
|
||||||
|
endif
|
||||||
|
|
||||||
|
" Don't reindent POD and heredocs
|
||||||
|
if csynid == "perlPOD" || csynid == "perlHereDoc" || csynid =~ "^pod"
|
||||||
|
return indent(v:lnum)
|
||||||
|
endif
|
||||||
|
|
||||||
|
" Indent end-of-heredocs markers to column 0
|
||||||
|
if b:indent_use_syntax
|
||||||
|
" Assumes that an end-of-heredoc marker matches \I\i* to avoid
|
||||||
|
" confusion with other types of strings
|
||||||
|
if csynid == "perlStringStartEnd" && cline =~ '^\I\i*$'
|
||||||
|
return 0
|
||||||
|
endif
|
||||||
|
else
|
||||||
|
" Without syntax hints, assume that end-of-heredocs markers begin with EO
|
||||||
|
if cline =~ '^\s*EO'
|
||||||
|
return 0
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
|
||||||
|
" Now get the indent of the previous perl line.
|
||||||
|
|
||||||
|
" Find a non-blank 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)
|
||||||
|
let ind = indent(lnum)
|
||||||
|
" Skip heredocs, POD, and comments on 1st column
|
||||||
|
if b:indent_use_syntax
|
||||||
|
let skippin = 2
|
||||||
|
while skippin
|
||||||
|
let synid = synIDattr(synID(lnum,1,0),"name")
|
||||||
|
if (synid == "perlStringStartEnd" && line =~ '^\I\i*$')
|
||||||
|
\ || (skippin != 2 && synid == "perlPOD")
|
||||||
|
\ || (skippin != 2 && synid == "perlHereDoc")
|
||||||
|
\ || synid == "perlComment"
|
||||||
|
\ || synid =~ "^pod"
|
||||||
|
let lnum = prevnonblank(lnum - 1)
|
||||||
|
if lnum == 0
|
||||||
|
return 0
|
||||||
|
endif
|
||||||
|
let line = getline(lnum)
|
||||||
|
let ind = indent(lnum)
|
||||||
|
let skippin = 1
|
||||||
|
else
|
||||||
|
let skippin = 0
|
||||||
|
endif
|
||||||
|
endwhile
|
||||||
|
else
|
||||||
|
if line =~ "^EO"
|
||||||
|
let lnum = search("<<[\"']\\=EO", "bW")
|
||||||
|
let line = getline(lnum)
|
||||||
|
let ind = indent(lnum)
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
|
||||||
|
" Indent blocks enclosed by {}, (), or []
|
||||||
|
if b:indent_use_syntax
|
||||||
|
" Find a real opening brace
|
||||||
|
" NOTE: Unlike Perl character classes, we do NOT need to escape the
|
||||||
|
" closing brackets with a backslash. Doing so just puts a backslash
|
||||||
|
" in the character class and causes sorrow. Instead, put the closing
|
||||||
|
" bracket as the first character in the class.
|
||||||
|
let braceclass = '[][(){}]'
|
||||||
|
let bracepos = match(line, braceclass, matchend(line, '^\s*[])}]'))
|
||||||
|
while bracepos != -1
|
||||||
|
let synid = synIDattr(synID(lnum, bracepos + 1, 0), "name")
|
||||||
|
" If the brace is highlighted in one of those groups, indent it.
|
||||||
|
" 'perlHereDoc' is here only to handle the case '&foo(<<EOF)'.
|
||||||
|
if synid == ""
|
||||||
|
\ || synid == "perlMatchStartEnd"
|
||||||
|
\ || synid == "perlHereDoc"
|
||||||
|
\ || synid == "perlBraces"
|
||||||
|
\ || synid =~ "^perlFiledescStatement"
|
||||||
|
\ || synid =~ '^perl\(Sub\|Block\|Package\)Fold'
|
||||||
|
let brace = strpart(line, bracepos, 1)
|
||||||
|
if brace == '(' || brace == '{' || brace == '['
|
||||||
|
let ind = ind + &sw
|
||||||
|
else
|
||||||
|
let ind = ind - &sw
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
let bracepos = match(line, braceclass, bracepos + 1)
|
||||||
|
endwhile
|
||||||
|
let bracepos = matchend(cline, '^\s*[])}]')
|
||||||
|
if bracepos != -1
|
||||||
|
let synid = synIDattr(synID(v:lnum, bracepos, 0), "name")
|
||||||
|
if synid == ""
|
||||||
|
\ || synid == "perlMatchStartEnd"
|
||||||
|
\ || synid == "perlBraces"
|
||||||
|
\ || synid =~ '^perl\(Sub\|Block\|Package\)Fold'
|
||||||
|
let ind = ind - &sw
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
else
|
||||||
|
if line =~ '[{[(]\s*\(#[^])}]*\)\=$'
|
||||||
|
let ind = ind + &sw
|
||||||
|
endif
|
||||||
|
if cline =~ '^\s*[])}]'
|
||||||
|
let ind = ind - &sw
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
|
||||||
|
" Indent lines that begin with 'or' or 'and'
|
||||||
|
if cline =~ '^\s*\(or\|and\)\>'
|
||||||
|
if line !~ '^\s*\(or\|and\)\>'
|
||||||
|
let ind = ind + &sw
|
||||||
|
endif
|
||||||
|
elseif line =~ '^\s*\(or\|and\)\>'
|
||||||
|
let ind = ind - &sw
|
||||||
|
endif
|
||||||
|
|
||||||
|
return ind
|
||||||
|
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
let &cpo = s:cpo_save
|
||||||
|
unlet s:cpo_save
|
||||||
|
|
||||||
|
" vim:ts=8:sts=4:sw=4:expandtab:ft=vim
|
||||||
132
indent/perl6.vim
Normal file
132
indent/perl6.vim
Normal file
@@ -0,0 +1,132 @@
|
|||||||
|
" Vim indent file
|
||||||
|
" Language: Perl 6
|
||||||
|
" Maintainer: vim-perl <vim-perl@googlegroups.com>
|
||||||
|
" Homepage: http://github.com/vim-perl/vim-perl
|
||||||
|
" Bugs/requests: http://github.com/vim-perl/vim-perl/issues
|
||||||
|
" Last Change: {{LAST_CHANGE}}
|
||||||
|
" Contributors: Andy Lester <andy@petdance.com>
|
||||||
|
" Hinrik Örn Sigurðsson <hinrik.sig@gmail.com>
|
||||||
|
"
|
||||||
|
" Adapted from indent/perl.vim by Rafael Garcia-Suarez <rgarciasuarez@free.fr>
|
||||||
|
|
||||||
|
" Suggestions and improvements by :
|
||||||
|
" Aaron J. Sherman (use syntax for hints)
|
||||||
|
" Artem Chuprina (play nice with folding)
|
||||||
|
" TODO:
|
||||||
|
" This file still relies on stuff from the Perl 5 syntax file, which Perl 6
|
||||||
|
" does not use.
|
||||||
|
"
|
||||||
|
" Things that are not or not properly indented (yet) :
|
||||||
|
" - Continued statements
|
||||||
|
" print "foo",
|
||||||
|
" "bar";
|
||||||
|
" print "foo"
|
||||||
|
" if bar();
|
||||||
|
" - Multiline regular expressions (m//x)
|
||||||
|
" (The following probably needs modifying the perl syntax file)
|
||||||
|
" - qw() lists
|
||||||
|
" - Heredocs with terminators that don't match \I\i*
|
||||||
|
|
||||||
|
" Only load this indent file when no other was loaded.
|
||||||
|
if exists("b:did_indent")
|
||||||
|
finish
|
||||||
|
endif
|
||||||
|
let b:did_indent = 1
|
||||||
|
|
||||||
|
" Is syntax highlighting active ?
|
||||||
|
let b:indent_use_syntax = has("syntax")
|
||||||
|
|
||||||
|
setlocal indentexpr=GetPerl6Indent()
|
||||||
|
|
||||||
|
" we reset it first because the Perl 5 indent file might have been loaded due
|
||||||
|
" to a .pl/pm file extension, and indent files don't clean up afterwards
|
||||||
|
setlocal indentkeys&
|
||||||
|
|
||||||
|
setlocal indentkeys+=0=,0),0],0>,0»,0=or,0=and
|
||||||
|
if !b:indent_use_syntax
|
||||||
|
setlocal indentkeys+=0=EO
|
||||||
|
endif
|
||||||
|
|
||||||
|
let s:cpo_save = &cpo
|
||||||
|
set cpo-=C
|
||||||
|
|
||||||
|
function! GetPerl6Indent()
|
||||||
|
|
||||||
|
" Get the line to be indented
|
||||||
|
let cline = getline(v:lnum)
|
||||||
|
|
||||||
|
" Indent POD markers to column 0
|
||||||
|
if cline =~ '^\s*=\L\@!'
|
||||||
|
return 0
|
||||||
|
endif
|
||||||
|
|
||||||
|
" Don't reindent coments on first column
|
||||||
|
if cline =~ '^#'
|
||||||
|
return 0
|
||||||
|
endif
|
||||||
|
|
||||||
|
" Get current syntax item at the line's first char
|
||||||
|
let csynid = ''
|
||||||
|
if b:indent_use_syntax
|
||||||
|
let csynid = synIDattr(synID(v:lnum,1,0),"name")
|
||||||
|
endif
|
||||||
|
|
||||||
|
" Don't reindent POD and heredocs
|
||||||
|
if csynid =~ "^p6Pod"
|
||||||
|
return indent(v:lnum)
|
||||||
|
endif
|
||||||
|
|
||||||
|
|
||||||
|
" Now get the indent of the previous perl line.
|
||||||
|
|
||||||
|
" Find a non-blank 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)
|
||||||
|
let ind = indent(lnum)
|
||||||
|
" Skip heredocs, POD, and comments on 1st column
|
||||||
|
if b:indent_use_syntax
|
||||||
|
let skippin = 2
|
||||||
|
while skippin
|
||||||
|
let synid = synIDattr(synID(lnum,1,0),"name")
|
||||||
|
if (synid =~ "^p6Pod" || synid =~ "p6Comment")
|
||||||
|
let lnum = prevnonblank(lnum - 1)
|
||||||
|
if lnum == 0
|
||||||
|
return 0
|
||||||
|
endif
|
||||||
|
let line = getline(lnum)
|
||||||
|
let ind = indent(lnum)
|
||||||
|
let skippin = 1
|
||||||
|
else
|
||||||
|
let skippin = 0
|
||||||
|
endif
|
||||||
|
endwhile
|
||||||
|
endif
|
||||||
|
|
||||||
|
if line =~ '[<«\[{(]\s*\(#[^)}\]»>]*\)\=$'
|
||||||
|
let ind = ind + &sw
|
||||||
|
endif
|
||||||
|
if cline =~ '^\s*[)}\]»>]'
|
||||||
|
let ind = ind - &sw
|
||||||
|
endif
|
||||||
|
|
||||||
|
" Indent lines that begin with 'or' or 'and'
|
||||||
|
if cline =~ '^\s*\(or\|and\)\>'
|
||||||
|
if line !~ '^\s*\(or\|and\)\>'
|
||||||
|
let ind = ind + &sw
|
||||||
|
endif
|
||||||
|
elseif line =~ '^\s*\(or\|and\)\>'
|
||||||
|
let ind = ind - &sw
|
||||||
|
endif
|
||||||
|
|
||||||
|
return ind
|
||||||
|
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
let &cpo = s:cpo_save
|
||||||
|
unlet s:cpo_save
|
||||||
|
|
||||||
|
" vim:ts=8:sts=4:sw=4:expandtab:ft=vim
|
||||||
@@ -34,7 +34,7 @@ set cpo&vim
|
|||||||
" Regex of syntax group names that are or delimit strings/symbols or are comments.
|
" Regex of syntax group names that are or delimit strings/symbols or are comments.
|
||||||
let s:syng_strcom = '\<ruby\%(Regexp\|RegexpDelimiter\|RegexpEscape' .
|
let s:syng_strcom = '\<ruby\%(Regexp\|RegexpDelimiter\|RegexpEscape' .
|
||||||
\ '\|Symbol\|String\|StringDelimiter\|StringEscape\|ASCIICode' .
|
\ '\|Symbol\|String\|StringDelimiter\|StringEscape\|ASCIICode' .
|
||||||
\ '\|Interpolation\|NoInterpolation\|Comment\|Documentation\)\>'
|
\ '\|Interpolation\|InterpolationDelimiter\|NoInterpolation\|Comment\|Documentation\)\>'
|
||||||
|
|
||||||
" Regex of syntax group names that are strings.
|
" Regex of syntax group names that are strings.
|
||||||
let s:syng_string =
|
let s:syng_string =
|
||||||
@@ -175,7 +175,7 @@ function s:GetMSL(lnum)
|
|||||||
" something
|
" something
|
||||||
"
|
"
|
||||||
return msl
|
return msl
|
||||||
elseif s:Match(line, s:non_bracket_continuation_regex) &&
|
elseif s:Match(lnum, s:non_bracket_continuation_regex) &&
|
||||||
\ s:Match(msl, s:non_bracket_continuation_regex)
|
\ s:Match(msl, s:non_bracket_continuation_regex)
|
||||||
" If the current line is a non-bracket continuation and so is the
|
" If the current line is a non-bracket continuation and so is the
|
||||||
" previous one, keep its indent and continue looking for an MSL.
|
" previous one, keep its indent and continue looking for an MSL.
|
||||||
@@ -299,18 +299,20 @@ function s:ExtraBrackets(lnum)
|
|||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function s:Match(lnum, regex)
|
function s:Match(lnum, regex)
|
||||||
let col = match(getline(a:lnum), '\C'.a:regex) + 1
|
let line = getline(a:lnum)
|
||||||
return col > 0 && !s:IsInStringOrComment(a:lnum, col) ? col : 0
|
let offset = match(line, '\C'.a:regex)
|
||||||
endfunction
|
let col = offset + 1
|
||||||
|
|
||||||
function s:MatchLast(lnum, regex)
|
while offset > -1 && s:IsInStringOrComment(a:lnum, col)
|
||||||
let line = getline(a:lnum)
|
let offset = match(line, '\C'.a:regex, offset + 1)
|
||||||
let col = match(line, '.*\zs' . a:regex)
|
let col = offset + 1
|
||||||
while col != -1 && s:IsInStringOrComment(a:lnum, col)
|
|
||||||
let line = strpart(line, 0, col)
|
|
||||||
let col = match(line, '.*' . a:regex)
|
|
||||||
endwhile
|
endwhile
|
||||||
return col + 1
|
|
||||||
|
if offset > -1
|
||||||
|
return col
|
||||||
|
else
|
||||||
|
return 0
|
||||||
|
endif
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
" 3. GetRubyIndent Function {{{1
|
" 3. GetRubyIndent Function {{{1
|
||||||
|
|||||||
162
indent/rust.vim
Normal file
162
indent/rust.vim
Normal file
@@ -0,0 +1,162 @@
|
|||||||
|
" Vim indent file
|
||||||
|
" Language: Rust
|
||||||
|
" Author: Chris Morgan <me@chrismorgan.info>
|
||||||
|
" Last Change: 2013 Oct 29
|
||||||
|
|
||||||
|
" Only load this indent file when no other was loaded.
|
||||||
|
if exists("b:did_indent")
|
||||||
|
finish
|
||||||
|
endif
|
||||||
|
let b:did_indent = 1
|
||||||
|
|
||||||
|
setlocal cindent
|
||||||
|
setlocal cinoptions=L0,(0,Ws,JN,j1
|
||||||
|
setlocal cinkeys=0{,0},!^F,o,O,0[,0]
|
||||||
|
" Don't think cinwords will actually do anything at all... never mind
|
||||||
|
setlocal cinwords=do,for,if,else,while,loop,impl,mod,unsafe,trait,struct,enum,fn,extern
|
||||||
|
|
||||||
|
" Some preliminary settings
|
||||||
|
setlocal nolisp " Make sure lisp indenting doesn't supersede us
|
||||||
|
setlocal autoindent " indentexpr isn't much help otherwise
|
||||||
|
" Also do indentkeys, otherwise # gets shoved to column 0 :-/
|
||||||
|
setlocal indentkeys=0{,0},!^F,o,O,0[,0]
|
||||||
|
|
||||||
|
setlocal indentexpr=GetRustIndent(v:lnum)
|
||||||
|
|
||||||
|
" Only define the function once.
|
||||||
|
if exists("*GetRustIndent")
|
||||||
|
finish
|
||||||
|
endif
|
||||||
|
|
||||||
|
" Come here when loading the script the first time.
|
||||||
|
|
||||||
|
function s:get_line_trimmed(lnum)
|
||||||
|
" Get the line and remove a trailing comment.
|
||||||
|
" Use syntax highlighting attributes when possible.
|
||||||
|
" NOTE: this is not accurate; /* */ or a line continuation could trick it
|
||||||
|
let line = getline(a:lnum)
|
||||||
|
let line_len = strlen(line)
|
||||||
|
if has('syntax_items')
|
||||||
|
" If the last character in the line is a comment, do a binary search for
|
||||||
|
" the start of the comment. synID() is slow, a linear search would take
|
||||||
|
" too long on a long line.
|
||||||
|
if synIDattr(synID(a:lnum, line_len, 1), "name") =~ "Comment\|Todo"
|
||||||
|
let min = 1
|
||||||
|
let max = line_len
|
||||||
|
while min < max
|
||||||
|
let col = (min + max) / 2
|
||||||
|
if synIDattr(synID(a:lnum, col, 1), "name") =~ "Comment\|Todo"
|
||||||
|
let max = col
|
||||||
|
else
|
||||||
|
let min = col + 1
|
||||||
|
endif
|
||||||
|
endwhile
|
||||||
|
let line = strpart(line, 0, min - 1)
|
||||||
|
endif
|
||||||
|
return substitute(line, "\s*$", "", "")
|
||||||
|
else
|
||||||
|
" Sorry, this is not complete, nor fully correct (e.g. string "//").
|
||||||
|
" Such is life.
|
||||||
|
return substitute(line, "\s*//.*$", "", "")
|
||||||
|
endif
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
function GetRustIndent(lnum)
|
||||||
|
|
||||||
|
" Starting assumption: cindent (called at the end) will do it right
|
||||||
|
" normally. We just want to fix up a few cases.
|
||||||
|
|
||||||
|
let line = getline(a:lnum)
|
||||||
|
|
||||||
|
if has('syntax_items')
|
||||||
|
let synname = synIDattr(synID(a:lnum, 1, 1), "name")
|
||||||
|
if synname == "rustString"
|
||||||
|
" If the start of the line is in a string, don't change the indent
|
||||||
|
return -1
|
||||||
|
elseif synname =~ "\\(Comment\\|Todo\\)"
|
||||||
|
\ && line !~ "^\\s*/\\*" " not /* opening line
|
||||||
|
if synname =~ "CommentML" " multi-line
|
||||||
|
if line !~ "^\\s*\\*" && getline(a:lnum - 1) =~ "^\\s*/\\*"
|
||||||
|
" This is (hopefully) the line after a /*, and it has no
|
||||||
|
" leader, so the correct indentation is that of the
|
||||||
|
" previous line.
|
||||||
|
return GetRustIndent(a:lnum - 1)
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
" If it's in a comment, let cindent take care of it now. This is
|
||||||
|
" for cases like "/*" where the next line should start " * ", not
|
||||||
|
" "* " as the code below would otherwise cause for module scope
|
||||||
|
" Fun fact: " /*\n*\n*/" takes two calls to get right!
|
||||||
|
return cindent(a:lnum)
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
|
||||||
|
" cindent gets second and subsequent match patterns/struct members wrong,
|
||||||
|
" as it treats the comma as indicating an unfinished statement::
|
||||||
|
"
|
||||||
|
" match a {
|
||||||
|
" b => c,
|
||||||
|
" d => e,
|
||||||
|
" f => g,
|
||||||
|
" };
|
||||||
|
|
||||||
|
" Search backwards for the previous non-empty line.
|
||||||
|
let prevline = s:get_line_trimmed(prevnonblank(a:lnum - 1))
|
||||||
|
if prevline[len(prevline) - 1] == ","
|
||||||
|
\ && s:get_line_trimmed(a:lnum) !~ "^\\s*[\\[\\]{}]"
|
||||||
|
\ && prevline !~ "^\\s*fn\\s"
|
||||||
|
" Oh ho! The previous line ended in a comma! I bet cindent will try to
|
||||||
|
" take this too far... For now, let's normally use the previous line's
|
||||||
|
" indent.
|
||||||
|
|
||||||
|
" One case where this doesn't work out is where *this* line contains
|
||||||
|
" square or curly brackets; then we normally *do* want to be indenting
|
||||||
|
" further.
|
||||||
|
"
|
||||||
|
" Another case where we don't want to is one like a function
|
||||||
|
" definition with arguments spread over multiple lines:
|
||||||
|
"
|
||||||
|
" fn foo(baz: Baz,
|
||||||
|
" baz: Baz) // <-- cindent gets this right by itself
|
||||||
|
"
|
||||||
|
" There are probably other cases where we don't want to do this as
|
||||||
|
" well. Add them as needed.
|
||||||
|
return GetRustIndent(a:lnum - 1)
|
||||||
|
endif
|
||||||
|
|
||||||
|
" cindent doesn't do the module scope well at all; e.g.::
|
||||||
|
"
|
||||||
|
" static FOO : &'static [bool] = [
|
||||||
|
" true,
|
||||||
|
" false,
|
||||||
|
" false,
|
||||||
|
" true,
|
||||||
|
" ];
|
||||||
|
"
|
||||||
|
" uh oh, next statement is indented further!
|
||||||
|
|
||||||
|
" Note that this does *not* apply the line continuation pattern properly;
|
||||||
|
" that's too hard to do correctly for my liking at present, so I'll just
|
||||||
|
" start with these two main cases (square brackets and not returning to
|
||||||
|
" column zero)
|
||||||
|
|
||||||
|
call cursor(a:lnum, 1)
|
||||||
|
if searchpair('{\|(', '', '}\|)', 'nbW') == 0
|
||||||
|
if searchpair('\[', '', '\]', 'nbW') == 0
|
||||||
|
" Global scope, should be zero
|
||||||
|
return 0
|
||||||
|
else
|
||||||
|
" At the module scope, inside square brackets only
|
||||||
|
"if getline(a:lnum)[0] == ']' || search('\[', '', '\]', 'nW') == a:lnum
|
||||||
|
if line =~ "^\\s*]"
|
||||||
|
" It's the closing line, dedent it
|
||||||
|
return 0
|
||||||
|
else
|
||||||
|
return &shiftwidth
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
|
||||||
|
" Fall back on cindent, which does it mostly right
|
||||||
|
return cindent(a:lnum)
|
||||||
|
endfunction
|
||||||
@@ -1,6 +1,9 @@
|
|||||||
" LaTeX indent file (part of LaTeX Box)
|
" LaTeX indent file (part of LaTeX Box)
|
||||||
" Maintainer: David Munger (mungerd@gmail.com)
|
" Maintainer: David Munger (mungerd@gmail.com)
|
||||||
|
|
||||||
|
if exists("g:LatexBox_custom_indent") && ! g:LatexBox_custom_indent
|
||||||
|
finish
|
||||||
|
endif
|
||||||
if exists("b:did_indent")
|
if exists("b:did_indent")
|
||||||
finish
|
finish
|
||||||
endif
|
endif
|
||||||
|
|||||||
16
syntax/c.vim
16
syntax/c.vim
@@ -1,7 +1,7 @@
|
|||||||
" Vim syntax file
|
" Vim syntax file
|
||||||
" Language: C
|
" Language: C
|
||||||
" Maintainer: Bram Moolenaar <Bram@vim.org>
|
" Maintainer: Bram Moolenaar <Bram@vim.org>
|
||||||
" Last Change: 2013 Jun 06
|
" Last Change: 2013 Jul 05
|
||||||
|
|
||||||
" Quit when a (custom) syntax file was already loaded
|
" Quit when a (custom) syntax file was already loaded
|
||||||
if exists("b:current_syntax")
|
if exists("b:current_syntax")
|
||||||
@@ -11,6 +11,8 @@ endif
|
|||||||
let s:cpo_save = &cpo
|
let s:cpo_save = &cpo
|
||||||
set cpo&vim
|
set cpo&vim
|
||||||
|
|
||||||
|
let s:ft = matchstr(&ft, '^\([^.]\)\+')
|
||||||
|
|
||||||
" A bunch of useful C keywords
|
" A bunch of useful C keywords
|
||||||
syn keyword cStatement goto break return continue asm
|
syn keyword cStatement goto break return continue asm
|
||||||
syn keyword cLabel case default
|
syn keyword cLabel case default
|
||||||
@@ -110,7 +112,7 @@ endif
|
|||||||
" But avoid matching <::.
|
" But avoid matching <::.
|
||||||
syn cluster cParenGroup contains=cParenError,cIncluded,cSpecial,cCommentSkip,cCommentString,cComment2String,@cCommentGroup,cCommentStartError,cUserLabel,cBitField,cOctalZero,@cCppOutInGroup,cFormat,cNumber,cFloat,cOctal,cOctalError,cNumbersCom
|
syn cluster cParenGroup contains=cParenError,cIncluded,cSpecial,cCommentSkip,cCommentString,cComment2String,@cCommentGroup,cCommentStartError,cUserLabel,cBitField,cOctalZero,@cCppOutInGroup,cFormat,cNumber,cFloat,cOctal,cOctalError,cNumbersCom
|
||||||
if exists("c_no_curly_error")
|
if exists("c_no_curly_error")
|
||||||
if &filetype ==# 'cpp' && !exists("cpp_no_cpp11")
|
if s:ft ==# 'cpp' && !exists("cpp_no_cpp11")
|
||||||
syn region cParen transparent start='(' end=')' contains=ALLBUT,@cParenGroup,cCppParen,cCppString,@Spell
|
syn region cParen transparent start='(' end=')' contains=ALLBUT,@cParenGroup,cCppParen,cCppString,@Spell
|
||||||
" cCppParen: same as cParen but ends at end-of-line; used in cDefine
|
" cCppParen: same as cParen but ends at end-of-line; used in cDefine
|
||||||
syn region cCppParen transparent start='(' skip='\\$' excludenl end=')' end='$' contained contains=ALLBUT,@cParenGroup,cParen,cString,@Spell
|
syn region cCppParen transparent start='(' skip='\\$' excludenl end=')' end='$' contained contains=ALLBUT,@cParenGroup,cParen,cString,@Spell
|
||||||
@@ -124,7 +126,7 @@ if exists("c_no_curly_error")
|
|||||||
syn match cErrInParen display contained "^[{}]\|^<%\|^%>"
|
syn match cErrInParen display contained "^[{}]\|^<%\|^%>"
|
||||||
endif
|
endif
|
||||||
elseif exists("c_no_bracket_error")
|
elseif exists("c_no_bracket_error")
|
||||||
if &filetype ==# 'cpp' && !exists("cpp_no_cpp11")
|
if s:ft ==# 'cpp' && !exists("cpp_no_cpp11")
|
||||||
syn region cParen transparent start='(' end=')' contains=ALLBUT,@cParenGroup,cCppParen,cCppString,@Spell
|
syn region cParen transparent start='(' end=')' contains=ALLBUT,@cParenGroup,cCppParen,cCppString,@Spell
|
||||||
" cCppParen: same as cParen but ends at end-of-line; used in cDefine
|
" cCppParen: same as cParen but ends at end-of-line; used in cDefine
|
||||||
syn region cCppParen transparent start='(' skip='\\$' excludenl end=')' end='$' contained contains=ALLBUT,@cParenGroup,cParen,cString,@Spell
|
syn region cCppParen transparent start='(' skip='\\$' excludenl end=')' end='$' contained contains=ALLBUT,@cParenGroup,cParen,cString,@Spell
|
||||||
@@ -138,7 +140,7 @@ elseif exists("c_no_bracket_error")
|
|||||||
syn match cErrInParen display contained "[{}]\|<%\|%>"
|
syn match cErrInParen display contained "[{}]\|<%\|%>"
|
||||||
endif
|
endif
|
||||||
else
|
else
|
||||||
if &filetype ==# 'cpp' && !exists("cpp_no_cpp11")
|
if s:ft ==# 'cpp' && !exists("cpp_no_cpp11")
|
||||||
syn region cParen transparent start='(' end=')' contains=ALLBUT,@cParenGroup,cCppParen,cErrInBracket,cCppBracket,cCppString,@Spell
|
syn region cParen transparent start='(' end=')' contains=ALLBUT,@cParenGroup,cCppParen,cErrInBracket,cCppBracket,cCppString,@Spell
|
||||||
" cCppParen: same as cParen but ends at end-of-line; used in cDefine
|
" cCppParen: same as cParen but ends at end-of-line; used in cDefine
|
||||||
syn region cCppParen transparent start='(' skip='\\$' excludenl end=')' end='$' contained contains=ALLBUT,@cParenGroup,cErrInBracket,cParen,cBracket,cString,@Spell
|
syn region cCppParen transparent start='(' skip='\\$' excludenl end=')' end='$' contained contains=ALLBUT,@cParenGroup,cErrInBracket,cParen,cBracket,cString,@Spell
|
||||||
@@ -158,7 +160,7 @@ else
|
|||||||
syn match cErrInBracket display contained "[);{}]\|<%\|%>"
|
syn match cErrInBracket display contained "[);{}]\|<%\|%>"
|
||||||
endif
|
endif
|
||||||
|
|
||||||
if &filetype ==# 'c' || exists("cpp_no_cpp11")
|
if s:ft ==# 'c' || exists("cpp_no_cpp11")
|
||||||
syn region cBadBlock keepend start="{" end="}" contained containedin=cParen,cBracket,cBadBlock transparent fold
|
syn region cBadBlock keepend start="{" end="}" contained containedin=cParen,cBracket,cBadBlock transparent fold
|
||||||
endif
|
endif
|
||||||
|
|
||||||
@@ -370,7 +372,7 @@ syn region cPreProc start="^\s*\(%:\|#\)\s*\(pragma\>\|line\>\|warning\>\|warn\>
|
|||||||
|
|
||||||
" Highlight User Labels
|
" Highlight User Labels
|
||||||
syn cluster cMultiGroup contains=cIncluded,cSpecial,cCommentSkip,cCommentString,cComment2String,@cCommentGroup,cCommentStartError,cUserCont,cUserLabel,cBitField,cOctalZero,cCppOutWrapper,cCppInWrapper,@cCppOutInGroup,cFormat,cNumber,cFloat,cOctal,cOctalError,cNumbersCom,cCppParen,cCppBracket,cCppString
|
syn cluster cMultiGroup contains=cIncluded,cSpecial,cCommentSkip,cCommentString,cComment2String,@cCommentGroup,cCommentStartError,cUserCont,cUserLabel,cBitField,cOctalZero,cCppOutWrapper,cCppInWrapper,@cCppOutInGroup,cFormat,cNumber,cFloat,cOctal,cOctalError,cNumbersCom,cCppParen,cCppBracket,cCppString
|
||||||
if &filetype ==# 'c' || exists("cpp_no_cpp11")
|
if s:ft ==# 'c' || exists("cpp_no_cpp11")
|
||||||
syn region cMulti transparent start='?' skip='::' end=':' contains=ALLBUT,@cMultiGroup,@Spell
|
syn region cMulti transparent start='?' skip='::' end=':' contains=ALLBUT,@cMultiGroup,@Spell
|
||||||
endif
|
endif
|
||||||
" Avoid matching foo::bar() in C++ by requiring that the next char is not ':'
|
" Avoid matching foo::bar() in C++ by requiring that the next char is not ':'
|
||||||
@@ -457,6 +459,8 @@ hi def link cCppOut Comment
|
|||||||
|
|
||||||
let b:current_syntax = "c"
|
let b:current_syntax = "c"
|
||||||
|
|
||||||
|
unlet s:ft
|
||||||
|
|
||||||
let &cpo = s:cpo_save
|
let &cpo = s:cpo_save
|
||||||
unlet s:cpo_save
|
unlet s:cpo_save
|
||||||
" vim: ts=8
|
" vim: ts=8
|
||||||
|
|||||||
@@ -38,7 +38,7 @@ syntax match clojureKeyword "\v<:{1,2}%([^ \n\r\t()\[\]{}";@^`~\\%/]+/)*[^ \n\r\
|
|||||||
|
|
||||||
syntax match clojureStringEscape "\v\\%([\\btnfr"]|u\x{4}|[0-3]\o{2}|\o{1,2})" contained
|
syntax match clojureStringEscape "\v\\%([\\btnfr"]|u\x{4}|[0-3]\o{2}|\o{1,2})" contained
|
||||||
|
|
||||||
syntax region clojureString start=/"/ skip=/\\\\\|\\"/ end=/"/ contains=clojureStringEscape
|
syntax region clojureString start=/"/ skip=/\\\\\|\\"/ end=/"/ contains=clojureStringEscape,@Spell
|
||||||
|
|
||||||
syntax match clojureCharacter "\\."
|
syntax match clojureCharacter "\\."
|
||||||
syntax match clojureCharacter "\\o\%([0-3]\o\{2\}\|\o\{1,2\}\)"
|
syntax match clojureCharacter "\\o\%([0-3]\o\{2\}\|\o\{1,2\}\)"
|
||||||
@@ -75,7 +75,7 @@ syntax match clojureDispatch "\v#[\^'=<_]?"
|
|||||||
" Clojure permits no more than 20 params.
|
" Clojure permits no more than 20 params.
|
||||||
syntax match clojureAnonArg "%\(20\|1\d\|[1-9]\|&\)\?"
|
syntax match clojureAnonArg "%\(20\|1\d\|[1-9]\|&\)\?"
|
||||||
|
|
||||||
syntax match clojureRegexpEscape "\v\\%([\\tnrfae()\[\]{}^$*?+]|c\u|0[0-3]?\o{1,2}|x%(\x{2}|\{\x{1,6}\})|u\x{4})" contained display
|
syntax match clojureRegexpEscape "\v\\%([\\tnrfae.()\[\]{}^$*?+]|c\u|0[0-3]?\o{1,2}|x%(\x{2}|\{\x{1,6}\})|u\x{4})" contained display
|
||||||
syntax region clojureRegexpQuoted start=/\\Q/ms=e+1 skip=/\\\\\|\\"/ end=/\\E/me=s-1 end=/"/me=s-1 contained
|
syntax region clojureRegexpQuoted start=/\\Q/ms=e+1 skip=/\\\\\|\\"/ end=/\\E/me=s-1 end=/"/me=s-1 contained
|
||||||
syntax region clojureRegexpQuote start=/\\Q/ skip=/\\\\\|\\"/ end=/\\E/ end=/"/me=s-1 contains=clojureRegexpQuoted keepend contained
|
syntax region clojureRegexpQuote start=/\\Q/ skip=/\\\\\|\\"/ end=/\\E/ end=/"/me=s-1 contains=clojureRegexpQuoted keepend contained
|
||||||
|
|
||||||
|
|||||||
@@ -15,9 +15,6 @@ silent! unlet b:current_syntax
|
|||||||
" Highlight long strings.
|
" Highlight long strings.
|
||||||
syntax sync fromstart
|
syntax sync fromstart
|
||||||
|
|
||||||
" CoffeeScript identifiers can have dollar signs.
|
|
||||||
setlocal isident+=$
|
|
||||||
|
|
||||||
" These are `matches` instead of `keywords` because vim's highlighting
|
" These are `matches` instead of `keywords` because vim's highlighting
|
||||||
" priority for keywords is higher than matches. This causes keywords to be
|
" priority for keywords is higher than matches. This causes keywords to be
|
||||||
" highlighted inside matches, even if a match says it shouldn't contain them --
|
" highlighted inside matches, even if a match says it shouldn't contain them --
|
||||||
@@ -67,7 +64,7 @@ syn match coffeeSpecialVar /\<\%(this\|prototype\|arguments\)\>/ display
|
|||||||
hi def link coffeeSpecialVar Special
|
hi def link coffeeSpecialVar Special
|
||||||
|
|
||||||
" An @-variable
|
" An @-variable
|
||||||
syn match coffeeSpecialIdent /@\%(\I\i*\)\?/ display
|
syn match coffeeSpecialIdent /@\%(\%(\I\|\$\)\%(\i\|\$\)*\)\?/ display
|
||||||
hi def link coffeeSpecialIdent Identifier
|
hi def link coffeeSpecialIdent Identifier
|
||||||
|
|
||||||
" A class-like name that starts with a capital letter
|
" A class-like name that starts with a capital letter
|
||||||
@@ -95,15 +92,16 @@ syn region coffeeString start=/'/ skip=/\\\\\|\\'/ end=/'/
|
|||||||
hi def link coffeeString String
|
hi def link coffeeString String
|
||||||
|
|
||||||
" A integer, including a leading plus or minus
|
" A integer, including a leading plus or minus
|
||||||
syn match coffeeNumber /\i\@<![-+]\?\d\+\%([eE][+-]\?\d\+\)\?/ display
|
syn match coffeeNumber /\%(\i\|\$\)\@<![-+]\?\d\+\%([eE][+-]\?\d\+\)\?/ display
|
||||||
" A hex, binary, or octal number
|
" A hex, binary, or octal number
|
||||||
syn match coffeeNumber /\<0[xX]\x\+\>/ display
|
syn match coffeeNumber /\<0[xX]\x\+\>/ display
|
||||||
syn match coffeeNumber /\<0[bB][01]\+\>/ display
|
syn match coffeeNumber /\<0[bB][01]\+\>/ display
|
||||||
syn match coffeeNumber /\<0[oO][0-7]\+\>/ display
|
syn match coffeeNumber /\<0[oO][0-7]\+\>/ display
|
||||||
|
syn match coffeeNumber /\<\%(Infinity\|NaN\)\>/ display
|
||||||
hi def link coffeeNumber Number
|
hi def link coffeeNumber Number
|
||||||
|
|
||||||
" A floating-point number, including a leading plus or minus
|
" A floating-point number, including a leading plus or minus
|
||||||
syn match coffeeFloat /\i\@<![-+]\?\d*\.\@<!\.\d\+\%([eE][+-]\?\d\+\)\?/
|
syn match coffeeFloat /\%(\i\|\$\)\@<![-+]\?\d*\.\@<!\.\d\+\%([eE][+-]\?\d\+\)\?/
|
||||||
\ display
|
\ display
|
||||||
hi def link coffeeFloat Float
|
hi def link coffeeFloat Float
|
||||||
|
|
||||||
@@ -114,7 +112,7 @@ syn match coffeeReservedError /\<\%(case\|default\|function\|var\|void\|with\|co
|
|||||||
hi def link coffeeReservedError Error
|
hi def link coffeeReservedError Error
|
||||||
|
|
||||||
" A normal object assignment
|
" A normal object assignment
|
||||||
syn match coffeeObjAssign /@\?\I\i*\s*\ze::\@!/ contains=@coffeeIdentifier display
|
syn match coffeeObjAssign /@\?\%(\I\|\$\)\%(\i\|\$\)*\s*\ze::\@!/ contains=@coffeeIdentifier display
|
||||||
hi def link coffeeObjAssign Identifier
|
hi def link coffeeObjAssign Identifier
|
||||||
|
|
||||||
syn keyword coffeeTodo TODO FIXME XXX contained
|
syn keyword coffeeTodo TODO FIXME XXX contained
|
||||||
@@ -148,7 +146,7 @@ hi def link coffeeEscape SpecialChar
|
|||||||
|
|
||||||
" A regex -- must not follow a parenthesis, number, or identifier, and must not
|
" A regex -- must not follow a parenthesis, number, or identifier, and must not
|
||||||
" be followed by a number
|
" be followed by a number
|
||||||
syn region coffeeRegex start=#\%(\%()\|\i\@<!\d\)\s*\|\i\)\@<!/=\@!\s\@!#
|
syn region coffeeRegex start=#\%(\%()\|\%(\i\|\$\)\@<!\d\)\s*\|\i\)\@<!/=\@!\s\@!#
|
||||||
\ end=#/[gimy]\{,4}\d\@!#
|
\ end=#/[gimy]\{,4}\d\@!#
|
||||||
\ oneline contains=@coffeeBasicString,coffeeRegexCharSet
|
\ oneline contains=@coffeeBasicString,coffeeRegexCharSet
|
||||||
syn region coffeeRegexCharSet start=/\[/ end=/]/ contained
|
syn region coffeeRegexCharSet start=/\[/ end=/]/ contained
|
||||||
@@ -182,11 +180,11 @@ syn match coffeeSemicolonError /;$/ display
|
|||||||
hi def link coffeeSemicolonError Error
|
hi def link coffeeSemicolonError Error
|
||||||
|
|
||||||
" Ignore reserved words in dot accesses.
|
" Ignore reserved words in dot accesses.
|
||||||
syn match coffeeDotAccess /\.\@<!\.\s*\I\i*/he=s+1 contains=@coffeeIdentifier
|
syn match coffeeDotAccess /\.\@<!\.\s*\%(\I\|\$\)\%(\i\|\$\)*/he=s+1 contains=@coffeeIdentifier
|
||||||
hi def link coffeeDotAccess coffeeExtendedOp
|
hi def link coffeeDotAccess coffeeExtendedOp
|
||||||
|
|
||||||
" Ignore reserved words in prototype accesses.
|
" Ignore reserved words in prototype accesses.
|
||||||
syn match coffeeProtoAccess /::\s*\I\i*/he=s+2 contains=@coffeeIdentifier
|
syn match coffeeProtoAccess /::\s*\%(\I\|\$\)\%(\i\|\$\)*/he=s+2 contains=@coffeeIdentifier
|
||||||
hi def link coffeeProtoAccess coffeeExtendedOp
|
hi def link coffeeProtoAccess coffeeExtendedOp
|
||||||
|
|
||||||
" This is required for interpolations to work.
|
" This is required for interpolations to work.
|
||||||
|
|||||||
@@ -39,6 +39,9 @@ if !exists("cpp_no_cpp11")
|
|||||||
syn keyword cppExceptions noexcept
|
syn keyword cppExceptions noexcept
|
||||||
syn keyword cppStorageClass constexpr decltype
|
syn keyword cppStorageClass constexpr decltype
|
||||||
syn keyword cppConstant nullptr
|
syn keyword cppConstant nullptr
|
||||||
|
" A C++11 raw-string literal. It tries to follow 2.14.5 and 2.14.5.2 of the
|
||||||
|
" standard.
|
||||||
|
syn region cppRawString matchgroup=cppRawDelim start=+\%(u8\=\|[LU]\)\=R"\z(\%([ ()\\\d9-\d12]\@![\d0-\d127]\)\{,16}\)(+ end=+)\z1"+ contains=@Spell
|
||||||
endif
|
endif
|
||||||
|
|
||||||
" The minimum and maximum operators in GNU C++
|
" The minimum and maximum operators in GNU C++
|
||||||
@@ -62,6 +65,8 @@ if version >= 508 || !exists("did_cpp_syntax_inits")
|
|||||||
HiLink cppStructure Structure
|
HiLink cppStructure Structure
|
||||||
HiLink cppBoolean Boolean
|
HiLink cppBoolean Boolean
|
||||||
HiLink cppConstant Constant
|
HiLink cppConstant Constant
|
||||||
|
HiLink cppRawDelim cFormat
|
||||||
|
HiLink cppRawString String
|
||||||
delcommand HiLink
|
delcommand HiLink
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
|||||||
22
syntax/dockerfile.vim
Normal file
22
syntax/dockerfile.vim
Normal file
@@ -0,0 +1,22 @@
|
|||||||
|
" dockerfile.vim - Syntax highlighting for Dockerfiles
|
||||||
|
" Maintainer: Honza Pokorny <http://honza.ca>
|
||||||
|
" Version: 0.5
|
||||||
|
|
||||||
|
|
||||||
|
if exists("b:current_syntax")
|
||||||
|
finish
|
||||||
|
endif
|
||||||
|
|
||||||
|
let b:current_syntax = "dockerfile"
|
||||||
|
|
||||||
|
syntax case ignore
|
||||||
|
|
||||||
|
syntax match dockerfileKeyword /\v^\s*(FROM|MAINTAINER|RUN|CMD|EXPOSE|ENV|ADD)\s/
|
||||||
|
syntax match dockerfileKeyword /\v^\s*(ENTRYPOINT|VOLUME|USER|WORKDIR)\s/
|
||||||
|
highlight link dockerfileKeyword Keyword
|
||||||
|
|
||||||
|
syntax region dockerfileString start=/\v"/ skip=/\v\\./ end=/\v"/
|
||||||
|
highlight link dockerfileString String
|
||||||
|
|
||||||
|
syntax match dockerfileComment "\v^\s*#.*$"
|
||||||
|
highlight link dockerfileComment Comment
|
||||||
@@ -7,7 +7,7 @@ if exists("b:current_syntax")
|
|||||||
endif
|
endif
|
||||||
|
|
||||||
syn case match
|
syn case match
|
||||||
syn match godocTitle "^\([A-Z]*\)$"
|
syn match godocTitle "^\([A-Z][A-Z ]*\)$"
|
||||||
|
|
||||||
command -nargs=+ HiLink hi def link <args>
|
command -nargs=+ HiLink hi def link <args>
|
||||||
|
|
||||||
|
|||||||
@@ -19,29 +19,39 @@ ru! syntax/html.vim
|
|||||||
unlet b:current_syntax
|
unlet b:current_syntax
|
||||||
|
|
||||||
|
|
||||||
syn keyword hbsTodo TODO FIXME XXX contained
|
syn region hbsInside start=/{{/ end=/}}/ keepend
|
||||||
|
|
||||||
syn match hbsError /}}}\?/
|
syn keyword hbsTodo TODO FIXME XXX contained
|
||||||
syn match hbsInsideError /{{[{#<>=!\/]\?/ containedin=@hbsInside
|
|
||||||
|
|
||||||
syn cluster htmlHbsContainer add=htmlHead,htmlTitle,htmlString,htmlH1,htmlH2,htmlH3,htmlH4,htmlH5,htmlH6
|
syn match hbsError /}}}\?/
|
||||||
syn region hbsInside start=/{{/ end=/}}/ keepend transparent containedin=@htmlHbsContainer
|
syn match hbsInsideError /{{[{#<>=!\/]\?/ contained containedin=@hbsInside
|
||||||
|
|
||||||
syn match hbsHandlebars "{{\|}}" containedin=hbsInside
|
syn match hbsHandlebars "{{\|}}" contained containedin=hbsInside
|
||||||
syn match hbsUnescape "{{{\|}}}" containedin=hbsInside
|
syn match hbsUnescape "{{{\|}}}" contained containedin=hbsInside extend
|
||||||
syn match hbsOperators "=\|\.\|/" containedin=hbsInside
|
syn match hbsOperators "=\|\.\|/" contained containedin=hbsInside
|
||||||
|
|
||||||
syn region hbsSection start="{{[#/]"lc=2 end=/}}/me=e-2 containedin=hbsInside
|
syn region hbsSection start="{{[#/]"lc=2 end=/}}/me=e-2 contained containedin=hbsInside
|
||||||
syn region hbsPartial start=/{{[<>]/lc=2 end=/}}/me=e-2 containedin=hbsInside
|
syn region hbsPartial start=/{{[<>]/lc=2 end=/}}/me=e-2 contained containedin=hbsInside
|
||||||
syn region hbsMarkerSet start=/{{=/lc=2 end=/=}}/me=e-2 containedin=hbsInside
|
syn region hbsMarkerSet start=/{{=/lc=2 end=/=}}/me=e-2 contained containedin=hbsInside
|
||||||
|
|
||||||
syn region hbsComment start=/{{!/rs=s+2 end=/}}/re=e-2 containedin=htmlHead contains=hbsTodo,Todo
|
syn region hbsComment start=/{{!/rs=s+2 end=/}}/re=e-2 contained containedin=hbsInside contains=hbsTodo,Todo
|
||||||
syn region hbsBlockComment start=/{{!--/rs=s+2 end=/--}}/re=e-2 containedin=htmlHead contains=hbsTodo,Todo
|
syn region hbsBlockComment start=/{{!--/rs=s+2 end=/--}}/re=e-2 contained containedin=hbsInside contains=hbsTodo,Todo extend
|
||||||
syn region hbsQString start=/'/ skip=/\\'/ end=/'/ containedin=hbsInside
|
syn region hbsQString start=/'/ skip=/\\'/ end=/'/ contained containedin=hbsInside
|
||||||
syn region hbsDQString start=/"/ skip=/\\"/ end=/"/ containedin=hbsInside
|
syn region hbsDQString start=/"/ skip=/\\"/ end=/"/ contained containedin=hbsInside
|
||||||
|
|
||||||
syn match hbsConditionals "\([/#]\(if\|unless\)\|else\)" containedin=hbsInside
|
syn match hbsConditionals "\([/#]\(if\|unless\)\|else\)" contained containedin=hbsInside
|
||||||
syn match hbsHelpers "[/#]\(with\|each\)" containedin=hbsInside
|
syn match hbsHelpers "[/#]\(with\|each\)" contained containedin=hbsInside
|
||||||
|
|
||||||
|
syn cluster allHbsItems add=hbsTodo,hbsError,hbsInsideError,hbsInside,hbsHandlebars,
|
||||||
|
\ hbsUnescape,hbsOperators,hbsSection,hbsPartial,hbsMarkerSet,
|
||||||
|
\ hbsComment,hbsBlockComment,hbsQString,hbsDQString,hbsConditionals,
|
||||||
|
\ hbsHelpers,hbsPartial,hbsMarkerSet,hbsComment,hbsBlockComment,
|
||||||
|
\ hbsQString,hbsDQString,hbsConditionals,hbsHelpers
|
||||||
|
|
||||||
|
syn cluster htmlAdditional add=htmlTag,htmlEndTag,htmlTagName,htmlSpecialChar
|
||||||
|
|
||||||
|
syn region hbsScriptTemplate start=+<script [^>]*type *=[^>]*text/x-handlebars-template[^>]*>+
|
||||||
|
\ end=+</script>+me=s-1 keepend contains=@htmlHbsContainer,@allHbsItems,@htmlAdditional
|
||||||
|
|
||||||
|
|
||||||
" Define the default highlighting.
|
" Define the default highlighting.
|
||||||
|
|||||||
105
syntax/mason.vim
Normal file
105
syntax/mason.vim
Normal file
@@ -0,0 +1,105 @@
|
|||||||
|
" Vim syntax file
|
||||||
|
" Language: Mason (Perl embedded in HTML)
|
||||||
|
" Maintainer: vim-perl <vim-perl@googlegroups.com>
|
||||||
|
" Homepage: http://github.com/vim-perl/vim-perl/tree/master
|
||||||
|
" Bugs/requests: http://github.com/vim-perl/vim-perl/issues
|
||||||
|
" Last Change: {{LAST_CHANGE}}
|
||||||
|
" Contributors: Hinrik Örn Sigurðsson <hinrik.sig@gmail.com>
|
||||||
|
" Andrew Smith <andrewdsmith@yahoo.com>
|
||||||
|
"
|
||||||
|
" TODO:
|
||||||
|
" - Fix <%text> blocks to show HTML tags but ignore Mason tags.
|
||||||
|
"
|
||||||
|
|
||||||
|
" Clear previous syntax settings unless this is v6 or above, in which case just
|
||||||
|
" exit without doing anything.
|
||||||
|
"
|
||||||
|
if version < 600
|
||||||
|
syn clear
|
||||||
|
elseif exists("b:current_syntax")
|
||||||
|
finish
|
||||||
|
endif
|
||||||
|
|
||||||
|
" The HTML syntax file included below uses this variable.
|
||||||
|
"
|
||||||
|
if !exists("main_syntax")
|
||||||
|
let main_syntax = 'mason'
|
||||||
|
endif
|
||||||
|
|
||||||
|
" First pull in the HTML syntax.
|
||||||
|
"
|
||||||
|
if version < 600
|
||||||
|
so <sfile>:p:h/html.vim
|
||||||
|
else
|
||||||
|
runtime! syntax/html.vim
|
||||||
|
unlet b:current_syntax
|
||||||
|
endif
|
||||||
|
|
||||||
|
syn cluster htmlPreproc add=@masonTop
|
||||||
|
|
||||||
|
" Now pull in the Perl syntax.
|
||||||
|
"
|
||||||
|
if version < 600
|
||||||
|
syn include @perlTop <sfile>:p:h/perl.vim
|
||||||
|
unlet b:current_syntax
|
||||||
|
syn include @podTop <sfile>:p:h/pod.vim
|
||||||
|
else
|
||||||
|
syn include @perlTop syntax/perl.vim
|
||||||
|
unlet b:current_syntax
|
||||||
|
syn include @podTop syntax/pod.vim
|
||||||
|
endif
|
||||||
|
|
||||||
|
" It's hard to reduce down to the correct sub-set of Perl to highlight in some
|
||||||
|
" of these cases so I've taken the safe option of just using perlTop in all of
|
||||||
|
" them. If you have any suggestions, please let me know.
|
||||||
|
"
|
||||||
|
syn region masonPod start="^=[a-z]" end="^=cut" keepend contained contains=@podTop
|
||||||
|
syn region masonPerlBraces start="{" end="}" contained
|
||||||
|
syn region masonLine matchgroup=Delimiter start="^%" end="$" keepend contains=@perlTop,masonPerlBraces
|
||||||
|
syn region masonExpr matchgroup=Delimiter start="<%" end="%>" contains=@perlTop
|
||||||
|
syn region masonPerl matchgroup=Delimiter start="<%perl>" end="</%perl>" contains=masonPod,@perlTop
|
||||||
|
syn region masonComp keepend matchgroup=Delimiter start="<&\s*\%(\a\+:\)\?[._/[:alnum:]]*" end="&>" contains=@perlTop
|
||||||
|
|
||||||
|
syn region masonArgs matchgroup=Delimiter start="<%args>" end="</%args>" contains=masonPod,@perlTop
|
||||||
|
|
||||||
|
syn region masonInit matchgroup=Delimiter start="<%init>" end="</%init>" contains=masonPod,@perlTop
|
||||||
|
syn region masonCleanup matchgroup=Delimiter start="<%cleanup>" end="</%cleanup>" contains=masonPod,@perlTop
|
||||||
|
syn region masonOnce matchgroup=Delimiter start="<%once>" end="</%once>" contains=masonPod,@perlTop
|
||||||
|
syn region masonClass matchgroup=Delimiter start="<%class>" end="</%class>" contains=masonPod,@perlTop
|
||||||
|
syn region masonShared matchgroup=Delimiter start="<%shared>" end="</%shared>" contains=masonPod,@perlTop
|
||||||
|
|
||||||
|
syn region masonDef matchgroup=Delimiter start="<%def\s*[._/[:alnum:]]\+\s*>" end="</%def>" contains=@htmlTop
|
||||||
|
syn region masonMethod matchgroup=Delimiter start="<%method\s*[._/[:alnum:]]\+\s*>" end="</%method>" contains=@htmlTop
|
||||||
|
|
||||||
|
syn region masonFlags matchgroup=Delimiter start="<%flags>" end="</%flags>" contains=masonPod,@perlTop
|
||||||
|
syn region masonAttr matchgroup=Delimiter start="<%attr>" end="</%attr>" contains=masonPod,@perlTop
|
||||||
|
|
||||||
|
syn region masonFilter matchgroup=Delimiter start="<%filter>" end="</%filter>" contains=masonPod,@perlTop
|
||||||
|
|
||||||
|
syn region masonDoc matchgroup=Delimiter start="<%doc>" end="</%doc>"
|
||||||
|
syn region masonText matchgroup=Delimiter start="<%text>" end="</%text>"
|
||||||
|
|
||||||
|
syn cluster masonTop contains=masonLine,masonExpr,masonPerl,masonComp,masonArgs,masonInit,masonCleanup,masonOnce,masonShared,masonDef,masonMethod,masonFlags,masonAttr,masonFilter,masonDoc,masonText
|
||||||
|
|
||||||
|
" Set up default highlighting. Almost all of this is done in the included
|
||||||
|
" syntax files.
|
||||||
|
"
|
||||||
|
if version >= 508 || !exists("did_mason_syn_inits")
|
||||||
|
if version < 508
|
||||||
|
let did_mason_syn_inits = 1
|
||||||
|
com -nargs=+ HiLink hi link <args>
|
||||||
|
else
|
||||||
|
com -nargs=+ HiLink hi def link <args>
|
||||||
|
endif
|
||||||
|
|
||||||
|
HiLink masonDoc Comment
|
||||||
|
HiLink masonPod Comment
|
||||||
|
|
||||||
|
delc HiLink
|
||||||
|
endif
|
||||||
|
|
||||||
|
let b:current_syntax = "mason"
|
||||||
|
|
||||||
|
if main_syntax == 'mason'
|
||||||
|
unlet main_syntax
|
||||||
|
endif
|
||||||
582
syntax/perl.vim
Normal file
582
syntax/perl.vim
Normal file
@@ -0,0 +1,582 @@
|
|||||||
|
" Vim syntax file
|
||||||
|
" Language: Perl 5
|
||||||
|
" Maintainer: vim-perl <vim-perl@googlegroups.com>
|
||||||
|
" Homepage: http://github.com/vim-perl/vim-perl/tree/master
|
||||||
|
" Bugs/requests: http://github.com/vim-perl/vim-perl/issues
|
||||||
|
" Last Change: {{LAST_CHANGE}}
|
||||||
|
" Contributors: Andy Lester <andy@petdance.com>
|
||||||
|
" Hinrik Örn Sigurðsson <hinrik.sig@gmail.com>
|
||||||
|
" Lukas Mai <l.mai.web.de>
|
||||||
|
" Nick Hibma <nick@van-laarhoven.org>
|
||||||
|
" Sonia Heimann <niania@netsurf.org>
|
||||||
|
" Rob Hoelz <rob@hoelz.ro>
|
||||||
|
" and many others.
|
||||||
|
"
|
||||||
|
" Please download the most recent version first, before mailing
|
||||||
|
" any comments.
|
||||||
|
"
|
||||||
|
" The following parameters are available for tuning the
|
||||||
|
" perl syntax highlighting, with defaults given:
|
||||||
|
"
|
||||||
|
" let perl_include_pod = 1
|
||||||
|
" unlet perl_no_scope_in_variables
|
||||||
|
" unlet perl_no_extended_vars
|
||||||
|
" unlet perl_string_as_statement
|
||||||
|
" unlet perl_no_sync_on_sub
|
||||||
|
" unlet perl_no_sync_on_global_var
|
||||||
|
" let perl_sync_dist = 100
|
||||||
|
" unlet perl_fold
|
||||||
|
" unlet perl_fold_blocks
|
||||||
|
" unlet perl_nofold_packages
|
||||||
|
" let perl_nofold_subs = 1
|
||||||
|
" unlet perl_fold_anonymous_subs
|
||||||
|
|
||||||
|
if exists("b:current_syntax")
|
||||||
|
finish
|
||||||
|
endif
|
||||||
|
|
||||||
|
let s:cpo_save = &cpo
|
||||||
|
set cpo&vim
|
||||||
|
|
||||||
|
if exists('®expengine')
|
||||||
|
let s:regexpengine=®expengine
|
||||||
|
set regexpengine=1
|
||||||
|
endif
|
||||||
|
|
||||||
|
" POD starts with ^=<word> and ends with ^=cut
|
||||||
|
|
||||||
|
if !exists("perl_include_pod") || perl_include_pod == 1
|
||||||
|
" Include a while extra syntax file
|
||||||
|
syn include @Pod syntax/pod.vim
|
||||||
|
unlet b:current_syntax
|
||||||
|
if exists("perl_fold")
|
||||||
|
syn region perlPOD start="^=[a-z]" end="^=cut" contains=@Pod,@Spell,perlTodo keepend fold extend
|
||||||
|
syn region perlPOD start="^=cut" end="^=cut" contains=perlTodo keepend fold extend
|
||||||
|
else
|
||||||
|
syn region perlPOD start="^=[a-z]" end="^=cut" contains=@Pod,@Spell,perlTodo keepend
|
||||||
|
syn region perlPOD start="^=cut" end="^=cut" contains=perlTodo keepend
|
||||||
|
endif
|
||||||
|
else
|
||||||
|
" Use only the bare minimum of rules
|
||||||
|
if exists("perl_fold")
|
||||||
|
syn region perlPOD start="^=[a-z]" end="^=cut" fold
|
||||||
|
else
|
||||||
|
syn region perlPOD start="^=[a-z]" end="^=cut"
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
|
||||||
|
|
||||||
|
syn cluster perlTop contains=TOP
|
||||||
|
|
||||||
|
syn region perlBraces start="{" end="}" transparent extend
|
||||||
|
|
||||||
|
" All keywords
|
||||||
|
"
|
||||||
|
syn match perlConditional "\<\%(if\|elsif\|unless\|given\|when\|default\)\>"
|
||||||
|
syn match perlConditional "\<else\%(\%(\_s\*if\>\)\|\>\)" contains=perlElseIfError skipwhite skipnl skipempty
|
||||||
|
syn match perlRepeat "\<\%(while\|for\%(each\)\=\|do\|until\|continue\)\>"
|
||||||
|
syn match perlOperator "\<\%(defined\|undef\|eq\|ne\|[gl][et]\|cmp\|not\|and\|or\|xor\|not\|bless\|ref\|do\)\>"
|
||||||
|
" for some reason, adding this as the nextgroup for perlControl fixes BEGIN
|
||||||
|
" folding issues...
|
||||||
|
syn match perlFakeGroup "" contained
|
||||||
|
syn match perlControl "\<\%(BEGIN\|CHECK\|INIT\|END\|UNITCHECK\)\>\_s*" nextgroup=perlFakeGroup
|
||||||
|
|
||||||
|
syn match perlStatementStorage "\<\%(my\|our\|local\|state\)\>"
|
||||||
|
syn match perlStatementControl "\<\%(return\|last\|next\|redo\|goto\|break\)\>"
|
||||||
|
syn match perlStatementScalar "\<\%(chom\=p\|chr\|crypt\|r\=index\|lc\%(first\)\=\|length\|ord\|pack\|sprintf\|substr\|uc\%(first\)\=\)\>"
|
||||||
|
syn match perlStatementRegexp "\<\%(pos\|quotemeta\|split\|study\)\>"
|
||||||
|
syn match perlStatementNumeric "\<\%(abs\|atan2\|cos\|exp\|hex\|int\|log\|oct\|rand\|sin\|sqrt\|srand\)\>"
|
||||||
|
syn match perlStatementList "\<\%(splice\|unshift\|shift\|push\|pop\|join\|reverse\|grep\|map\|sort\|unpack\)\>"
|
||||||
|
syn match perlStatementHash "\<\%(delete\|each\|exists\|keys\|values\)\>"
|
||||||
|
syn match perlStatementIOfunc "\<\%(syscall\|dbmopen\|dbmclose\)\>"
|
||||||
|
syn match perlStatementFiledesc "\<\%(binmode\|close\%(dir\)\=\|eof\|fileno\|getc\|lstat\|printf\=\|read\%(dir\|line\|pipe\)\|rewinddir\|say\|select\|stat\|tell\%(dir\)\=\|write\)\>" nextgroup=perlFiledescStatementNocomma skipwhite
|
||||||
|
syn match perlStatementFiledesc "\<\%(fcntl\|flock\|ioctl\|open\%(dir\)\=\|read\|seek\%(dir\)\=\|sys\%(open\|read\|seek\|write\)\|truncate\)\>" nextgroup=perlFiledescStatementComma skipwhite
|
||||||
|
syn match perlStatementVector "\<vec\>"
|
||||||
|
syn match perlStatementFiles "\<\%(ch\%(dir\|mod\|own\|root\)\|glob\|link\|mkdir\|readlink\|rename\|rmdir\|symlink\|umask\|unlink\|utime\)\>"
|
||||||
|
syn match perlStatementFiles "-[rwxoRWXOezsfdlpSbctugkTBMAC]\>"
|
||||||
|
syn match perlStatementFlow "\<\%(caller\|die\|dump\|eval\|exit\|wantarray\)\>"
|
||||||
|
syn match perlStatementInclude "\<\%(require\|import\)\>"
|
||||||
|
syn match perlStatementInclude "\<\%(use\|no\)\s\+\%(\%(attributes\|attrs\|autouse\|parent\|base\|big\%(int\|num\|rat\)\|blib\|bytes\|charnames\|constant\|diagnostics\|encoding\%(::warnings\)\=\|feature\|fields\|filetest\|if\|integer\|less\|lib\|locale\|mro\|open\|ops\|overload\|re\|sigtrap\|sort\|strict\|subs\|threads\%(::shared\)\=\|utf8\|vars\|version\|vmsish\|warnings\%(::register\)\=\)\>\)\="
|
||||||
|
syn match perlStatementProc "\<\%(alarm\|exec\|fork\|get\%(pgrp\|ppid\|priority\)\|kill\|pipe\|set\%(pgrp\|priority\)\|sleep\|system\|times\|wait\%(pid\)\=\)\>"
|
||||||
|
syn match perlStatementSocket "\<\%(accept\|bind\|connect\|get\%(peername\|sock\%(name\|opt\)\)\|listen\|recv\|send\|setsockopt\|shutdown\|socket\%(pair\)\=\)\>"
|
||||||
|
syn match perlStatementIPC "\<\%(msg\%(ctl\|get\|rcv\|snd\)\|sem\%(ctl\|get\|op\)\|shm\%(ctl\|get\|read\|write\)\)\>"
|
||||||
|
syn match perlStatementNetwork "\<\%(\%(end\|[gs]et\)\%(host\|net\|proto\|serv\)ent\|get\%(\%(host\|net\)by\%(addr\|name\)\|protoby\%(name\|number\)\|servby\%(name\|port\)\)\)\>"
|
||||||
|
syn match perlStatementPword "\<\%(get\%(pw\%(uid\|nam\)\|gr\%(gid\|nam\)\|login\)\)\|\%(end\|[gs]et\)\%(pw\|gr\)ent\>"
|
||||||
|
syn match perlStatementTime "\<\%(gmtime\|localtime\|time\)\>"
|
||||||
|
|
||||||
|
syn match perlStatementMisc "\<\%(warn\|format\|formline\|reset\|scalar\|prototype\|lock\|tied\=\|untie\)\>"
|
||||||
|
|
||||||
|
syn keyword perlTodo TODO TODO: TBD TBD: FIXME FIXME: XXX XXX: NOTE NOTE: contained
|
||||||
|
|
||||||
|
syn region perlStatementIndirObjWrap matchgroup=perlStatementIndirObj start="\<\%(map\|grep\|sort\|printf\=\|say\|system\|exec\)\>\s*{" end="}" contains=@perlTop,perlBraces extend
|
||||||
|
|
||||||
|
syn match perlLabel "^\s*\h\w*\s*::\@!\%(\<v\d\+\s*:\)\@<!"
|
||||||
|
|
||||||
|
" Perl Identifiers.
|
||||||
|
"
|
||||||
|
" Should be cleaned up to better handle identifiers in particular situations
|
||||||
|
" (in hash keys for example)
|
||||||
|
"
|
||||||
|
" Plain identifiers: $foo, @foo, $#foo, %foo, &foo and dereferences $$foo, @$foo, etc.
|
||||||
|
" We do not process complex things such as @{${"foo"}}. Too complicated, and
|
||||||
|
" too slow. And what is after the -> is *not* considered as part of the
|
||||||
|
" variable - there again, too complicated and too slow.
|
||||||
|
|
||||||
|
" Special variables first ($^A, ...) and ($|, $', ...)
|
||||||
|
syn match perlVarPlain "$^[ACDEFHILMNOPRSTVWX]\="
|
||||||
|
syn match perlVarPlain "$[\\\"\[\]'&`+*.,;=%~!?@#$<>(-]"
|
||||||
|
syn match perlVarPlain "%+"
|
||||||
|
syn match perlVarPlain "$\%(0\|[1-9]\d*\)"
|
||||||
|
" Same as above, but avoids confusion in $::foo (equivalent to $main::foo)
|
||||||
|
syn match perlVarPlain "$::\@!"
|
||||||
|
" These variables are not recognized within matches.
|
||||||
|
syn match perlVarNotInMatches "$[|)]"
|
||||||
|
" This variable is not recognized within matches delimited by m//.
|
||||||
|
syn match perlVarSlash "$/"
|
||||||
|
|
||||||
|
" And plain identifiers
|
||||||
|
syn match perlPackageRef "[$@#%*&]\%(\%(::\|'\)\=\I\i*\%(\%(::\|'\)\I\i*\)*\)\=\%(::\|'\)\I"ms=s+1,me=e-1 contained
|
||||||
|
|
||||||
|
" To not highlight packages in variables as a scope reference - i.e. in
|
||||||
|
" $pack::var, pack:: is a scope, just set "perl_no_scope_in_variables"
|
||||||
|
" If you don't want complex things like @{${"foo"}} to be processed,
|
||||||
|
" just set the variable "perl_no_extended_vars"...
|
||||||
|
|
||||||
|
if !exists("perl_no_scope_in_variables")
|
||||||
|
syn match perlVarPlain "\%([@$]\|\$#\)\$*\%(\I\i*\)\=\%(\%(::\|'\)\I\i*\)*\%(::\|\i\@<=\)" contains=perlPackageRef nextgroup=perlVarMember,perlVarSimpleMember,perlMethod
|
||||||
|
syn match perlVarPlain2 "%\$*\%(\I\i*\)\=\%(\%(::\|'\)\I\i*\)*\%(::\|\i\@<=\)" contains=perlPackageRef
|
||||||
|
syn match perlFunctionName "&\$*\%(\I\i*\)\=\%(\%(::\|'\)\I\i*\)*\%(::\|\i\@<=\)" contains=perlPackageRef nextgroup=perlVarMember,perlVarSimpleMember,perlMethod
|
||||||
|
else
|
||||||
|
syn match perlVarPlain "\%([@$]\|\$#\)\$*\%(\I\i*\)\=\%(\%(::\|'\)\I\i*\)*\%(::\|\i\@<=\)" nextgroup=perlVarMember,perlVarSimpleMember,perlMethod
|
||||||
|
syn match perlVarPlain2 "%\$*\%(\I\i*\)\=\%(\%(::\|'\)\I\i*\)*\%(::\|\i\@<=\)"
|
||||||
|
syn match perlFunctionName "&\$*\%(\I\i*\)\=\%(\%(::\|'\)\I\i*\)*\%(::\|\i\@<=\)" nextgroup=perlVarMember,perlVarSimpleMember,perlMethod
|
||||||
|
endif
|
||||||
|
|
||||||
|
if !exists("perl_no_extended_vars")
|
||||||
|
syn cluster perlExpr contains=perlStatementIndirObjWrap,perlStatementScalar,perlStatementRegexp,perlStatementNumeric,perlStatementList,perlStatementHash,perlStatementFiles,perlStatementTime,perlStatementMisc,perlVarPlain,perlVarPlain2,perlVarNotInMatches,perlVarSlash,perlVarBlock,perlVarBlock2,perlShellCommand,perlFloat,perlNumber,perlStringUnexpanded,perlString,perlQQ,perlArrow,perlBraces
|
||||||
|
syn region perlArrow matchgroup=perlArrow start="->\s*(" end=")" contains=@perlExpr nextgroup=perlVarMember,perlVarSimpleMember,perlMethod contained
|
||||||
|
syn region perlArrow matchgroup=perlArrow start="->\s*\[" end="\]" contains=@perlExpr nextgroup=perlVarMember,perlVarSimpleMember,perlMethod contained
|
||||||
|
syn region perlArrow matchgroup=perlArrow start="->\s*{" end="}" contains=@perlExpr nextgroup=perlVarMember,perlVarSimpleMember,perlMethod contained
|
||||||
|
syn match perlArrow "->\s*{\s*\I\i*\s*}" contains=perlVarSimpleMemberName nextgroup=perlVarMember,perlVarSimpleMember,perlMethod contained
|
||||||
|
syn region perlArrow matchgroup=perlArrow start="->\s*\$*\I\i*\s*(" end=")" contains=@perlExpr nextgroup=perlVarMember,perlVarSimpleMember,perlMethod contained
|
||||||
|
syn region perlVarBlock matchgroup=perlVarPlain start="\%($#\|[$@]\)\$*{" skip="\\}" end=+}\|\%(\%(<<\%('\|"\)\?\)\@=\)+ contains=@perlExpr nextgroup=perlVarMember,perlVarSimpleMember,perlMethod extend
|
||||||
|
syn region perlVarBlock2 matchgroup=perlVarPlain start="[%&*]\$*{" skip="\\}" end=+}\|\%(\%(<<\%('\|"\)\?\)\@=\)+ contains=@perlExpr nextgroup=perlVarMember,perlVarSimpleMember,perlMethod extend
|
||||||
|
syn match perlVarPlain2 "[%&*]\$*{\I\i*}" nextgroup=perlVarMember,perlVarSimpleMember,perlMethod extend
|
||||||
|
syn match perlVarPlain "\%(\$#\|[@$]\)\$*{\I\i*}" nextgroup=perlVarMember,perlVarSimpleMember,perlMethod extend
|
||||||
|
syn region perlVarMember matchgroup=perlVarPlain start="\%(->\)\={" skip="\\}" end="}" contained contains=@perlExpr nextgroup=perlVarMember,perlVarSimpleMember,perlMethod extend
|
||||||
|
syn match perlVarSimpleMember "\%(->\)\={\s*\I\i*\s*}" nextgroup=perlVarMember,perlVarSimpleMember,perlMethod contains=perlVarSimpleMemberName contained extend
|
||||||
|
syn match perlVarSimpleMemberName "\I\i*" contained
|
||||||
|
syn region perlVarMember matchgroup=perlVarPlain start="\%(->\)\=\[" skip="\\]" end="]" contained contains=@perlExpr nextgroup=perlVarMember,perlVarSimpleMember,perlMethod extend
|
||||||
|
syn match perlPackageConst "__PACKAGE__" nextgroup=perlMethod
|
||||||
|
syn match perlMethod "->\$*\I\i*" contained nextgroup=perlVarSimpleMember,perlVarMember,perlMethod
|
||||||
|
endif
|
||||||
|
|
||||||
|
" File Descriptors
|
||||||
|
syn match perlFiledescRead "<\h\w*>"
|
||||||
|
|
||||||
|
syn match perlFiledescStatementComma "(\=\s*\u\w*\s*,"me=e-1 transparent contained contains=perlFiledescStatement
|
||||||
|
syn match perlFiledescStatementNocomma "(\=\s*\u\w*\s*[^, \t]"me=e-1 transparent contained contains=perlFiledescStatement
|
||||||
|
|
||||||
|
syn match perlFiledescStatement "\u\w*" contained
|
||||||
|
|
||||||
|
" Special characters in strings and matches
|
||||||
|
syn match perlSpecialString "\\\%(\o\{1,3}\|x\%({\x\+}\|\x\{1,2}\)\|c.\|[^cx]\)" contained extend
|
||||||
|
syn match perlSpecialStringU2 "\\." extend contained contains=NONE
|
||||||
|
syn match perlSpecialStringU "\\\\" contained
|
||||||
|
syn match perlSpecialMatch "\\[1-9]" contained extend
|
||||||
|
syn match perlSpecialMatch "\\g\%(\d\+\|{\%(-\=\d\+\|\h\w*\)}\)" contained
|
||||||
|
syn match perlSpecialMatch "\\k\%(<\h\w*>\|'\h\w*'\)" contained
|
||||||
|
syn match perlSpecialMatch "{\d\+\%(,\%(\d\+\)\=\)\=}" contained
|
||||||
|
syn match perlSpecialMatch "\[[]-]\=[^\[\]]*[]-]\=\]" contained extend
|
||||||
|
syn match perlSpecialMatch "[+*()?.]" contained
|
||||||
|
syn match perlSpecialMatch "(?[#:=!]" contained
|
||||||
|
syn match perlSpecialMatch "(?[impsx]*\%(-[imsx]\+\)\=)" contained
|
||||||
|
syn match perlSpecialMatch "(?\%([-+]\=\d\+\|R\))" contained
|
||||||
|
syn match perlSpecialMatch "(?\%(&\|P[>=]\)\h\w*)" contained
|
||||||
|
syn match perlSpecialMatch "(\*\%(\%(PRUNE\|SKIP\|THEN\)\%(:[^)]*\)\=\|\%(MARK\|\):[^)]*\|COMMIT\|F\%(AIL\)\=\|ACCEPT\))" contained
|
||||||
|
|
||||||
|
" Possible errors
|
||||||
|
"
|
||||||
|
" Highlight lines with only whitespace (only in blank delimited here documents) as errors
|
||||||
|
syn match perlNotEmptyLine "^\s\+$" contained
|
||||||
|
" Highlight "} else if (...) {", it should be "} else { if (...) { " or "} elsif (...) {"
|
||||||
|
syn match perlElseIfError "else\_s*if" containedin=perlConditional
|
||||||
|
syn keyword perlElseIfError elseif containedin=perlConditional
|
||||||
|
|
||||||
|
" Variable interpolation
|
||||||
|
"
|
||||||
|
" These items are interpolated inside "" strings and similar constructs.
|
||||||
|
syn cluster perlInterpDQ contains=perlSpecialString,perlVarPlain,perlVarNotInMatches,perlVarSlash,perlVarBlock
|
||||||
|
" These items are interpolated inside '' strings and similar constructs.
|
||||||
|
syn cluster perlInterpSQ contains=perlSpecialStringU,perlSpecialStringU2
|
||||||
|
" These items are interpolated inside m// matches and s/// substitutions.
|
||||||
|
syn cluster perlInterpSlash contains=perlSpecialString,perlSpecialMatch,perlVarPlain,perlVarBlock
|
||||||
|
" These items are interpolated inside m## matches and s### substitutions.
|
||||||
|
syn cluster perlInterpMatch contains=@perlInterpSlash,perlVarSlash
|
||||||
|
|
||||||
|
" Shell commands
|
||||||
|
syn region perlShellCommand matchgroup=perlMatchStartEnd start="`" end="`" contains=@perlInterpDQ keepend
|
||||||
|
|
||||||
|
" Constants
|
||||||
|
"
|
||||||
|
" Numbers
|
||||||
|
syn match perlNumber "\<\%(0\%(x\x[[:xdigit:]_]*\|b[01][01_]*\|\o[0-7_]*\|\)\|[1-9][[:digit:]_]*\)\>"
|
||||||
|
syn match perlFloat "\<\d[[:digit:]_]*[eE][\-+]\=\d\+"
|
||||||
|
syn match perlFloat "\<\d[[:digit:]_]*\.[[:digit:]_]*\%([eE][\-+]\=\d\+\)\="
|
||||||
|
syn match perlFloat "\.[[:digit:]][[:digit:]_]*\%([eE][\-+]\=\d\+\)\="
|
||||||
|
|
||||||
|
syn match perlString "\<\%(v\d\+\%(\.\d\+\)*\|\d\+\%(\.\d\+\)\{2,}\)\>" contains=perlVStringV
|
||||||
|
syn match perlVStringV "\<v" contained
|
||||||
|
|
||||||
|
|
||||||
|
syn region perlParensSQ start=+(+ end=+)+ extend contained contains=perlParensSQ,@perlInterpSQ keepend
|
||||||
|
syn region perlBracketsSQ start=+\[+ end=+\]+ extend contained contains=perlBracketsSQ,@perlInterpSQ keepend
|
||||||
|
syn region perlBracesSQ start=+{+ end=+}+ extend contained contains=perlBracesSQ,@perlInterpSQ keepend
|
||||||
|
syn region perlAnglesSQ start=+<+ end=+>+ extend contained contains=perlAnglesSQ,@perlInterpSQ keepend
|
||||||
|
|
||||||
|
syn region perlParensDQ start=+(+ end=+)+ extend contained contains=perlParensDQ,@perlInterpDQ keepend
|
||||||
|
syn region perlBracketsDQ start=+\[+ end=+\]+ extend contained contains=perlBracketsDQ,@perlInterpDQ keepend
|
||||||
|
syn region perlBracesDQ start=+{+ end=+}+ extend contained contains=perlBracesDQ,@perlInterpDQ keepend
|
||||||
|
syn region perlAnglesDQ start=+<+ end=+>+ extend contained contains=perlAnglesDQ,@perlInterpDQ keepend
|
||||||
|
|
||||||
|
|
||||||
|
" Simple version of searches and matches
|
||||||
|
syn region perlMatch matchgroup=perlMatchStartEnd start=+\<\%(::\|'\|->\)\@<!m\>\s*\z([^[:space:]'([{<#]\)+ end=+\z1[msixpodualgc]*+ contains=@perlInterpMatch keepend extend
|
||||||
|
syn region perlMatch matchgroup=perlMatchStartEnd start=+\<\%(::\|'\|->\)\@<!m#+ end=+#[msixpodualgc]*+ contains=@perlInterpMatch keepend extend
|
||||||
|
syn region perlMatch matchgroup=perlMatchStartEnd start=+\<\%(::\|'\|->\)\@<!m\s*'+ end=+'[msixpodualgc]*+ contains=@perlInterpSQ keepend extend
|
||||||
|
syn region perlMatch matchgroup=perlMatchStartEnd start=+\<\%(::\|'\|->\)\@<!m\s*/+ end=+/[msixpodualgc]*+ contains=@perlInterpSlash keepend extend
|
||||||
|
syn region perlMatch matchgroup=perlMatchStartEnd start=+\<\%(::\|'\|->\)\@<!m\s*(+ end=+)[msixpodualgc]*+ contains=@perlInterpMatch,perlParensDQ keepend extend
|
||||||
|
|
||||||
|
" A special case for m{}, m<> and m[] which allows for comments and extra whitespace in the pattern
|
||||||
|
syn region perlMatch matchgroup=perlMatchStartEnd start=+\<\%(::\|'\|->\)\@<!m\s*{+ end=+}[msixpodualgc]*+ contains=@perlInterpMatch,perlComment,perlBracesDQ extend
|
||||||
|
syn region perlMatch matchgroup=perlMatchStartEnd start=+\<\%(::\|'\|->\)\@<!m\s*<+ end=+>[msixpodualgc]*+ contains=@perlInterpMatch,perlAnglesDQ keepend extend
|
||||||
|
syn region perlMatch matchgroup=perlMatchStartEnd start=+\<\%(::\|'\|->\)\@<!m\s*\[+ end=+\][msixpodualgc]*+ contains=@perlInterpMatch,perlComment,perlBracketsDQ keepend extend
|
||||||
|
|
||||||
|
" Below some hacks to recognise the // variant. This is virtually impossible to catch in all
|
||||||
|
" cases as the / is used in so many other ways, but these should be the most obvious ones.
|
||||||
|
syn region perlMatch matchgroup=perlMatchStartEnd start="\%([$@%&*]\@<!\%(\<split\|\<while\|\<if\|\<unless\|\.\.\|[-+*!~(\[{=]\)\s*\)\@<=/\%(/=\)\@!" start=+^/\%(/=\)\@!+ start=+\s\@<=/\%(/=\)\@![^[:space:][:digit:]$@%=]\@=\%(/\_s*\%([([{$@%&*[:digit:]"'`]\|\_s\w\|[[:upper:]_abd-fhjklnqrt-wyz]\)\)\@!+ skip=+\\/+ end=+/[msixpodualgc]*+ contains=@perlInterpSlash extend
|
||||||
|
|
||||||
|
|
||||||
|
" Substitutions
|
||||||
|
" perlMatch is the first part, perlSubstitution* is the substitution part
|
||||||
|
syn region perlMatch matchgroup=perlMatchStartEnd start=+\<\%(::\|'\|->\)\@<!s\>\s*\z([^[:space:]'([{<#]\)+ end=+\z1+me=e-1 contains=@perlInterpMatch nextgroup=perlSubstitutionGQQ keepend extend
|
||||||
|
syn region perlMatch matchgroup=perlMatchStartEnd start=+\<\%(::\|'\|->\)\@<!s\s*'+ end=+'+me=e-1 contains=@perlInterpSQ nextgroup=perlSubstitutionSQ keepend extend
|
||||||
|
syn region perlMatch matchgroup=perlMatchStartEnd start=+\<\%(::\|'\|->\)\@<!s\s*/+ end=+/+me=e-1 contains=@perlInterpSlash nextgroup=perlSubstitutionGQQ keepend extend
|
||||||
|
syn region perlMatch matchgroup=perlMatchStartEnd start=+\<\%(::\|'\|->\)\@<!s#+ end=+#+me=e-1 contains=@perlInterpMatch nextgroup=perlSubstitutionGQQ keepend extend
|
||||||
|
syn region perlMatch matchgroup=perlMatchStartEnd start=+\<\%(::\|'\|->\)\@<!s\s*(+ end=+)+ contains=@perlInterpMatch,perlParensDQ nextgroup=perlSubstitutionGQQ skipwhite skipempty skipnl keepend extend
|
||||||
|
syn region perlMatch matchgroup=perlMatchStartEnd start=+\<\%(::\|'\|->\)\@<!s\s*<+ end=+>+ contains=@perlInterpMatch,perlAnglesDQ nextgroup=perlSubstitutionGQQ skipwhite skipempty skipnl keepend extend
|
||||||
|
syn region perlMatch matchgroup=perlMatchStartEnd start=+\<\%(::\|'\|->\)\@<!s\s*\[+ end=+\]+ contains=@perlInterpMatch,perlBracketsDQ nextgroup=perlSubstitutionGQQ skipwhite skipempty skipnl keepend extend
|
||||||
|
syn region perlMatch matchgroup=perlMatchStartEnd start=+\<\%(::\|'\|->\)\@<!s\s*{+ end=+}+ contains=@perlInterpMatch,perlBracesDQ nextgroup=perlSubstitutionGQQ skipwhite skipempty skipnl keepend extend
|
||||||
|
syn region perlSubstitutionGQQ matchgroup=perlMatchStartEnd start=+\z([^[:space:]'([{<]\)+ end=+\z1[msixpodualgcer]*+ keepend contained contains=@perlInterpDQ extend
|
||||||
|
syn region perlSubstitutionGQQ matchgroup=perlMatchStartEnd start=+(+ end=+)[msixpodualgcer]*+ contained contains=@perlInterpDQ,perlParensDQ keepend extend
|
||||||
|
syn region perlSubstitutionGQQ matchgroup=perlMatchStartEnd start=+\[+ end=+\][msixpodualgcer]*+ contained contains=@perlInterpDQ,perlBracketsDQ keepend extend
|
||||||
|
syn region perlSubstitutionGQQ matchgroup=perlMatchStartEnd start=+{+ end=+}[msixpodualgcer]*+ contained contains=@perlInterpDQ,perlBracesDQ keepend extend extend
|
||||||
|
syn region perlSubstitutionGQQ matchgroup=perlMatchStartEnd start=+<+ end=+>[msixpodualgcer]*+ contained contains=@perlInterpDQ,perlAnglesDQ keepend extend
|
||||||
|
syn region perlSubstitutionSQ matchgroup=perlMatchStartEnd start=+'+ end=+'[msixpodualgcer]*+ contained contains=@perlInterpSQ keepend extend
|
||||||
|
|
||||||
|
" Translations
|
||||||
|
" perlMatch is the first part, perlTranslation* is the second, translator part.
|
||||||
|
syn region perlMatch matchgroup=perlMatchStartEnd start=+\<\%(::\|'\|->\)\@<!\%(tr\|y\)\>\s*\z([^[:space:]([{<#]\)+ end=+\z1+me=e-1 contains=@perlInterpSQ nextgroup=perlTranslationGQ
|
||||||
|
syn region perlMatch matchgroup=perlMatchStartEnd start=+\<\%(::\|'\|->\)\@<!\%(tr\|y\)#+ end=+#+me=e-1 contains=@perlInterpSQ nextgroup=perlTranslationGQ
|
||||||
|
syn region perlMatch matchgroup=perlMatchStartEnd start=+\<\%(::\|'\|->\)\@<!\%(tr\|y\)\s*\[+ end=+\]+ contains=@perlInterpSQ,perlBracketsSQ nextgroup=perlTranslationGQ skipwhite skipempty skipnl
|
||||||
|
syn region perlMatch matchgroup=perlMatchStartEnd start=+\<\%(::\|'\|->\)\@<!\%(tr\|y\)\s*(+ end=+)+ contains=@perlInterpSQ,perlParensSQ nextgroup=perlTranslationGQ skipwhite skipempty skipnl
|
||||||
|
syn region perlMatch matchgroup=perlMatchStartEnd start=+\<\%(::\|'\|->\)\@<!\%(tr\|y\)\s*<+ end=+>+ contains=@perlInterpSQ,perlAnglesSQ nextgroup=perlTranslationGQ skipwhite skipempty skipnl
|
||||||
|
syn region perlMatch matchgroup=perlMatchStartEnd start=+\<\%(::\|'\|->\)\@<!\%(tr\|y\)\s*{+ end=+}+ contains=@perlInterpSQ,perlBracesSQ nextgroup=perlTranslationGQ skipwhite skipempty skipnl
|
||||||
|
syn region perlTranslationGQ matchgroup=perlMatchStartEnd start=+\z([^[:space:]([{<]\)+ end=+\z1[cdsr]*+ contained
|
||||||
|
syn region perlTranslationGQ matchgroup=perlMatchStartEnd start=+(+ end=+)[cdsr]*+ contains=perlParensSQ contained
|
||||||
|
syn region perlTranslationGQ matchgroup=perlMatchStartEnd start=+\[+ end=+\][cdsr]*+ contains=perlBracketsSQ contained
|
||||||
|
syn region perlTranslationGQ matchgroup=perlMatchStartEnd start=+{+ end=+}[cdsr]*+ contains=perlBracesSQ contained
|
||||||
|
syn region perlTranslationGQ matchgroup=perlMatchStartEnd start=+<+ end=+>[cdsr]*+ contains=perlAnglesSQ contained
|
||||||
|
|
||||||
|
|
||||||
|
" Strings and q, qq, qw and qr expressions
|
||||||
|
|
||||||
|
syn region perlStringUnexpanded matchgroup=perlStringStartEnd start="'" end="'" contains=@perlInterpSQ keepend extend
|
||||||
|
syn region perlString matchgroup=perlStringStartEnd start=+"+ end=+"+ contains=@perlInterpDQ keepend extend
|
||||||
|
syn region perlQQ matchgroup=perlStringStartEnd start=+\<\%(::\|'\|->\)\@<!q\>\s*\z([^[:space:]#([{<]\)+ end=+\z1+ contains=@perlInterpSQ keepend extend
|
||||||
|
syn region perlQQ matchgroup=perlStringStartEnd start=+\<\%(::\|'\|->\)\@<!q#+ end=+#+ contains=@perlInterpSQ keepend extend
|
||||||
|
syn region perlQQ matchgroup=perlStringStartEnd start=+\<\%(::\|'\|->\)\@<!q\s*(+ end=+)+ contains=@perlInterpSQ,perlParensSQ keepend extend
|
||||||
|
syn region perlQQ matchgroup=perlStringStartEnd start=+\<\%(::\|'\|->\)\@<!q\s*\[+ end=+\]+ contains=@perlInterpSQ,perlBracketsSQ keepend extend
|
||||||
|
syn region perlQQ matchgroup=perlStringStartEnd start=+\<\%(::\|'\|->\)\@<!q\s*{+ end=+}+ contains=@perlInterpSQ,perlBracesSQ keepend extend
|
||||||
|
syn region perlQQ matchgroup=perlStringStartEnd start=+\<\%(::\|'\|->\)\@<!q\s*<+ end=+>+ contains=@perlInterpSQ,perlAnglesSQ keepend extend
|
||||||
|
|
||||||
|
syn region perlQQ matchgroup=perlStringStartEnd start=+\<\%(::\|'\|->\)\@<!q[qx]\>\s*\z([^[:space:]#([{<]\)+ end=+\z1+ contains=@perlInterpDQ keepend extend
|
||||||
|
syn region perlQQ matchgroup=perlStringStartEnd start=+\<\%(::\|'\|->\)\@<!q[qx]#+ end=+#+ contains=@perlInterpDQ keepend extend
|
||||||
|
syn region perlQQ matchgroup=perlStringStartEnd start=+\<\%(::\|'\|->\)\@<!q[qx]\s*(+ end=+)+ contains=@perlInterpDQ,perlParensDQ keepend extend
|
||||||
|
syn region perlQQ matchgroup=perlStringStartEnd start=+\<\%(::\|'\|->\)\@<!q[qx]\s*\[+ end=+\]+ contains=@perlInterpDQ,perlBracketsDQ keepend extend
|
||||||
|
syn region perlQQ matchgroup=perlStringStartEnd start=+\<\%(::\|'\|->\)\@<!q[qx]\s*{+ end=+}+ contains=@perlInterpDQ,perlBracesDQ keepend extend
|
||||||
|
syn region perlQQ matchgroup=perlStringStartEnd start=+\<\%(::\|'\|->\)\@<!q[qx]\s*<+ end=+>+ contains=@perlInterpDQ,perlAnglesDQ keepend extend
|
||||||
|
|
||||||
|
syn region perlQQ matchgroup=perlStringStartEnd start=+\<\%(::\|'\|->\)\@<!qw\s*\z([^[:space:]#([{<]\)+ end=+\z1+ contains=@perlInterpSQ keepend extend
|
||||||
|
syn region perlQQ matchgroup=perlStringStartEnd start=+\<\%(::\|'\|->\)\@<!qw#+ end=+#+ contains=@perlInterpSQ keepend extend
|
||||||
|
syn region perlQQ matchgroup=perlStringStartEnd start=+\<\%(::\|'\|->\)\@<!qw\s*(+ end=+)+ contains=@perlInterpSQ,perlParensSQ keepend extend
|
||||||
|
syn region perlQQ matchgroup=perlStringStartEnd start=+\<\%(::\|'\|->\)\@<!qw\s*\[+ end=+\]+ contains=@perlInterpSQ,perlBracketsSQ keepend extend
|
||||||
|
syn region perlQQ matchgroup=perlStringStartEnd start=+\<\%(::\|'\|->\)\@<!qw\s*{+ end=+}+ contains=@perlInterpSQ,perlBracesSQ keepend extend
|
||||||
|
syn region perlQQ matchgroup=perlStringStartEnd start=+\<\%(::\|'\|->\)\@<!qw\s*<+ end=+>+ contains=@perlInterpSQ,perlAnglesSQ keepend extend
|
||||||
|
|
||||||
|
syn region perlQQ matchgroup=perlStringStartEnd start=+\<\%(::\|'\|->\)\@<!qr\>\s*\z([^[:space:]#([{<'/]\)+ end=+\z1[imosx]*+ contains=@perlInterpMatch keepend extend
|
||||||
|
syn region perlQQ matchgroup=perlStringStartEnd start=+\<\%(::\|'\|->\)\@<!qr\s*/+ end=+/[imosx]*+ contains=@perlInterpSlash keepend extend
|
||||||
|
syn region perlQQ matchgroup=perlStringStartEnd start=+\<\%(::\|'\|->\)\@<!qr#+ end=+#[imosx]*+ contains=@perlInterpMatch keepend extend
|
||||||
|
syn region perlQQ matchgroup=perlStringStartEnd start=+\<\%(::\|'\|->\)\@<!qr\s*'+ end=+'[imosx]*+ contains=@perlInterpSQ keepend extend
|
||||||
|
syn region perlQQ matchgroup=perlStringStartEnd start=+\<\%(::\|'\|->\)\@<!qr\s*(+ end=+)[imosx]*+ contains=@perlInterpMatch,perlParensDQ keepend extend
|
||||||
|
|
||||||
|
" A special case for qr{}, qr<> and qr[] which allows for comments and extra whitespace in the pattern
|
||||||
|
syn region perlQQ matchgroup=perlStringStartEnd start=+\<\%(::\|'\|->\)\@<!qr\s*{+ end=+}[imosx]*+ contains=@perlInterpMatch,perlBracesDQ,perlComment keepend extend
|
||||||
|
syn region perlQQ matchgroup=perlStringStartEnd start=+\<\%(::\|'\|->\)\@<!qr\s*<+ end=+>[imosx]*+ contains=@perlInterpMatch,perlAnglesDQ,perlComment keepend extend
|
||||||
|
syn region perlQQ matchgroup=perlStringStartEnd start=+\<\%(::\|'\|->\)\@<!qr\s*\[+ end=+\][imosx]*+ contains=@perlInterpMatch,perlBracketsDQ,perlComment keepend extend
|
||||||
|
|
||||||
|
" Constructs such as print <<EOF [...] EOF, 'here' documents
|
||||||
|
"
|
||||||
|
" XXX Any statements after the identifier are in perlString colour (i.e.
|
||||||
|
" 'if $a' in 'print <<EOF if $a'). This is almost impossible to get right it
|
||||||
|
" seems due to the 'auto-extending nature' of regions.
|
||||||
|
if exists("perl_fold")
|
||||||
|
syn region perlHereDoc matchgroup=perlStringStartEnd start=+<<\z(\I\i*\).*+ end=+^\z1$+ contains=@perlInterpDQ fold extend
|
||||||
|
syn region perlHereDoc matchgroup=perlStringStartEnd start=+<<\s*"\z([^\\"]*\%(\\.[^\\"]*\)*\)"+ end=+^\z1$+ contains=@perlInterpDQ fold extend
|
||||||
|
syn region perlHereDoc matchgroup=perlStringStartEnd start=+<<\s*'\z([^\\']*\%(\\.[^\\']*\)*\)'+ end=+^\z1$+ contains=@perlInterpSQ fold extend
|
||||||
|
syn region perlHereDoc matchgroup=perlStringStartEnd start=+<<\s*""+ end=+^$+ contains=@perlInterpDQ,perlNotEmptyLine fold extend
|
||||||
|
syn region perlHereDoc matchgroup=perlStringStartEnd start=+<<\s*''+ end=+^$+ contains=@perlInterpSQ,perlNotEmptyLine fold extend
|
||||||
|
syn region perlAutoload matchgroup=perlStringStartEnd start=+<<\s*\(['"]\=\)\z(END_\%(SUB\|OF_FUNC\|OF_AUTOLOAD\)\)\1+ end=+^\z1$+ contains=ALL fold extend
|
||||||
|
else
|
||||||
|
syn region perlHereDoc matchgroup=perlStringStartEnd start=+<<\z(\I\i*\).*+ end=+^\z1$+ contains=@perlInterpDQ
|
||||||
|
syn region perlHereDoc matchgroup=perlStringStartEnd start=+<<\s*"\z([^\\"]*\%(\\.[^\\"]*\)*\)"+ end=+^\z1$+ contains=@perlInterpDQ
|
||||||
|
syn region perlHereDoc matchgroup=perlStringStartEnd start=+<<\s*'\z([^\\']*\%(\\.[^\\']*\)*\)'+ end=+^\z1$+ contains=@perlInterpSQ
|
||||||
|
syn region perlHereDoc matchgroup=perlStringStartEnd start=+<<\s*""+ end=+^$+ contains=@perlInterpDQ,perlNotEmptyLine
|
||||||
|
syn region perlHereDoc matchgroup=perlStringStartEnd start=+<<\s*''+ end=+^$+ contains=@perlInterpSQ,perlNotEmptyLine
|
||||||
|
syn region perlAutoload matchgroup=perlStringStartEnd start=+<<\s*\(['"]\=\)\z(END_\%(SUB\|OF_FUNC\|OF_AUTOLOAD\)\)\1+ end=+^\z1$+ contains=ALL
|
||||||
|
endif
|
||||||
|
|
||||||
|
|
||||||
|
" Class declarations
|
||||||
|
"
|
||||||
|
syn match perlPackageDecl "\<package\s\+\%(\h\|::\)\%(\w\|::\)*" contains=perlStatementPackage
|
||||||
|
syn keyword perlStatementPackage package contained
|
||||||
|
|
||||||
|
" Functions
|
||||||
|
" sub [name] [(prototype)] {
|
||||||
|
"
|
||||||
|
syn match perlSubError "[^[:space:];{#]" contained
|
||||||
|
if v:version == 701 && !has('patch221') " XXX I hope that's the right one
|
||||||
|
syn match perlSubAttributes ":" contained
|
||||||
|
else
|
||||||
|
syn match perlSubAttributesCont "\h\w*\_s*\%(:\_s*\)\=" nextgroup=@perlSubAttrMaybe contained
|
||||||
|
syn region perlSubAttributesCont matchgroup=perlSubAttributesCont start="\h\w*(" end=")\_s*\%(:\_s*\)\=" nextgroup=@perlSubAttrMaybe contained contains=@perlInterpSQ,perlParensSQ
|
||||||
|
syn cluster perlSubAttrMaybe contains=perlSubAttributesCont,perlSubError,perlFakeGroup
|
||||||
|
syn match perlSubAttributes "" contained nextgroup=perlSubError
|
||||||
|
syn match perlSubAttributes ":\_s*" contained nextgroup=@perlSubAttrMaybe
|
||||||
|
endif
|
||||||
|
syn match perlSubPrototypeError "(\%(\_s*\%(\%(\\\%([$@%&*]\|\[[$@%&*]\+\]\)\|[$&*]\|[@%]\%(\_s*)\)\@=\|;\%(\_s*[)$@%&*\\]\)\@=\|_\%(\_s*[);]\)\@=\)\_s*\)*\)\@>\zs\_[^)]\+" contained
|
||||||
|
syn match perlSubPrototype +(\_[^)]*)\_s*\|+ nextgroup=perlSubAttributes,perlComment contained contains=perlSubPrototypeError
|
||||||
|
syn match perlSubName +\%(\h\|::\|'\w\)\%(\w\|::\|'\w\)*\_s*\|+ contained nextgroup=perlSubPrototype,perlComment
|
||||||
|
|
||||||
|
syn match perlFunction +\<sub\>\_s*+ nextgroup=perlSubName
|
||||||
|
|
||||||
|
" The => operator forces a bareword to the left of it to be interpreted as
|
||||||
|
" a string
|
||||||
|
syn match perlString "\I\@<!-\?\I\i*\%(\s*=>\)\@="
|
||||||
|
|
||||||
|
" All other # are comments, except ^#!
|
||||||
|
syn match perlComment "#.*" contains=perlTodo,@Spell extend
|
||||||
|
syn match perlSharpBang "^#!.*"
|
||||||
|
|
||||||
|
" Formats
|
||||||
|
syn region perlFormat matchgroup=perlStatementIOFunc start="^\s*\<format\s\+\k\+\s*=\s*$"rs=s+6 end="^\s*\.\s*$" contains=perlFormatName,perlFormatField,perlVarPlain,perlVarPlain2
|
||||||
|
syn match perlFormatName "format\s\+\k\+\s*="lc=7,me=e-1 contained
|
||||||
|
syn match perlFormatField "[@^][|<>~]\+\%(\.\.\.\)\=" contained
|
||||||
|
syn match perlFormatField "[@^]#[#.]*" contained
|
||||||
|
syn match perlFormatField "@\*" contained
|
||||||
|
syn match perlFormatField "@[^A-Za-z_|<>~#*]"me=e-1 contained
|
||||||
|
syn match perlFormatField "@$" contained
|
||||||
|
|
||||||
|
" __END__ and __DATA__ clauses
|
||||||
|
if exists("perl_fold")
|
||||||
|
syntax region perlDATA start="^__DATA__$" skip="." end="." fold
|
||||||
|
syntax region perlDATA start="^__END__$" skip="." end="." contains=perlPOD,@perlDATA fold
|
||||||
|
else
|
||||||
|
syntax region perlDATA start="^__DATA__$" skip="." end="."
|
||||||
|
syntax region perlDATA start="^__END__$" skip="." end="." contains=perlPOD,@perlDATA
|
||||||
|
endif
|
||||||
|
|
||||||
|
"
|
||||||
|
" Folding
|
||||||
|
|
||||||
|
if exists("perl_fold")
|
||||||
|
" Note: this bit must come before the actual highlighting of the "package"
|
||||||
|
" keyword, otherwise this will screw up Pod lines that match /^package/
|
||||||
|
if !exists("perl_nofold_packages")
|
||||||
|
syn region perlPackageFold start="^package \S\+;\s*\%(#.*\)\=$" end="^1;\=\s*\%(#.*\)\=$" end="\n\+package"me=s-1 transparent fold keepend
|
||||||
|
endif
|
||||||
|
if !exists("perl_nofold_subs")
|
||||||
|
if exists("perl_fold_anonymous_subs") && perl_fold_anonymous_subs
|
||||||
|
syn region perlSubFold start="\<sub\>[^\n;]*{" end="}" transparent fold keepend extend
|
||||||
|
syn region perlSubFold start="\<\%(BEGIN\|END\|CHECK\|INIT\)\>\s*{" end="}" transparent fold keepend
|
||||||
|
else
|
||||||
|
syn region perlSubFold start="^\z(\s*\)\<sub\>.*[^};]$" end="^\z1}\s*\%(#.*\)\=$" transparent fold keepend
|
||||||
|
syn region perlSubFold start="^\z(\s*\)\<\%(BEGIN\|END\|CHECK\|INIT\|UNITCHECK\)\>.*[^};]$" end="^\z1}\s*$" transparent fold keepend
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
|
||||||
|
if exists("perl_fold_blocks")
|
||||||
|
syn region perlBlockFold start="^\z(\s*\)\%(if\|elsif\|unless\|for\|while\|until\|given\)\s*(.*)\%(\s*{\)\=\s*\%(#.*\)\=$" start="^\z(\s*\)foreach\s*\%(\%(my\|our\)\=\s*\S\+\s*\)\=(.*)\%(\s*{\)\=\s*\%(#.*\)\=$" end="^\z1}\s*;\=\%(#.*\)\=$" transparent fold keepend
|
||||||
|
syn region perlBlockFold start="^\z(\s*\)\%(do\|else\)\%(\s*{\)\=\s*\%(#.*\)\=$" end="^\z1}\s*while" end="^\z1}\s*;\=\%(#.*\)\=$" transparent fold keepend
|
||||||
|
endif
|
||||||
|
|
||||||
|
setlocal foldmethod=syntax
|
||||||
|
syn sync fromstart
|
||||||
|
else
|
||||||
|
" fromstart above seems to set minlines even if perl_fold is not set.
|
||||||
|
syn sync minlines=0
|
||||||
|
endif
|
||||||
|
|
||||||
|
command -nargs=+ HiLink hi def link <args>
|
||||||
|
|
||||||
|
" NOTE: If you're linking new highlight groups to perlString, please also put
|
||||||
|
" them into b:match_skip in ftplugin/perl.vim.
|
||||||
|
|
||||||
|
" The default highlighting.
|
||||||
|
HiLink perlSharpBang PreProc
|
||||||
|
HiLink perlControl PreProc
|
||||||
|
HiLink perlInclude Include
|
||||||
|
HiLink perlSpecial Special
|
||||||
|
HiLink perlString String
|
||||||
|
HiLink perlCharacter Character
|
||||||
|
HiLink perlNumber Number
|
||||||
|
HiLink perlFloat Float
|
||||||
|
HiLink perlType Type
|
||||||
|
HiLink perlIdentifier Identifier
|
||||||
|
HiLink perlLabel Label
|
||||||
|
HiLink perlStatement Statement
|
||||||
|
HiLink perlConditional Conditional
|
||||||
|
HiLink perlRepeat Repeat
|
||||||
|
HiLink perlOperator Operator
|
||||||
|
HiLink perlFunction Keyword
|
||||||
|
HiLink perlSubName Function
|
||||||
|
HiLink perlSubPrototype Type
|
||||||
|
HiLink perlSubAttributes PreProc
|
||||||
|
HiLink perlSubAttributesCont perlSubAttributes
|
||||||
|
HiLink perlComment Comment
|
||||||
|
HiLink perlTodo Todo
|
||||||
|
if exists("perl_string_as_statement")
|
||||||
|
HiLink perlStringStartEnd perlStatement
|
||||||
|
else
|
||||||
|
HiLink perlStringStartEnd perlString
|
||||||
|
endif
|
||||||
|
HiLink perlVStringV perlStringStartEnd
|
||||||
|
HiLink perlList perlStatement
|
||||||
|
HiLink perlMisc perlStatement
|
||||||
|
HiLink perlVarPlain perlIdentifier
|
||||||
|
HiLink perlVarPlain2 perlIdentifier
|
||||||
|
HiLink perlArrow perlIdentifier
|
||||||
|
HiLink perlFiledescRead perlIdentifier
|
||||||
|
HiLink perlFiledescStatement perlIdentifier
|
||||||
|
HiLink perlVarSimpleMember perlIdentifier
|
||||||
|
HiLink perlVarSimpleMemberName perlString
|
||||||
|
HiLink perlVarNotInMatches perlIdentifier
|
||||||
|
HiLink perlVarSlash perlIdentifier
|
||||||
|
HiLink perlQQ perlString
|
||||||
|
HiLink perlHereDoc perlString
|
||||||
|
HiLink perlStringUnexpanded perlString
|
||||||
|
HiLink perlSubstitutionSQ perlString
|
||||||
|
HiLink perlSubstitutionGQQ perlString
|
||||||
|
HiLink perlTranslationGQ perlString
|
||||||
|
HiLink perlMatch perlString
|
||||||
|
HiLink perlMatchStartEnd perlStatement
|
||||||
|
HiLink perlFormatName perlIdentifier
|
||||||
|
HiLink perlFormatField perlString
|
||||||
|
HiLink perlPackageDecl perlType
|
||||||
|
HiLink perlStorageClass perlType
|
||||||
|
HiLink perlPackageRef perlType
|
||||||
|
HiLink perlStatementPackage perlStatement
|
||||||
|
HiLink perlStatementStorage perlStatement
|
||||||
|
HiLink perlStatementControl perlStatement
|
||||||
|
HiLink perlStatementScalar perlStatement
|
||||||
|
HiLink perlStatementRegexp perlStatement
|
||||||
|
HiLink perlStatementNumeric perlStatement
|
||||||
|
HiLink perlStatementList perlStatement
|
||||||
|
HiLink perlStatementHash perlStatement
|
||||||
|
HiLink perlStatementIOfunc perlStatement
|
||||||
|
HiLink perlStatementFiledesc perlStatement
|
||||||
|
HiLink perlStatementVector perlStatement
|
||||||
|
HiLink perlStatementFiles perlStatement
|
||||||
|
HiLink perlStatementFlow perlStatement
|
||||||
|
HiLink perlStatementInclude perlStatement
|
||||||
|
HiLink perlStatementProc perlStatement
|
||||||
|
HiLink perlStatementSocket perlStatement
|
||||||
|
HiLink perlStatementIPC perlStatement
|
||||||
|
HiLink perlStatementNetwork perlStatement
|
||||||
|
HiLink perlStatementPword perlStatement
|
||||||
|
HiLink perlStatementTime perlStatement
|
||||||
|
HiLink perlStatementMisc perlStatement
|
||||||
|
HiLink perlStatementIndirObj perlStatement
|
||||||
|
HiLink perlFunctionName perlIdentifier
|
||||||
|
HiLink perlMethod perlIdentifier
|
||||||
|
HiLink perlFunctionPRef perlType
|
||||||
|
HiLink perlPOD perlComment
|
||||||
|
HiLink perlShellCommand perlString
|
||||||
|
HiLink perlSpecialAscii perlSpecial
|
||||||
|
HiLink perlSpecialDollar perlSpecial
|
||||||
|
HiLink perlSpecialString perlSpecial
|
||||||
|
HiLink perlSpecialStringU perlSpecial
|
||||||
|
HiLink perlSpecialMatch perlSpecial
|
||||||
|
HiLink perlDATA perlComment
|
||||||
|
|
||||||
|
" NOTE: Due to a bug in Vim (or more likely, a misunderstanding on my part),
|
||||||
|
" I had to remove the transparent property from the following regions
|
||||||
|
" in order to get them to highlight correctly. Feel free to remove
|
||||||
|
" these and reinstate the transparent property if you know how.
|
||||||
|
HiLink perlParensSQ perlString
|
||||||
|
HiLink perlBracketsSQ perlString
|
||||||
|
HiLink perlBracesSQ perlString
|
||||||
|
HiLink perlAnglesSQ perlString
|
||||||
|
|
||||||
|
HiLink perlParensDQ perlString
|
||||||
|
HiLink perlBracketsDQ perlString
|
||||||
|
HiLink perlBracesDQ perlString
|
||||||
|
HiLink perlAnglesDQ perlString
|
||||||
|
|
||||||
|
HiLink perlSpecialStringU2 perlString
|
||||||
|
|
||||||
|
" Possible errors
|
||||||
|
HiLink perlNotEmptyLine Error
|
||||||
|
HiLink perlElseIfError Error
|
||||||
|
HiLink perlSubPrototypeError Error
|
||||||
|
HiLink perlSubError Error
|
||||||
|
|
||||||
|
delcommand HiLink
|
||||||
|
|
||||||
|
" Syncing to speed up processing
|
||||||
|
"
|
||||||
|
if !exists("perl_no_sync_on_sub")
|
||||||
|
syn sync match perlSync grouphere NONE "^\s*\<package\s"
|
||||||
|
syn sync match perlSync grouphere NONE "^\s*\<sub\>"
|
||||||
|
syn sync match perlSync grouphere NONE "^}"
|
||||||
|
endif
|
||||||
|
|
||||||
|
if !exists("perl_no_sync_on_global_var")
|
||||||
|
syn sync match perlSync grouphere NONE "^$\I[[:alnum:]_:]+\s*=\s*{"
|
||||||
|
syn sync match perlSync grouphere NONE "^[@%]\I[[:alnum:]_:]+\s*=\s*("
|
||||||
|
endif
|
||||||
|
|
||||||
|
if exists("perl_sync_dist")
|
||||||
|
execute "syn sync maxlines=" . perl_sync_dist
|
||||||
|
else
|
||||||
|
syn sync maxlines=100
|
||||||
|
endif
|
||||||
|
|
||||||
|
syn sync match perlSyncPOD grouphere perlPOD "^=pod"
|
||||||
|
syn sync match perlSyncPOD grouphere perlPOD "^=head"
|
||||||
|
syn sync match perlSyncPOD grouphere perlPOD "^=item"
|
||||||
|
syn sync match perlSyncPOD grouphere NONE "^=cut"
|
||||||
|
|
||||||
|
let b:current_syntax = "perl"
|
||||||
|
|
||||||
|
if exists('®expengine')
|
||||||
|
let ®expengine=s:regexpengine
|
||||||
|
unlet s:regexpengine
|
||||||
|
endif
|
||||||
|
|
||||||
|
let &cpo = s:cpo_save
|
||||||
|
unlet s:cpo_save
|
||||||
|
|
||||||
|
" XXX Change to sts=4:sw=4
|
||||||
|
" vim:ts=8:sts=2:sw=2:expandtab:ft=vim
|
||||||
2255
syntax/perl6.vim
Normal file
2255
syntax/perl6.vim
Normal file
File diff suppressed because it is too large
Load Diff
189
syntax/pod.vim
Normal file
189
syntax/pod.vim
Normal file
@@ -0,0 +1,189 @@
|
|||||||
|
" Vim syntax file
|
||||||
|
" Language: Perl POD format
|
||||||
|
" Maintainer: vim-perl <vim-perl@googlegroups.com>
|
||||||
|
" Previously: Scott Bigham <dsb@killerbunnies.org>
|
||||||
|
" Homepage: http://github.com/vim-perl/vim-perl
|
||||||
|
" Bugs/requests: http://github.com/vim-perl/vim-perl/issues
|
||||||
|
" Last Change: {{LAST_CHANGE}}
|
||||||
|
|
||||||
|
" To add embedded POD documentation highlighting to your syntax file, add
|
||||||
|
" the commands:
|
||||||
|
"
|
||||||
|
" syn include @Pod <sfile>:p:h/pod.vim
|
||||||
|
" syn region myPOD start="^=pod" start="^=head" end="^=cut" keepend contained contains=@Pod
|
||||||
|
"
|
||||||
|
" and add myPod to the contains= list of some existing region, probably a
|
||||||
|
" comment. The "keepend" flag is needed because "=cut" is matched as a
|
||||||
|
" pattern in its own right.
|
||||||
|
|
||||||
|
|
||||||
|
" Remove any old syntax stuff hanging around (this is suppressed
|
||||||
|
" automatically by ":syn include" if necessary).
|
||||||
|
" For version 5.x: Clear all syntax items
|
||||||
|
" For version 6.x: Quit when a syntax file was already loaded
|
||||||
|
if version < 600
|
||||||
|
syntax clear
|
||||||
|
elseif exists("b:current_syntax")
|
||||||
|
finish
|
||||||
|
endif
|
||||||
|
|
||||||
|
let s:cpo_save = &cpo
|
||||||
|
set cpo&vim
|
||||||
|
|
||||||
|
" POD commands
|
||||||
|
syn match podCommand "^=encoding" nextgroup=podCmdText contains=@NoSpell
|
||||||
|
syn match podCommand "^=head[1234]" nextgroup=podCmdText contains=@NoSpell
|
||||||
|
syn match podCommand "^=item" nextgroup=podCmdText contains=@NoSpell
|
||||||
|
syn match podCommand "^=over" nextgroup=podOverIndent skipwhite contains=@NoSpell
|
||||||
|
syn match podCommand "^=back" contains=@NoSpell
|
||||||
|
syn match podCommand "^=cut" contains=@NoSpell
|
||||||
|
syn match podCommand "^=pod" contains=@NoSpell
|
||||||
|
syn match podCommand "^=for" nextgroup=podForKeywd skipwhite contains=@NoSpell
|
||||||
|
syn match podCommand "^=begin" nextgroup=podForKeywd skipwhite contains=@NoSpell
|
||||||
|
syn match podCommand "^=end" nextgroup=podForKeywd skipwhite contains=@NoSpell
|
||||||
|
|
||||||
|
" Text of a =head1, =head2 or =item command
|
||||||
|
syn match podCmdText ".*$" contained contains=podFormat,@NoSpell
|
||||||
|
|
||||||
|
" Indent amount of =over command
|
||||||
|
syn match podOverIndent "\d\+" contained contains=@NoSpell
|
||||||
|
|
||||||
|
" Formatter identifier keyword for =for, =begin and =end commands
|
||||||
|
syn match podForKeywd "\S\+" contained contains=@NoSpell
|
||||||
|
|
||||||
|
" An indented line, to be displayed verbatim
|
||||||
|
syn match podVerbatimLine "^\s.*$" contains=@NoSpell
|
||||||
|
|
||||||
|
" Inline textual items handled specially by POD
|
||||||
|
syn match podSpecial "\(\<\|&\)\I\i*\(::\I\i*\)*([^)]*)" contains=@NoSpell
|
||||||
|
syn match podSpecial "[$@%]\I\i*\(::\I\i*\)*\>" contains=@NoSpell
|
||||||
|
|
||||||
|
" Special formatting sequences
|
||||||
|
syn region podFormat start="[IBSCLFX]<[^<]"me=e-1 end=">" oneline contains=podFormat,@NoSpell
|
||||||
|
syn region podFormat start="[IBSCLFX]<<\s" end="\s>>" oneline contains=podFormat,@NoSpell
|
||||||
|
syn match podFormat "Z<>"
|
||||||
|
syn match podFormat "E<\(\d\+\|\I\i*\)>" contains=podEscape,podEscape2,@NoSpell
|
||||||
|
syn match podEscape "\I\i*>"me=e-1 contained contains=@NoSpell
|
||||||
|
syn match podEscape2 "\d\+>"me=e-1 contained contains=@NoSpell
|
||||||
|
|
||||||
|
" Define the default highlighting.
|
||||||
|
" For version 5.7 and earlier: only when not done already
|
||||||
|
" For version 5.8 and later: only when an item doesn't have highlighting yet
|
||||||
|
if version >= 508 || !exists("did_pod_syntax_inits")
|
||||||
|
if version < 508
|
||||||
|
let did_pod_syntax_inits = 1
|
||||||
|
command -nargs=+ HiLink hi link <args>
|
||||||
|
else
|
||||||
|
command -nargs=+ HiLink hi def link <args>
|
||||||
|
endif
|
||||||
|
|
||||||
|
HiLink podCommand Statement
|
||||||
|
HiLink podCmdText String
|
||||||
|
HiLink podOverIndent Number
|
||||||
|
HiLink podForKeywd Identifier
|
||||||
|
HiLink podFormat Identifier
|
||||||
|
HiLink podVerbatimLine PreProc
|
||||||
|
HiLink podSpecial Identifier
|
||||||
|
HiLink podEscape String
|
||||||
|
HiLink podEscape2 Number
|
||||||
|
|
||||||
|
delcommand HiLink
|
||||||
|
endif
|
||||||
|
|
||||||
|
if exists("perl_pod_spellcheck_headings")
|
||||||
|
" Spell-check headings
|
||||||
|
syn clear podCmdText
|
||||||
|
syn match podCmdText ".*$" contained contains=podFormat
|
||||||
|
endif
|
||||||
|
|
||||||
|
if exists("perl_pod_formatting")
|
||||||
|
" By default, escapes like C<> are not checked for spelling. Remove B<>
|
||||||
|
" and I<> from the list of escapes.
|
||||||
|
syn clear podFormat
|
||||||
|
syn region podFormat start="[CLF]<[^<]"me=e-1 end=">" oneline contains=podFormat,@NoSpell
|
||||||
|
syn region podFormat start="[CLF]<<\s" end="\s>>" oneline contains=podFormat,@NoSpell
|
||||||
|
|
||||||
|
" Don't spell-check inside E<>, but ensure that the E< itself isn't
|
||||||
|
" marked as a spelling mistake.
|
||||||
|
syn match podFormat "E<\(\d\+\|\I\i*\)>" contains=podEscape,podEscape2,@NoSpell
|
||||||
|
|
||||||
|
" Z<> is a mock formatting code. Ensure Z<> on its own isn't marked as a
|
||||||
|
" spelling mistake.
|
||||||
|
syn match podFormat "Z<>" contains=podEscape,podEscape2,@NoSpell
|
||||||
|
|
||||||
|
" These are required so that whatever is *within* B<...>, I<...>, etc. is
|
||||||
|
" spell-checked, but not the B, I, ... itself.
|
||||||
|
syn match podBoldOpen "B<" contains=@NoSpell
|
||||||
|
syn match podItalicOpen "I<" contains=@NoSpell
|
||||||
|
syn match podNoSpaceOpen "S<" contains=@NoSpell
|
||||||
|
syn match podIndexOpen "X<" contains=@NoSpell
|
||||||
|
|
||||||
|
" Same as above but for the << >> syntax.
|
||||||
|
syn match podBoldAlternativeDelimOpen "B<< " contains=@NoSpell
|
||||||
|
syn match podItalicAlternativeDelimOpen "I<< " contains=@NoSpell
|
||||||
|
syn match podNoSpaceAlternativeDelimOpen "S<< " contains=@NoSpell
|
||||||
|
syn match podIndexAlternativeDelimOpen "X<< " contains=@NoSpell
|
||||||
|
|
||||||
|
" Add support for spell checking text inside B<>, I<>, S<> and X<>.
|
||||||
|
syn region podBold start="B<[^<]"me=e end=">" oneline contains=podBoldItalic,podBoldOpen
|
||||||
|
syn region podBoldAlternativeDelim start="B<<\s" end="\s>>" oneline contains=podBoldAlternativeDelimOpen
|
||||||
|
|
||||||
|
syn region podItalic start="I<[^<]"me=e end=">" oneline contains=podItalicBold,podItalicOpen
|
||||||
|
syn region podItalicAlternativeDelim start="I<<\s" end="\s>>" oneline contains=podItalicAlternativeDelimOpen
|
||||||
|
|
||||||
|
" Nested bold/italic and vice-versa
|
||||||
|
syn region podBoldItalic contained start="I<[^<]"me=e end=">" oneline
|
||||||
|
syn region podItalicBold contained start="B<[^<]"me=e end=">" oneline
|
||||||
|
|
||||||
|
syn region podNoSpace start="S<[^<]"ms=s-2 end=">"me=e oneline contains=podNoSpaceOpen
|
||||||
|
syn region podNoSpaceAlternativeDelim start="S<<\s"ms=s-2 end="\s>>"me=e oneline contains=podNoSpaceAlternativeDelimOpen
|
||||||
|
|
||||||
|
syn region podIndex start="X<[^<]"ms=s-2 end=">"me=e oneline contains=podIndexOpen
|
||||||
|
syn region podIndexAlternativeDelim start="X<<\s"ms=s-2 end="\s>>"me=e oneline contains=podIndexAlternativeDelimOpen
|
||||||
|
|
||||||
|
" Restore this (otherwise B<> is shown as bold inside verbatim)
|
||||||
|
syn match podVerbatimLine "^\s.*$" contains=@NoSpell
|
||||||
|
|
||||||
|
" Ensure formatted text can be displayed in headings and items
|
||||||
|
syn clear podCmdText
|
||||||
|
|
||||||
|
if exists("perl_pod_spellcheck_headings")
|
||||||
|
syn match podCmdText ".*$" contained contains=podFormat,podBold,
|
||||||
|
\podBoldAlternativeDelim,podItalic,podItalicAlternativeDelim,
|
||||||
|
\podBoldOpen,podItalicOpen,podBoldAlternativeDelimOpen,
|
||||||
|
\podItalicAlternativeDelimOpen,podNoSpaceOpen
|
||||||
|
else
|
||||||
|
syn match podCmdText ".*$" contained contains=podFormat,podBold,
|
||||||
|
\podBoldAlternativeDelim,podItalic,podItalicAlternativeDelim,
|
||||||
|
\@NoSpell
|
||||||
|
endif
|
||||||
|
|
||||||
|
" Specify how to display these
|
||||||
|
hi def podBold term=bold cterm=bold gui=bold
|
||||||
|
|
||||||
|
hi link podBoldAlternativeDelim podBold
|
||||||
|
hi link podBoldAlternativeDelimOpen podBold
|
||||||
|
hi link podBoldOpen podBold
|
||||||
|
|
||||||
|
hi link podNoSpace Identifier
|
||||||
|
hi link podNoSpaceAlternativeDelim Identifier
|
||||||
|
|
||||||
|
hi link podIndex Identifier
|
||||||
|
hi link podIndexAlternativeDelim Identifier
|
||||||
|
|
||||||
|
hi def podItalic term=italic cterm=italic gui=italic
|
||||||
|
|
||||||
|
hi link podItalicAlternativeDelim podItalic
|
||||||
|
hi link podItalicAlternativeDelimOpen podItalic
|
||||||
|
hi link podItalicOpen podItalic
|
||||||
|
|
||||||
|
hi def podBoldItalic term=italic,bold cterm=italic,bold gui=italic,bold
|
||||||
|
hi def podItalicBold term=italic,bold cterm=italic,bold gui=italic,bold
|
||||||
|
endif
|
||||||
|
|
||||||
|
let b:current_syntax = "pod"
|
||||||
|
|
||||||
|
let &cpo = s:cpo_save
|
||||||
|
unlet s:cpo_save
|
||||||
|
|
||||||
|
" vim: ts=8
|
||||||
155
syntax/rhelp.vim
Normal file
155
syntax/rhelp.vim
Normal file
@@ -0,0 +1,155 @@
|
|||||||
|
" Vim syntax file
|
||||||
|
" Language: R Help File
|
||||||
|
" Maintainer: Johannes Ranke <jranke@uni-bremen.de>
|
||||||
|
" Last Change: 2006 Apr 24
|
||||||
|
" Version: 0.7
|
||||||
|
" SVN: $Id: rhelp.vim 57 2006-04-24 15:52:13Z ranke $
|
||||||
|
" Remarks: - Now includes R syntax highlighting in the appropriate
|
||||||
|
" sections if an r.vim file is in the same directory or in the
|
||||||
|
" default debian location.
|
||||||
|
" - There is no Latex markup in equations
|
||||||
|
|
||||||
|
" Version Clears: {{{1
|
||||||
|
" For version 5.x: Clear all syntax items
|
||||||
|
" For version 6.x and 7.x: Quit when a syntax file was already loaded
|
||||||
|
if version < 600
|
||||||
|
syntax clear
|
||||||
|
elseif exists("b:current_syntax")
|
||||||
|
finish
|
||||||
|
endif
|
||||||
|
|
||||||
|
syn case match
|
||||||
|
|
||||||
|
" R help identifiers {{{
|
||||||
|
syn region rhelpIdentifier matchgroup=rhelpSection start="\\name{" end="}"
|
||||||
|
syn region rhelpIdentifier matchgroup=rhelpSection start="\\alias{" end="}"
|
||||||
|
syn region rhelpIdentifier matchgroup=rhelpSection start="\\pkg{" end="}"
|
||||||
|
syn region rhelpIdentifier matchgroup=rhelpSection start="\\item{" end="}" contained contains=rhelpDots
|
||||||
|
syn region rhelpIdentifier matchgroup=rhelpSection start="\\method{" end=/}/ contained
|
||||||
|
|
||||||
|
" Highlighting of R code using an existing r.vim syntax file if available {{{1
|
||||||
|
syn include @R syntax/r.vim
|
||||||
|
syn match rhelpDots "\\dots" containedin=@R
|
||||||
|
syn region rhelpRcode matchgroup=Delimiter start="\\examples{" matchgroup=Delimiter transparent end=/}/ contains=@R,rhelpSection
|
||||||
|
syn region rhelpRcode matchgroup=Delimiter start="\\usage{" matchgroup=Delimiter transparent end=/}/ contains=@R,rhelpIdentifier,rhelpS4method
|
||||||
|
syn region rhelpRcode matchgroup=Delimiter start="\\synopsis{" matchgroup=Delimiter transparent end=/}/ contains=@R
|
||||||
|
syn region rhelpRcode matchgroup=Delimiter start="\\special{" matchgroup=Delimiter transparent end=/}/ contains=@R contained
|
||||||
|
syn region rhelpRcode matchgroup=Delimiter start="\\code{" matchgroup=Delimiter transparent end=/}/ contains=@R,rhelpLink contained
|
||||||
|
syn region rhelpS4method matchgroup=Delimiter start="\\S4method{.*}(" matchgroup=Delimiter transparent end=/)/ contains=@R,rhelpDots contained
|
||||||
|
|
||||||
|
" Strings {{{1
|
||||||
|
syn region rhelpString start=/"/ end=/"/
|
||||||
|
|
||||||
|
" Special characters ( \$ \& \% \# \{ \} \_) {{{1
|
||||||
|
syn match rhelpSpecialChar "\\[$&%#{}_]"
|
||||||
|
|
||||||
|
" Special Delimiters {{{1
|
||||||
|
syn match rhelpDelimiter "\\cr"
|
||||||
|
syn match rhelpDelimiter "\\tab "
|
||||||
|
|
||||||
|
" Keywords {{{1
|
||||||
|
syn match rhelpKeyword "\\R"
|
||||||
|
syn match rhelpKeyword "\\ldots"
|
||||||
|
syn match rhelpKeyword "--"
|
||||||
|
syn match rhelpKeyword "---"
|
||||||
|
syn match rhelpKeyword "<"
|
||||||
|
syn match rhelpKeyword ">"
|
||||||
|
|
||||||
|
" Links {{{1
|
||||||
|
syn region rhelpLink matchgroup=rhelpSection start="\\link{" end="}" contained keepend
|
||||||
|
syn region rhelpLink matchgroup=rhelpSection start="\\link\[.*\]{" end="}" contained keepend
|
||||||
|
syn region rhelpLink matchgroup=rhelpSection start="\\linkS4class{" end="}" contained keepend
|
||||||
|
|
||||||
|
" Type Styles {{{1
|
||||||
|
syn match rhelpType "\\emph\>"
|
||||||
|
syn match rhelpType "\\strong\>"
|
||||||
|
syn match rhelpType "\\bold\>"
|
||||||
|
syn match rhelpType "\\sQuote\>"
|
||||||
|
syn match rhelpType "\\dQuote\>"
|
||||||
|
syn match rhelpType "\\preformatted\>"
|
||||||
|
syn match rhelpType "\\kbd\>"
|
||||||
|
syn match rhelpType "\\samp\>"
|
||||||
|
syn match rhelpType "\\eqn\>"
|
||||||
|
syn match rhelpType "\\deqn\>"
|
||||||
|
syn match rhelpType "\\file\>"
|
||||||
|
syn match rhelpType "\\email\>"
|
||||||
|
syn match rhelpType "\\url\>"
|
||||||
|
syn match rhelpType "\\var\>"
|
||||||
|
syn match rhelpType "\\env\>"
|
||||||
|
syn match rhelpType "\\option\>"
|
||||||
|
syn match rhelpType "\\command\>"
|
||||||
|
syn match rhelpType "\\dfn\>"
|
||||||
|
syn match rhelpType "\\cite\>"
|
||||||
|
syn match rhelpType "\\acronym\>"
|
||||||
|
|
||||||
|
" rhelp sections {{{1
|
||||||
|
syn match rhelpSection "\\encoding\>"
|
||||||
|
syn match rhelpSection "\\title\>"
|
||||||
|
syn match rhelpSection "\\description\>"
|
||||||
|
syn match rhelpSection "\\concept\>"
|
||||||
|
syn match rhelpSection "\\arguments\>"
|
||||||
|
syn match rhelpSection "\\details\>"
|
||||||
|
syn match rhelpSection "\\value\>"
|
||||||
|
syn match rhelpSection "\\references\>"
|
||||||
|
syn match rhelpSection "\\note\>"
|
||||||
|
syn match rhelpSection "\\author\>"
|
||||||
|
syn match rhelpSection "\\seealso\>"
|
||||||
|
syn match rhelpSection "\\keyword\>"
|
||||||
|
syn match rhelpSection "\\docType\>"
|
||||||
|
syn match rhelpSection "\\format\>"
|
||||||
|
syn match rhelpSection "\\source\>"
|
||||||
|
syn match rhelpSection "\\itemize\>"
|
||||||
|
syn match rhelpSection "\\describe\>"
|
||||||
|
syn match rhelpSection "\\enumerate\>"
|
||||||
|
syn match rhelpSection "\\item "
|
||||||
|
syn match rhelpSection "\\item$"
|
||||||
|
syn match rhelpSection "\\tabular{[lcr]*}"
|
||||||
|
syn match rhelpSection "\\dontrun\>"
|
||||||
|
syn match rhelpSection "\\dontshow\>"
|
||||||
|
syn match rhelpSection "\\testonly\>"
|
||||||
|
|
||||||
|
" Freely named Sections {{{1
|
||||||
|
syn region rhelpFreesec matchgroup=Delimiter start="\\section{" matchgroup=Delimiter transparent end=/}/
|
||||||
|
|
||||||
|
" R help file comments {{{1
|
||||||
|
syn match rhelpComment /%.*$/ contained
|
||||||
|
|
||||||
|
" Error {{{1
|
||||||
|
syn region rhelpRegion matchgroup=Delimiter start=/(/ matchgroup=Delimiter end=/)/ transparent contains=ALLBUT,rhelpError,rhelpBraceError,rhelpCurlyError
|
||||||
|
syn region rhelpRegion matchgroup=Delimiter start=/{/ matchgroup=Delimiter end=/}/ transparent contains=ALLBUT,rhelpError,rhelpBraceError,rhelpParenError
|
||||||
|
syn region rhelpRegion matchgroup=Delimiter start=/\[/ matchgroup=Delimiter end=/]/ transparent contains=ALLBUT,rhelpError,rhelpCurlyError,rhelpParenError
|
||||||
|
syn match rhelpError /[)\]}]/
|
||||||
|
syn match rhelpBraceError /[)}]/ contained
|
||||||
|
syn match rhelpCurlyError /[)\]]/ contained
|
||||||
|
syn match rhelpParenError /[\]}]/ contained
|
||||||
|
|
||||||
|
" Define the default highlighting {{{1
|
||||||
|
" For version 5.7 and earlier: only when not done already
|
||||||
|
" For version 5.8 and later: only when an item doesn't have highlighting yet
|
||||||
|
if version >= 508 || !exists("did_rhelp_syntax_inits")
|
||||||
|
if version < 508
|
||||||
|
let did_rhelp_syntax_inits = 1
|
||||||
|
command -nargs=+ HiLink hi link <args>
|
||||||
|
else
|
||||||
|
command -nargs=+ HiLink hi def link <args>
|
||||||
|
endif
|
||||||
|
HiLink rhelpIdentifier Identifier
|
||||||
|
HiLink rhelpString String
|
||||||
|
HiLink rhelpKeyword Keyword
|
||||||
|
HiLink rhelpDots Keyword
|
||||||
|
HiLink rhelpLink Underlined
|
||||||
|
HiLink rhelpType Type
|
||||||
|
HiLink rhelpSection PreCondit
|
||||||
|
HiLink rhelpError Error
|
||||||
|
HiLink rhelpBraceError Error
|
||||||
|
HiLink rhelpCurlyError Error
|
||||||
|
HiLink rhelpParenError Error
|
||||||
|
HiLink rhelpDelimiter Delimiter
|
||||||
|
HiLink rhelpComment Comment
|
||||||
|
HiLink rhelpRComment Comment
|
||||||
|
HiLink rhelpSpecialChar SpecialChar
|
||||||
|
delcommand HiLink
|
||||||
|
endif
|
||||||
|
|
||||||
|
let b:current_syntax = "rhelp"
|
||||||
|
" vim: foldmethod=marker:
|
||||||
56
syntax/rnoweb.vim
Normal file
56
syntax/rnoweb.vim
Normal file
@@ -0,0 +1,56 @@
|
|||||||
|
" Vim syntax file
|
||||||
|
" Language: R noweb Files
|
||||||
|
" Maintainer: Johannes Ranke <jranke@uni-bremen.de>
|
||||||
|
" Last Change: 2007 M<>r 30
|
||||||
|
" Version: 0.8
|
||||||
|
" SVN: $Id: rnoweb.vim 69 2007-03-30 08:55:36Z ranke $
|
||||||
|
" Remarks: - This file is inspired by the proposal of
|
||||||
|
" Fernando Henrique Ferraz Pereira da Rosa <feferraz@ime.usp.br>
|
||||||
|
" http://www.ime.usp.br/~feferraz/en/sweavevim.html
|
||||||
|
"
|
||||||
|
|
||||||
|
" Version Clears: {{{1
|
||||||
|
" For version 5.x: Clear all syntax items
|
||||||
|
" For version 6.x and 7.x: Quit when a syntax file was already loaded
|
||||||
|
if version < 600
|
||||||
|
syntax clear
|
||||||
|
elseif exists("b:current_syntax")
|
||||||
|
finish
|
||||||
|
endif
|
||||||
|
|
||||||
|
syn case match
|
||||||
|
|
||||||
|
" Extension of Tex clusters {{{1
|
||||||
|
runtime syntax/tex.vim
|
||||||
|
unlet b:current_syntax
|
||||||
|
|
||||||
|
syn cluster texMatchGroup add=@rnoweb
|
||||||
|
syn cluster texEnvGroup add=@rnoweb
|
||||||
|
syn cluster texFoldGroup add=@rnoweb
|
||||||
|
syn cluster texDocGroup add=@rnoweb
|
||||||
|
syn cluster texPartGroup add=@rnoweb
|
||||||
|
syn cluster texChapterGroup add=@rnoweb
|
||||||
|
syn cluster texSectionGroup add=@rnoweb
|
||||||
|
syn cluster texSubSectionGroup add=@rnoweb
|
||||||
|
syn cluster texSubSubSectionGroup add=@rnoweb
|
||||||
|
syn cluster texParaGroup add=@rnoweb
|
||||||
|
|
||||||
|
" Highlighting of R code using an existing r.vim syntax file if available {{{1
|
||||||
|
syn include @rnowebR syntax/r.vim
|
||||||
|
syn region rnowebChunk matchgroup=rnowebDelimiter start="^<<.*>>=" matchgroup=rnowebDelimiter end="^@" contains=@rnowebR,rnowebChunkReference,rnowebChunk fold keepend
|
||||||
|
syn match rnowebChunkReference "^<<.*>>$" contained
|
||||||
|
syn region rnowebSexpr matchgroup=Delimiter start="\\Sexpr{" matchgroup=Delimiter end="}" contains=@rnowebR
|
||||||
|
|
||||||
|
" Sweave options command {{{1
|
||||||
|
syn region rnowebSweaveopts matchgroup=Delimiter start="\\SweaveOpts{" matchgroup=Delimiter end="}"
|
||||||
|
|
||||||
|
" rnoweb Cluster {{{1
|
||||||
|
syn cluster rnoweb contains=rnowebChunk,rnowebChunkReference,rnowebDelimiter,rnowebSexpr,rnowebSweaveopts
|
||||||
|
|
||||||
|
" Highlighting {{{1
|
||||||
|
hi def link rnowebDelimiter Delimiter
|
||||||
|
hi def link rnowebSweaveOpts Statement
|
||||||
|
hi def link rnowebChunkReference Delimiter
|
||||||
|
|
||||||
|
let b:current_syntax = "rnoweb"
|
||||||
|
" vim: foldmethod=marker:
|
||||||
252
syntax/rust.vim
Normal file
252
syntax/rust.vim
Normal file
@@ -0,0 +1,252 @@
|
|||||||
|
" Vim syntax file
|
||||||
|
" Language: Rust
|
||||||
|
" Maintainer: Patrick Walton <pcwalton@mozilla.com>
|
||||||
|
" Maintainer: Ben Blum <bblum@cs.cmu.edu>
|
||||||
|
" Maintainer: Chris Morgan <me@chrismorgan.info>
|
||||||
|
" Last Change: 2013 Oct 29
|
||||||
|
|
||||||
|
if version < 600
|
||||||
|
syntax clear
|
||||||
|
elseif exists("b:current_syntax")
|
||||||
|
finish
|
||||||
|
endif
|
||||||
|
|
||||||
|
" Syntax definitions {{{1
|
||||||
|
" Basic keywords {{{2
|
||||||
|
syn keyword rustConditional match if else
|
||||||
|
syn keyword rustOperator as
|
||||||
|
|
||||||
|
syn match rustAssert "\<assert\(\w\)*!" contained
|
||||||
|
syn match rustFail "\<fail\(\w\)*!" contained
|
||||||
|
syn keyword rustKeyword break continue do extern
|
||||||
|
syn keyword rustKeyword in if impl let log
|
||||||
|
syn keyword rustKeyword for impl let log
|
||||||
|
syn keyword rustKeyword loop mod once priv pub
|
||||||
|
syn keyword rustKeyword return
|
||||||
|
syn keyword rustKeyword unsafe while
|
||||||
|
syn keyword rustKeyword use nextgroup=rustModPath skipwhite
|
||||||
|
" FIXME: Scoped impl's name is also fallen in this category
|
||||||
|
syn keyword rustKeyword mod trait struct enum type nextgroup=rustIdentifier skipwhite
|
||||||
|
syn keyword rustKeyword fn nextgroup=rustFuncName skipwhite
|
||||||
|
syn keyword rustStorage const mut ref static
|
||||||
|
|
||||||
|
syn match rustIdentifier contains=rustIdentifierPrime "\%([^[:cntrl:][:space:][:punct:][:digit:]]\|_\)\%([^[:cntrl:][:punct:][:space:]]\|_\)*" display contained
|
||||||
|
syn match rustFuncName "\%([^[:cntrl:][:space:][:punct:][:digit:]]\|_\)\%([^[:cntrl:][:punct:][:space:]]\|_\)*" display contained
|
||||||
|
|
||||||
|
" Reserved (but not yet used) keywords {{{2
|
||||||
|
syn keyword rustKeyword alignof be offsetof pure sizeof typeof yield
|
||||||
|
|
||||||
|
" Built-in types {{{2
|
||||||
|
syn keyword rustType int uint float char bool u8 u16 u32 u64 f32
|
||||||
|
syn keyword rustType f64 i8 i16 i32 i64 str Self
|
||||||
|
|
||||||
|
" Things from the prelude (src/libstd/prelude.rs) {{{2
|
||||||
|
" This section is just straight transformation of the contents of the prelude,
|
||||||
|
" to make it easy to update.
|
||||||
|
|
||||||
|
" Core operators {{{3
|
||||||
|
syn keyword rustEnum Either
|
||||||
|
syn keyword rustEnumVariant Left Right
|
||||||
|
syn keyword rustTrait Sized
|
||||||
|
syn keyword rustTrait Freeze Send
|
||||||
|
syn keyword rustTrait Add Sub Mul Div Rem Neg Not
|
||||||
|
syn keyword rustTrait BitAnd BitOr BitXor
|
||||||
|
syn keyword rustTrait Drop
|
||||||
|
syn keyword rustTrait Shl Shr Index
|
||||||
|
syn keyword rustEnum Option
|
||||||
|
syn keyword rustEnumVariant Some None
|
||||||
|
syn keyword rustEnum Result
|
||||||
|
syn keyword rustEnumVariant Ok Err
|
||||||
|
|
||||||
|
" Functions {{{3
|
||||||
|
"syn keyword rustFunction print println
|
||||||
|
"syn keyword rustFunction range
|
||||||
|
"syn keyword rustFunction from_str
|
||||||
|
|
||||||
|
" Types and traits {{{3
|
||||||
|
syn keyword rustTrait Any AnyOwnExt AnyRefExt AnyMutRefExt
|
||||||
|
syn keyword rustTrait Ascii AsciiCast OwnedAsciiCast AsciiStr ToBytesConsume
|
||||||
|
syn keyword rustTrait Bool
|
||||||
|
syn keyword rustTrait ToCStr
|
||||||
|
syn keyword rustTrait Char
|
||||||
|
syn keyword rustTrait Clone DeepClone
|
||||||
|
syn keyword rustTrait Eq ApproxEq Ord TotalEq TotalOrd Ordering Equiv
|
||||||
|
syn keyword rustEnumVariant Less Equal Greater
|
||||||
|
syn keyword rustTrait Container Mutable Map MutableMap Set MutableSet
|
||||||
|
syn keyword rustTrait Default
|
||||||
|
syn keyword rustTrait Hash
|
||||||
|
syn keyword rustTrait FromStr
|
||||||
|
syn keyword rustTrait FromIterator Extendable
|
||||||
|
syn keyword rustTrait Iterator DoubleEndedIterator RandomAccessIterator ClonableIterator
|
||||||
|
syn keyword rustTrait OrdIterator MutableDoubleEndedIterator ExactSize
|
||||||
|
syn keyword rustTrait Times
|
||||||
|
|
||||||
|
syn keyword rustTrait Algebraic Trigonometric Exponential Hyperbolic
|
||||||
|
syn keyword rustTrait Bitwise BitCount Bounded
|
||||||
|
syn keyword rustTrait Integer Fractional Real RealExt
|
||||||
|
syn keyword rustTrait Num NumCast CheckedAdd CheckedSub CheckedMul
|
||||||
|
syn keyword rustTrait Orderable Signed Unsigned Round
|
||||||
|
syn keyword rustTrait Primitive Int Float ToStrRadix ToPrimitive FromPrimitive
|
||||||
|
syn keyword rustTrait GenericPath Path PosixPath WindowsPath
|
||||||
|
syn keyword rustTrait RawPtr
|
||||||
|
syn keyword rustTrait SendStr SendStrOwned SendStrStatic IntoSendStr
|
||||||
|
syn keyword rustTrait Str StrVector StrSlice OwnedStr
|
||||||
|
syn keyword rustTrait IterBytes
|
||||||
|
syn keyword rustTrait ToStr ToStrConsume
|
||||||
|
syn keyword rustTrait CopyableTuple ImmutableTuple
|
||||||
|
syn keyword rustTrait Tuple1 Tuple2 Tuple3 Tuple4
|
||||||
|
syn keyword rustTrait Tuple5 Tuple6 Tuple7 Tuple8
|
||||||
|
syn keyword rustTrait Tuple9 Tuple10 Tuple11 Tuple12
|
||||||
|
syn keyword rustTrait ImmutableTuple1 ImmutableTuple2 ImmutableTuple3 ImmutableTuple4
|
||||||
|
syn keyword rustTrait ImmutableTuple5 ImmutableTuple6 ImmutableTuple7 ImmutableTuple8
|
||||||
|
syn keyword rustTrait ImmutableTuple9 ImmutableTuple10 ImmutableTuple11 ImmutableTuple12
|
||||||
|
syn keyword rustTrait ImmutableEqVector ImmutableTotalOrdVector ImmutableCopyableVector
|
||||||
|
syn keyword rustTrait OwnedVector OwnedCopyableVector OwnedEqVector MutableVector
|
||||||
|
syn keyword rustTrait Vector VectorVector CopyableVector ImmutableVector
|
||||||
|
|
||||||
|
"syn keyword rustFunction stream
|
||||||
|
syn keyword rustTrait Port Chan GenericChan GenericSmartChan GenericPort Peekable
|
||||||
|
"syn keyword rustFunction spawn
|
||||||
|
|
||||||
|
syn keyword rustSelf self
|
||||||
|
syn keyword rustBoolean true false
|
||||||
|
|
||||||
|
syn keyword rustConstant Some None " option
|
||||||
|
syn keyword rustConstant Left Right " either
|
||||||
|
syn keyword rustConstant Ok Err " result
|
||||||
|
syn keyword rustConstant Less Equal Greater " Ordering
|
||||||
|
|
||||||
|
" Other syntax {{{2
|
||||||
|
|
||||||
|
" If foo::bar changes to foo.bar, change this ("::" to "\.").
|
||||||
|
" If foo::bar changes to Foo::bar, change this (first "\w" to "\u").
|
||||||
|
syn match rustModPath "\w\(\w\)*::[^<]"he=e-3,me=e-3
|
||||||
|
syn match rustModPath "\w\(\w\)*" contained " only for 'use path;'
|
||||||
|
syn match rustModPathSep "::"
|
||||||
|
|
||||||
|
syn match rustFuncCall "\w\(\w\)*("he=e-1,me=e-1
|
||||||
|
syn match rustFuncCall "\w\(\w\)*::<"he=e-3,me=e-3 " foo::<T>();
|
||||||
|
|
||||||
|
" This is merely a convention; note also the use of [A-Z], restricting it to
|
||||||
|
" latin identifiers rather than the full Unicode uppercase. I have not used
|
||||||
|
" [:upper:] as it depends upon 'noignorecase'
|
||||||
|
"syn match rustCapsIdent display "[A-Z]\w\(\w\)*"
|
||||||
|
|
||||||
|
syn match rustOperator display "\%(+\|-\|/\|*\|=\|\^\|&\||\|!\|>\|<\|%\)=\?"
|
||||||
|
" This one isn't *quite* right, as we could have binary-& with a reference
|
||||||
|
syn match rustSigil display /&\s\+[&~@*][^)= \t\r\n]/he=e-1,me=e-1
|
||||||
|
syn match rustSigil display /[&~@*][^)= \t\r\n]/he=e-1,me=e-1
|
||||||
|
" This isn't actually correct; a closure with no arguments can be `|| { }`.
|
||||||
|
" Last, because the & in && isn't a sigil
|
||||||
|
syn match rustOperator display "&&\|||"
|
||||||
|
|
||||||
|
syn match rustMacro '\w\(\w\)*!' contains=rustAssert,rustFail
|
||||||
|
syn match rustMacro '#\w\(\w\)*' contains=rustAssert,rustFail
|
||||||
|
|
||||||
|
syn match rustFormat display "%\(\d\+\$\)\=[-+' #0*]*\(\d*\|\*\|\*\d\+\$\)\(\.\(\d*\|\*\|\*\d\+\$\)\)\=\([hlLjzt]\|ll\|hh\)\=\([aAbdiuoxXDOUfFeEgGcCsSpn?]\|\[\^\=.[^]]*\]\)" contained
|
||||||
|
syn match rustFormat display "%%" contained
|
||||||
|
syn match rustSpecial display contained /\\\([nrt0\\'"]\|x\x\{2}\|u\x\{4}\|U\x\{8}\)/
|
||||||
|
syn match rustStringContinuation display contained /\\\n\s*/
|
||||||
|
syn region rustString start=+"+ skip=+\\\\\|\\"+ end=+"+ contains=rustTodo,rustFormat,rustSpecial,rustStringContinuation
|
||||||
|
syn region rustString start='r\z(#*\)"' end='"\z1'
|
||||||
|
|
||||||
|
syn region rustAttribute start="#\[" end="\]" contains=rustString,rustDeriving
|
||||||
|
syn region rustDeriving start="deriving(" end=")" contained contains=rustTrait
|
||||||
|
|
||||||
|
" Number literals
|
||||||
|
syn match rustNumber display "\<[0-9][0-9_]*\>"
|
||||||
|
syn match rustNumber display "\<[0-9][0-9_]*\(u\|u8\|u16\|u32\|u64\)\>"
|
||||||
|
syn match rustNumber display "\<[0-9][0-9_]*\(i\|i8\|i16\|i32\|i64\)\>"
|
||||||
|
|
||||||
|
syn match rustHexNumber display "\<0x[a-fA-F0-9_]\+\>"
|
||||||
|
syn match rustHexNumber display "\<0x[a-fA-F0-9_]\+\(u\|u8\|u16\|u32\|u64\)\>"
|
||||||
|
syn match rustHexNumber display "\<0x[a-fA-F0-9_]\+\(i8\|i16\|i32\|i64\)\>"
|
||||||
|
syn match rustBinNumber display "\<0b[01_]\+\>"
|
||||||
|
syn match rustBinNumber display "\<0b[01_]\+\(u\|u8\|u16\|u32\|u64\)\>"
|
||||||
|
syn match rustBinNumber display "\<0b[01_]\+\(i8\|i16\|i32\|i64\)\>"
|
||||||
|
|
||||||
|
syn match rustFloat display "\<[0-9][0-9_]*\(f\|f32\|f64\)\>"
|
||||||
|
syn match rustFloat display "\<[0-9][0-9_]*\([eE][+-]\=[0-9_]\+\)\>"
|
||||||
|
syn match rustFloat display "\<[0-9][0-9_]*\([eE][+-]\=[0-9_]\+\)\(f\|f32\|f64\)\>"
|
||||||
|
syn match rustFloat display "\<[0-9][0-9_]*\.[0-9_]\+\>"
|
||||||
|
syn match rustFloat display "\<[0-9][0-9_]*\.[0-9_]\+\(f\|f32\|f64\)\>"
|
||||||
|
syn match rustFloat display "\<[0-9][0-9_]*\.[0-9_]\+\%([eE][+-]\=[0-9_]\+\)\>"
|
||||||
|
syn match rustFloat display "\<[0-9][0-9_]*\.[0-9_]\+\%([eE][+-]\=[0-9_]\+\)\(f\|f32\|f64\)\>"
|
||||||
|
|
||||||
|
" For the benefit of delimitMate
|
||||||
|
syn region rustLifetimeCandidate display start=/&'\%(\([^'\\]\|\\\(['nrt0\\\"]\|x\x\{2}\|u\x\{4}\|U\x\{8}\)\)'\)\@!/ end=/[[:cntrl:][:space:][:punct:]]\@=\|$/ contains=rustSigil,rustLifetime
|
||||||
|
syn region rustGenericRegion display start=/<\%('\|[^[cntrl:][:space:][:punct:]]\)\@=')\S\@=/ end=/>/ contains=rustGenericLifetimeCandidate
|
||||||
|
syn region rustGenericLifetimeCandidate display start=/\%(<\|,\s*\)\@<='/ end=/[[:cntrl:][:space:][:punct:]]\@=\|$/ contains=rustSigil,rustLifetime
|
||||||
|
|
||||||
|
"rustLifetime must appear before rustCharacter, or chars will get the lifetime highlighting
|
||||||
|
syn match rustLifetime display "\'\%([^[:cntrl:][:space:][:punct:][:digit:]]\|_\)\%([^[:cntrl:][:punct:][:space:]]\|_\)*"
|
||||||
|
syn match rustCharacter /'\([^'\\]\|\\\([nrt0\\'"]\|x\x\{2}\|u\x\{4}\|U\x\{8}\)\)'/ contains=rustSpecial
|
||||||
|
|
||||||
|
syn region rustCommentML start="/\*" end="\*/" contains=rustTodo
|
||||||
|
syn region rustComment start="//" end="$" contains=rustTodo keepend
|
||||||
|
syn region rustCommentMLDoc start="/\*\%(!\|\*/\@!\)" end="\*/" contains=rustTodo
|
||||||
|
syn region rustCommentDoc start="//[/!]" end="$" contains=rustTodo keepend
|
||||||
|
|
||||||
|
syn keyword rustTodo contained TODO FIXME XXX NB NOTE
|
||||||
|
|
||||||
|
" Folding rules {{{2
|
||||||
|
" Trivial folding rules to begin with.
|
||||||
|
" TODO: use the AST to make really good folding
|
||||||
|
syn region rustFoldBraces start="{" end="}" transparent fold
|
||||||
|
" If you wish to enable this, setlocal foldmethod=syntax
|
||||||
|
" It's not enabled by default as it would drive some people mad.
|
||||||
|
|
||||||
|
" Default highlighting {{{1
|
||||||
|
hi def link rustHexNumber rustNumber
|
||||||
|
hi def link rustBinNumber rustNumber
|
||||||
|
hi def link rustIdentifierPrime rustIdentifier
|
||||||
|
hi def link rustTrait rustType
|
||||||
|
|
||||||
|
hi def link rustSigil StorageClass
|
||||||
|
hi def link rustFormat Special
|
||||||
|
hi def link rustSpecial Special
|
||||||
|
hi def link rustStringContinuation Special
|
||||||
|
hi def link rustString String
|
||||||
|
hi def link rustCharacter Character
|
||||||
|
hi def link rustNumber Number
|
||||||
|
hi def link rustBoolean Boolean
|
||||||
|
hi def link rustEnum rustType
|
||||||
|
hi def link rustEnumVariant rustConstant
|
||||||
|
hi def link rustConstant Constant
|
||||||
|
hi def link rustSelf Constant
|
||||||
|
hi def link rustFloat Float
|
||||||
|
hi def link rustOperator Operator
|
||||||
|
hi def link rustKeyword Keyword
|
||||||
|
hi def link rustConditional Conditional
|
||||||
|
hi def link rustIdentifier Identifier
|
||||||
|
hi def link rustCapsIdent rustIdentifier
|
||||||
|
hi def link rustModPath Include
|
||||||
|
hi def link rustModPathSep Delimiter
|
||||||
|
hi def link rustFunction Function
|
||||||
|
hi def link rustFuncName Function
|
||||||
|
hi def link rustFuncCall Function
|
||||||
|
hi def link rustCommentMLDoc rustCommentDoc
|
||||||
|
hi def link rustCommentDoc SpecialComment
|
||||||
|
hi def link rustCommentML rustComment
|
||||||
|
hi def link rustComment Comment
|
||||||
|
hi def link rustAssert PreCondit
|
||||||
|
hi def link rustFail PreCondit
|
||||||
|
hi def link rustMacro Macro
|
||||||
|
hi def link rustType Type
|
||||||
|
hi def link rustTodo Todo
|
||||||
|
hi def link rustAttribute PreProc
|
||||||
|
hi def link rustDeriving PreProc
|
||||||
|
hi def link rustStorage StorageClass
|
||||||
|
hi def link rustLifetime Special
|
||||||
|
|
||||||
|
" Other Suggestions:
|
||||||
|
" hi rustAttribute ctermfg=cyan
|
||||||
|
" hi rustDeriving ctermfg=cyan
|
||||||
|
" hi rustAssert ctermfg=yellow
|
||||||
|
" hi rustFail ctermfg=red
|
||||||
|
" hi rustMacro ctermfg=magenta
|
||||||
|
|
||||||
|
syn sync minlines=200
|
||||||
|
syn sync maxlines=500
|
||||||
|
|
||||||
|
let b:current_syntax = "rust"
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
" Vim syntax file
|
" Vim syntax file
|
||||||
" Language: sbt
|
" Language: sbt
|
||||||
" Maintainer: Derek Wyatt <derek@{myfirstname}{mylastname}.org>
|
" Maintainer: Derek Wyatt <derek@{myfirstname}{mylastname}.org>
|
||||||
" Last Change: 2012 Jan 19
|
" Last Change: 2013 Oct 20
|
||||||
|
|
||||||
if exists("b:current_syntax")
|
if exists("b:current_syntax")
|
||||||
finish
|
finish
|
||||||
@@ -15,6 +15,7 @@ syn match sbtStringEscape "\\[nrfvb\\\"]" contained
|
|||||||
|
|
||||||
syn match sbtIdentitifer "^\S\+\ze\s*\(:=\|++=\|+=\|<<=\|<+=\)"
|
syn match sbtIdentitifer "^\S\+\ze\s*\(:=\|++=\|+=\|<<=\|<+=\)"
|
||||||
syn match sbtBeginningSeq "^[Ss]eq\>"
|
syn match sbtBeginningSeq "^[Ss]eq\>"
|
||||||
|
syn match sbtAddPlugin "^addSbtPlugin\>"
|
||||||
|
|
||||||
syn match sbtSpecial "\(:=\|++=\|+=\|<<=\|<+=\)"
|
syn match sbtSpecial "\(:=\|++=\|+=\|<<=\|<+=\)"
|
||||||
|
|
||||||
@@ -25,6 +26,7 @@ syn region sbtDocComment start="/\*\*" end="\*/" keepend
|
|||||||
hi link sbtString String
|
hi link sbtString String
|
||||||
hi link sbtIdentitifer Keyword
|
hi link sbtIdentitifer Keyword
|
||||||
hi link sbtBeginningSeq Keyword
|
hi link sbtBeginningSeq Keyword
|
||||||
|
hi link sbtAddPlugin Keyword
|
||||||
hi link sbtSpecial Special
|
hi link sbtSpecial Special
|
||||||
hi link sbtComment Comment
|
hi link sbtComment Comment
|
||||||
hi link sbtLineComment Comment
|
hi link sbtLineComment Comment
|
||||||
|
|||||||
210
syntax/tt2.vim
Normal file
210
syntax/tt2.vim
Normal file
@@ -0,0 +1,210 @@
|
|||||||
|
" Language: TT2 (Perl Template Toolkit)
|
||||||
|
" Maintainer: vim-perl <vim-perl@googlegroups.com>
|
||||||
|
" Author: Moriki, Atsushi <4woods+vim@gmail.com>
|
||||||
|
" Homepage: http://github.com/vim-perl/vim-perl
|
||||||
|
" Bugs/requests: http://github.com/vim-perl/vim-perl/issues
|
||||||
|
" Last Change: {{LAST_CHANGE}}
|
||||||
|
"
|
||||||
|
" Instration:
|
||||||
|
" put tt2.vim and tt2html.vim in to your syntax diretory.
|
||||||
|
"
|
||||||
|
" add below in your filetype.vim.
|
||||||
|
" au BufNewFile,BufRead *.tt2 setf tt2
|
||||||
|
" or
|
||||||
|
" au BufNewFile,BufRead *.tt2
|
||||||
|
" \ if ( getline(1) . getline(2) . getline(3) =~ '<\chtml' |
|
||||||
|
" \ && getline(1) . getline(2) . getline(3) !~ '<[%?]' ) |
|
||||||
|
" \ || getline(1) =~ '<!DOCTYPE HTML' |
|
||||||
|
" \ setf tt2html |
|
||||||
|
" \ else |
|
||||||
|
" \ setf tt2 |
|
||||||
|
" \ endif
|
||||||
|
"
|
||||||
|
" define START_TAG, END_TAG
|
||||||
|
" "ASP"
|
||||||
|
" :let b:tt2_syn_tags = '<% %>'
|
||||||
|
" "PHP"
|
||||||
|
" :let b:tt2_syn_tags = '<? ?>'
|
||||||
|
" "TT2 and HTML"
|
||||||
|
" :let b:tt2_syn_tags = '\[% %] <!-- -->'
|
||||||
|
"
|
||||||
|
" Changes:
|
||||||
|
" 0.1.3
|
||||||
|
" Changed fileformat from 'dos' to 'unix'
|
||||||
|
" Deleted 'echo' that print obstructive message
|
||||||
|
" 0.1.2
|
||||||
|
" Added block comment syntax
|
||||||
|
" e.g. [%# COMMENT
|
||||||
|
" COMMENT TOO %]
|
||||||
|
" [%# IT'S SAFE %] HERE IS OUTSIDE OF TT2 DIRECTIVE
|
||||||
|
" [% # WRONG!! %] HERE STILL BE COMMENT
|
||||||
|
" 0.1.1
|
||||||
|
" Release
|
||||||
|
" 0.1.0
|
||||||
|
" Internal
|
||||||
|
"
|
||||||
|
" License: follow Vim :help uganda
|
||||||
|
"
|
||||||
|
|
||||||
|
if !exists("b:tt2_syn_tags")
|
||||||
|
let b:tt2_syn_tags = '\[% %]'
|
||||||
|
"let b:tt2_syn_tags = '\[% %] \[\* \*]'
|
||||||
|
endif
|
||||||
|
|
||||||
|
if !exists("b:tt2_syn_inc_perl")
|
||||||
|
let b:tt2_syn_inc_perl = 1
|
||||||
|
endif
|
||||||
|
|
||||||
|
if exists("b:current_syntax")
|
||||||
|
finish
|
||||||
|
endif
|
||||||
|
|
||||||
|
let s:cpo_save = &cpo
|
||||||
|
set cpo&vim
|
||||||
|
|
||||||
|
syn case match
|
||||||
|
|
||||||
|
syn cluster tt2_top_cluster contains=tt2_perlcode,tt2_tag_region
|
||||||
|
|
||||||
|
" TT2 TAG Region
|
||||||
|
if exists("b:tt2_syn_tags")
|
||||||
|
|
||||||
|
let s:str = b:tt2_syn_tags . ' '
|
||||||
|
let s:str = substitute(s:str,'^ \+','','g')
|
||||||
|
let s:str = substitute(s:str,' \+',' ','g')
|
||||||
|
|
||||||
|
while stridx(s:str,' ') > 0
|
||||||
|
|
||||||
|
let s:st = strpart(s:str,0,stridx(s:str,' '))
|
||||||
|
let s:str = substitute(s:str,'[^ ]* ','',"")
|
||||||
|
|
||||||
|
let s:ed = strpart(s:str,0,stridx(s:str,' '))
|
||||||
|
let s:str = substitute(s:str,'[^ ]* ','',"")
|
||||||
|
|
||||||
|
exec 'syn region tt2_tag_region '.
|
||||||
|
\ 'matchgroup=tt2_tag '.
|
||||||
|
\ 'start=+\(' . s:st .'\)[-]\=+ '.
|
||||||
|
\ 'end=+[-]\=\(' . s:ed . '\)+ '.
|
||||||
|
\ 'contains=@tt2_statement_cluster keepend extend'
|
||||||
|
|
||||||
|
exec 'syn region tt2_commentblock_region '.
|
||||||
|
\ 'matchgroup=tt2_tag '.
|
||||||
|
\ 'start=+\(' . s:st .'\)[-]\=\(#\)\@=+ '.
|
||||||
|
\ 'end=+[-]\=\(' . s:ed . '\)+ '.
|
||||||
|
\ 'keepend extend'
|
||||||
|
|
||||||
|
"Include Perl syntax when 'PERL' 'RAWPERL' block
|
||||||
|
if b:tt2_syn_inc_perl
|
||||||
|
syn include @Perl $VIMRUNTIME/syntax/perl.vim
|
||||||
|
exec 'syn region tt2_perlcode '.
|
||||||
|
\ 'start=+\(\(RAW\)\=PERL\s*[-]\=' . s:ed . '\(\n\)\=\)\@<=+ ' .
|
||||||
|
\ 'end=+' . s:st . '[-]\=\s*END+me=s-1 contains=@Perl keepend'
|
||||||
|
endif
|
||||||
|
|
||||||
|
"echo 'TAGS ' . s:st . ' ' . s:ed
|
||||||
|
unlet s:st
|
||||||
|
unlet s:ed
|
||||||
|
endwhile
|
||||||
|
|
||||||
|
else
|
||||||
|
|
||||||
|
syn region tt2_tag_region
|
||||||
|
\ matchgroup=tt2_tag
|
||||||
|
\ start=+\(\[%\)[-]\=+
|
||||||
|
\ end=+[-]\=%\]+
|
||||||
|
\ contains=@tt2_statement_cluster keepend extend
|
||||||
|
|
||||||
|
syn region tt2_commentblock_region
|
||||||
|
\ matchgroup=tt2_tag
|
||||||
|
\ start=+\(\[%\)[-]\=#+
|
||||||
|
\ end=+[-]\=%\]+
|
||||||
|
\ keepend extend
|
||||||
|
|
||||||
|
"Include Perl syntax when 'PERL' 'RAWPERL' block
|
||||||
|
if b:tt2_syn_inc_perl
|
||||||
|
syn include @Perl $VIMRUNTIME/syntax/perl.vim
|
||||||
|
syn region tt2_perlcode
|
||||||
|
\ start=+\(\(RAW\)\=PERL\s*[-]\=%]\(\n\)\=\)\@<=+
|
||||||
|
\ end=+\[%[-]\=\s*END+me=s-1
|
||||||
|
\ contains=@Perl keepend
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
|
||||||
|
" Directive
|
||||||
|
syn keyword tt2_directive contained
|
||||||
|
\ GET CALL SET DEFAULT DEBUG
|
||||||
|
\ LAST NEXT BREAK STOP BLOCK
|
||||||
|
\ IF IN UNLESS ELSIF FOR FOREACH WHILE SWITCH CASE
|
||||||
|
\ USE PLUGIN MACRO META
|
||||||
|
\ TRY FINAL RETURN LAST
|
||||||
|
\ CLEAR TO STEP AND OR NOT MOD DIV
|
||||||
|
\ ELSE PERL RAWPERL END
|
||||||
|
syn match tt2_directive +|+ contained
|
||||||
|
syn keyword tt2_directive contained nextgroup=tt2_string_q,tt2_string_qq,tt2_blockname skipwhite skipempty
|
||||||
|
\ INSERT INCLUDE PROCESS WRAPPER FILTER
|
||||||
|
\ THROW CATCH
|
||||||
|
syn keyword tt2_directive contained nextgroup=tt2_def_tag skipwhite skipempty
|
||||||
|
\ TAGS
|
||||||
|
|
||||||
|
syn match tt2_def_tag "\S\+\s\+\S\+\|\<\w\+\>" contained
|
||||||
|
|
||||||
|
syn match tt2_variable +\I\w*+ contained
|
||||||
|
syn match tt2_operator "[+*/%:?-]" contained
|
||||||
|
syn match tt2_operator "\<\(mod\|div\|or\|and\|not\)\>" contained
|
||||||
|
syn match tt2_operator "[!=<>]=\=\|&&\|||" contained
|
||||||
|
syn match tt2_operator "\(\s\)\@<=_\(\s\)\@=" contained
|
||||||
|
syn match tt2_operator "=>\|," contained
|
||||||
|
syn match tt2_deref "\([[:alnum:]_)\]}]\s*\)\@<=\." contained
|
||||||
|
syn match tt2_comment +#.*$+ contained extend
|
||||||
|
syn match tt2_func +\<\I\w*\(\s*(\)\@=+ contained nextgroup=tt2_bracket_r skipempty skipwhite
|
||||||
|
"
|
||||||
|
syn region tt2_bracket_r start=+(+ end=+)+ contained contains=@tt2_statement_cluster keepend extend
|
||||||
|
syn region tt2_bracket_b start=+\[+ end=+]+ contained contains=@tt2_statement_cluster keepend extend
|
||||||
|
syn region tt2_bracket_b start=+{+ end=+}+ contained contains=@tt2_statement_cluster keepend extend
|
||||||
|
|
||||||
|
syn region tt2_string_qq start=+"+ end=+"+ skip=+\\"+ contained contains=tt2_ivariable keepend extend
|
||||||
|
syn region tt2_string_q start=+'+ end=+'+ skip=+\\'+ contained keepend extend
|
||||||
|
|
||||||
|
syn match tt2_ivariable +\$\I\w*\>\(\.\I\w*\>\)*+ contained
|
||||||
|
syn match tt2_ivariable +\${\I\w*\>\(\.\I\w*\>\)*}+ contained
|
||||||
|
|
||||||
|
syn match tt2_number "\d\+" contained
|
||||||
|
syn match tt2_number "\d\+\.\d\+" contained
|
||||||
|
syn match tt2_number "0x\x\+" contained
|
||||||
|
syn match tt2_number "0\o\+" contained
|
||||||
|
|
||||||
|
syn match tt2_blockname "\f\+" contained nextgroup=tt2_blockname_joint skipwhite skipempty
|
||||||
|
syn match tt2_blockname "$\w\+" contained contains=tt2_ivariable nextgroup=tt2_blockname_joint skipwhite skipempty
|
||||||
|
syn region tt2_blockname start=+"+ end=+"+ skip=+\\"+ contained contains=tt2_ivariable nextgroup=tt2_blockname_joint keepend skipwhite skipempty
|
||||||
|
syn region tt2_blockname start=+'+ end=+'+ skip=+\\'+ contained nextgroup=tt2_blockname_joint keepend skipwhite skipempty
|
||||||
|
syn match tt2_blockname_joint "+" contained nextgroup=tt2_blockname skipwhite skipempty
|
||||||
|
|
||||||
|
syn cluster tt2_statement_cluster contains=tt2_directive,tt2_variable,tt2_operator,tt2_string_q,tt2_string_qq,tt2_deref,tt2_comment,tt2_func,tt2_bracket_b,tt2_bracket_r,tt2_number
|
||||||
|
|
||||||
|
" Synchronizing
|
||||||
|
syn sync minlines=50
|
||||||
|
|
||||||
|
hi def link tt2_tag Type
|
||||||
|
hi def link tt2_tag_region Type
|
||||||
|
hi def link tt2_commentblock_region Comment
|
||||||
|
hi def link tt2_directive Statement
|
||||||
|
hi def link tt2_variable Identifier
|
||||||
|
hi def link tt2_ivariable Identifier
|
||||||
|
hi def link tt2_operator Statement
|
||||||
|
hi def link tt2_string_qq String
|
||||||
|
hi def link tt2_string_q String
|
||||||
|
hi def link tt2_blockname String
|
||||||
|
hi def link tt2_comment Comment
|
||||||
|
hi def link tt2_func Function
|
||||||
|
hi def link tt2_number Number
|
||||||
|
|
||||||
|
if exists("b:tt2_syn_tags")
|
||||||
|
unlet b:tt2_syn_tags
|
||||||
|
endif
|
||||||
|
|
||||||
|
let b:current_syntax = "tt2"
|
||||||
|
|
||||||
|
let &cpo = s:cpo_save
|
||||||
|
unlet s:cpo_save
|
||||||
|
|
||||||
|
" vim:ts=4:sw=4
|
||||||
20
syntax/tt2html.vim
Normal file
20
syntax/tt2html.vim
Normal file
@@ -0,0 +1,20 @@
|
|||||||
|
" Language: TT2 embedded with HTML
|
||||||
|
" Maintainer: vim-perl <vim-perl@googlegroups.com>
|
||||||
|
" Author: Moriki, Atsushi <4woods+vim@gmail.com>
|
||||||
|
" Homepage: http://github.com/vim-perl/vim-perl
|
||||||
|
" Bugs/requests: http://github.com/vim-perl/vim-perl/issues
|
||||||
|
" Last Change: {{LAST_CHANGE}}
|
||||||
|
|
||||||
|
if exists("b:current_syntax")
|
||||||
|
finish
|
||||||
|
endif
|
||||||
|
|
||||||
|
runtime! syntax/html.vim
|
||||||
|
unlet b:current_syntax
|
||||||
|
|
||||||
|
runtime! syntax/tt2.vim
|
||||||
|
unlet b:current_syntax
|
||||||
|
|
||||||
|
syn cluster htmlPreProc add=@tt2_top_cluster
|
||||||
|
|
||||||
|
let b:current_syntax = "tt2html"
|
||||||
20
syntax/tt2js.vim
Normal file
20
syntax/tt2js.vim
Normal file
@@ -0,0 +1,20 @@
|
|||||||
|
" Language: TT2 embedded with Javascript
|
||||||
|
" Maintainer: Andy Lester <andy@petdance.com>
|
||||||
|
" Author: Yates, Peter <pd.yates@gmail.com>
|
||||||
|
" Homepage: http://github.com/vim-perl/vim-perl
|
||||||
|
" Bugs/requests: http://github.com/vim-perl/vim-perl/issues
|
||||||
|
" Last Change: {{LAST_CHANGE}}
|
||||||
|
|
||||||
|
if exists("b:current_syntax")
|
||||||
|
finish
|
||||||
|
endif
|
||||||
|
|
||||||
|
runtime! syntax/javascript.vim
|
||||||
|
unlet b:current_syntax
|
||||||
|
|
||||||
|
runtime! syntax/tt2.vim
|
||||||
|
unlet b:current_syntax
|
||||||
|
|
||||||
|
syn cluster javascriptPreProc add=@tt2_top_cluster
|
||||||
|
|
||||||
|
let b:current_syntax = "tt2js"
|
||||||
320
syntax/typescript.vim
Normal file
320
syntax/typescript.vim
Normal file
@@ -0,0 +1,320 @@
|
|||||||
|
" Vim syntax file
|
||||||
|
" Language: TypeScript
|
||||||
|
" Author: MicroSoft Open Technologies Inc.
|
||||||
|
" Version: 0.1
|
||||||
|
" Credits: Zhao Yi, Claudio Fleiner, Scott Shattuck, Jose Elera Campana
|
||||||
|
|
||||||
|
if !exists("main_syntax")
|
||||||
|
if version < 600
|
||||||
|
syntax clear
|
||||||
|
elseif exists("b:current_syntax")
|
||||||
|
finish
|
||||||
|
endif
|
||||||
|
let main_syntax = "typescript"
|
||||||
|
endif
|
||||||
|
|
||||||
|
" Drop fold if it set but vim doesn't support it.
|
||||||
|
if version < 600 && exists("typeScript_fold")
|
||||||
|
unlet typeScript_fold
|
||||||
|
endif
|
||||||
|
|
||||||
|
"" dollar sign is permitted anywhere in an identifier
|
||||||
|
setlocal iskeyword+=$
|
||||||
|
|
||||||
|
syntax sync fromstart
|
||||||
|
|
||||||
|
"" syntax coloring for Node.js shebang line
|
||||||
|
syn match shebang "^#!.*/bin/env\s\+node\>"
|
||||||
|
hi link shebang Comment
|
||||||
|
|
||||||
|
"" typeScript comments"{{{
|
||||||
|
syn keyword typeScriptCommentTodo TODO FIXME XXX TBD contained
|
||||||
|
syn match typeScriptLineComment "\/\/.*" contains=@Spell,typeScriptCommentTodo,typeScriptRef
|
||||||
|
syn match typeScriptRef /\/\/\/\s*<reference\s\+.*\/>$/ contains=typeScriptRefD,typeScriptRefS
|
||||||
|
syn region typeScriptRefD start=+"+ skip=+\\\\\|\\"+ end=+"\|$+
|
||||||
|
syn region typeScriptRefS start=+'+ skip=+\\\\\|\\'+ end=+'\|$+
|
||||||
|
|
||||||
|
syn match typeScriptCommentSkip "^[ \t]*\*\($\|[ \t]\+\)"
|
||||||
|
syn region typeScriptComment start="/\*" end="\*/" contains=@Spell,typeScriptCommentTodo
|
||||||
|
"}}}
|
||||||
|
"" JSDoc support start"{{{
|
||||||
|
if !exists("typeScript_ignore_typeScriptdoc")
|
||||||
|
syntax case ignore
|
||||||
|
|
||||||
|
" syntax coloring for JSDoc comments (HTML)
|
||||||
|
"unlet b:current_syntax
|
||||||
|
|
||||||
|
syntax region typeScriptDocComment matchgroup=typeScriptComment start="/\*\*\s*$" end="\*/" contains=typeScriptDocTags,typeScriptCommentTodo,typeScriptCvsTag,@typeScriptHtml,@Spell fold
|
||||||
|
syntax match typeScriptDocTags contained "@\(param\|argument\|requires\|exception\|throws\|type\|class\|extends\|see\|link\|member\|module\|method\|title\|namespace\|optional\|default\|base\|file\)\>" nextgroup=typeScriptDocParam,typeScriptDocSeeTag skipwhite
|
||||||
|
syntax match typeScriptDocTags contained "@\(beta\|deprecated\|description\|fileoverview\|author\|license\|version\|returns\=\|constructor\|private\|protected\|final\|ignore\|addon\|exec\)\>"
|
||||||
|
syntax match typeScriptDocParam contained "\%(#\|\w\|\.\|:\|\/\)\+"
|
||||||
|
syntax region typeScriptDocSeeTag contained matchgroup=typeScriptDocSeeTag start="{" end="}" contains=typeScriptDocTags
|
||||||
|
|
||||||
|
syntax case match
|
||||||
|
endif "" JSDoc end
|
||||||
|
"}}}
|
||||||
|
syntax case match
|
||||||
|
|
||||||
|
"" Syntax in the typeScript code"{{{
|
||||||
|
syn match typeScriptSpecial "\\\d\d\d\|\\."
|
||||||
|
syn region typeScriptStringD start=+"+ skip=+\\\\\|\\"+ end=+"\|$+ contains=typeScriptSpecial,@htmlPreproc
|
||||||
|
syn region typeScriptStringS start=+'+ skip=+\\\\\|\\'+ end=+'\|$+ contains=typeScriptSpecial,@htmlPreproc
|
||||||
|
|
||||||
|
syn match typeScriptSpecialCharacter "'\\.'"
|
||||||
|
syn match typeScriptNumber "-\=\<\d\+L\=\>\|0[xX][0-9a-fA-F]\+\>"
|
||||||
|
syn region typeScriptRegexpString start=+/[^/*]+me=e-1 skip=+\\\\\|\\/+ end=+/[gi]\{0,2\}\s*$+ end=+/[gi]\{0,2\}\s*[;.,)\]}]+me=e-1 contains=@htmlPreproc oneline
|
||||||
|
" syntax match typeScriptSpecial "\\\d\d\d\|\\x\x\{2\}\|\\u\x\{4\}\|\\."
|
||||||
|
" syntax region typeScriptStringD start=+"+ skip=+\\\\\|\\$"+ end=+"+ contains=typeScriptSpecial,@htmlPreproc
|
||||||
|
" syntax region typeScriptStringS start=+'+ skip=+\\\\\|\\$'+ end=+'+ contains=typeScriptSpecial,@htmlPreproc
|
||||||
|
" syntax region typeScriptRegexpString start=+/\(\*\|/\)\@!+ skip=+\\\\\|\\/+ end=+/[gim]\{,3}+ contains=typeScriptSpecial,@htmlPreproc oneline
|
||||||
|
" syntax match typeScriptNumber /\<-\=\d\+L\=\>\|\<0[xX]\x\+\>/
|
||||||
|
syntax match typeScriptFloat /\<-\=\%(\d\+\.\d\+\|\d\+\.\|\.\d\+\)\%([eE][+-]\=\d\+\)\=\>/
|
||||||
|
" syntax match typeScriptLabel /\(?\s*\)\@<!\<\w\+\(\s*:\)\@=/
|
||||||
|
"}}}
|
||||||
|
"" typeScript Prototype"{{{
|
||||||
|
syntax keyword typeScriptPrototype prototype
|
||||||
|
"}}}
|
||||||
|
" DOM, Browser and Ajax Support {{{
|
||||||
|
""""""""""""""""""""""""
|
||||||
|
syntax keyword typeScriptBrowserObjects window navigator screen history location
|
||||||
|
|
||||||
|
syntax keyword typeScriptDOMObjects document event HTMLElement Anchor Area Base Body Button Form Frame Frameset Image Link Meta Option Select Style Table TableCell TableRow Textarea
|
||||||
|
syntax keyword typeScriptDOMMethods createTextNode createElement insertBefore replaceChild removeChild appendChild hasChildNodes cloneNode normalize isSupported hasAttributes getAttribute setAttribute removeAttribute getAttributeNode setAttributeNode removeAttributeNode getElementsByTagName hasAttribute getElementById adoptNode close compareDocumentPosition createAttribute createCDATASection createComment createDocumentFragment createElementNS createEvent createExpression createNSResolver createProcessingInstruction createRange createTreeWalker elementFromPoint evaluate getBoxObjectFor getElementsByClassName getSelection getUserData hasFocus importNode
|
||||||
|
syntax keyword typeScriptDOMProperties nodeName nodeValue nodeType parentNode childNodes firstChild lastChild previousSibling nextSibling attributes ownerDocument namespaceURI prefix localName tagName
|
||||||
|
|
||||||
|
syntax keyword typeScriptAjaxObjects XMLHttpRequest
|
||||||
|
syntax keyword typeScriptAjaxProperties readyState responseText responseXML statusText
|
||||||
|
syntax keyword typeScriptAjaxMethods onreadystatechange abort getAllResponseHeaders getResponseHeader open send setRequestHeader
|
||||||
|
|
||||||
|
syntax keyword typeScriptPropietaryObjects ActiveXObject
|
||||||
|
syntax keyword typeScriptPropietaryMethods attachEvent detachEvent cancelBubble returnValue
|
||||||
|
|
||||||
|
syntax keyword typeScriptHtmlElemProperties className clientHeight clientLeft clientTop clientWidth dir href id innerHTML lang length offsetHeight offsetLeft offsetParent offsetTop offsetWidth scrollHeight scrollLeft scrollTop scrollWidth style tabIndex target title
|
||||||
|
|
||||||
|
syntax keyword typeScriptEventListenerKeywords blur click focus mouseover mouseout load item
|
||||||
|
|
||||||
|
syntax keyword typeScriptEventListenerMethods scrollIntoView addEventListener dispatchEvent removeEventListener preventDefault stopPropagation
|
||||||
|
" }}}
|
||||||
|
"" Programm Keywords"{{{
|
||||||
|
syntax keyword typeScriptSource import export
|
||||||
|
syntax keyword typeScriptIdentifier arguments this let var void yield
|
||||||
|
syntax keyword typeScriptOperator delete new instanceof typeof
|
||||||
|
syntax keyword typeScriptBoolean true false
|
||||||
|
syntax keyword typeScriptNull null undefined
|
||||||
|
syntax keyword typeScriptMessage alert confirm prompt status
|
||||||
|
syntax keyword typeScriptGlobal self top parent
|
||||||
|
syntax keyword typeScriptDeprecated escape unescape all applets alinkColor bgColor fgColor linkColor vlinkColor xmlEncoding
|
||||||
|
"}}}
|
||||||
|
"" Statement Keywords"{{{
|
||||||
|
syntax keyword typeScriptConditional if else switch
|
||||||
|
syntax keyword typeScriptRepeat do while for in
|
||||||
|
syntax keyword typeScriptBranch break continue
|
||||||
|
syntax keyword typeScriptLabel case default
|
||||||
|
syntax keyword typeScriptStatement return with
|
||||||
|
|
||||||
|
syntax keyword typeScriptGlobalObjects Array Boolean Date Function Infinity Math Number NaN Object Packages RegExp String netscape
|
||||||
|
|
||||||
|
syntax keyword typeScriptExceptions try catch throw finally Error EvalError RangeError ReferenceError SyntaxError TypeError URIError
|
||||||
|
|
||||||
|
syntax keyword typeScriptReserved constructor declare as interface module abstract enum int short boolean export interface static byte extends long super char final native synchronized class float package throws const goto private transient debugger implements protected volatile double import public
|
||||||
|
"}}}
|
||||||
|
"" TypeScript/DOM/HTML/CSS specified things"{{{
|
||||||
|
|
||||||
|
" TypeScript Objects"{{{
|
||||||
|
syn match typeScriptFunction "(super\s*|constructor\s*)" contained nextgroup=typeScriptVars
|
||||||
|
syn region typeScriptVars start="(" end=")" contained contains=typeScriptParameters transparent keepend
|
||||||
|
syn match typeScriptParameters "([a-zA-Z0-9_?.$][\w?.$]*)\s*:\s*([a-zA-Z0-9_?.$][\w?.$]*)" contained skipwhite
|
||||||
|
"}}}
|
||||||
|
" DOM2 Objects"{{{
|
||||||
|
syntax keyword typeScriptType DOMImplementation DocumentFragment Node NodeList NamedNodeMap CharacterData Attr Element Text Comment CDATASection DocumentType Notation Entity EntityReference ProcessingInstruction void any string bool number
|
||||||
|
syntax keyword typeScriptExceptions DOMException
|
||||||
|
"}}}
|
||||||
|
" DOM2 CONSTANT"{{{
|
||||||
|
syntax keyword typeScriptDomErrNo INDEX_SIZE_ERR DOMSTRING_SIZE_ERR HIERARCHY_REQUEST_ERR WRONG_DOCUMENT_ERR INVALID_CHARACTER_ERR NO_DATA_ALLOWED_ERR NO_MODIFICATION_ALLOWED_ERR NOT_FOUND_ERR NOT_SUPPORTED_ERR INUSE_ATTRIBUTE_ERR INVALID_STATE_ERR SYNTAX_ERR INVALID_MODIFICATION_ERR NAMESPACE_ERR INVALID_ACCESS_ERR
|
||||||
|
syntax keyword typeScriptDomNodeConsts ELEMENT_NODE ATTRIBUTE_NODE TEXT_NODE CDATA_SECTION_NODE ENTITY_REFERENCE_NODE ENTITY_NODE PROCESSING_INSTRUCTION_NODE COMMENT_NODE DOCUMENT_NODE DOCUMENT_TYPE_NODE DOCUMENT_FRAGMENT_NODE NOTATION_NODE
|
||||||
|
"}}}
|
||||||
|
" HTML events and internal variables"{{{
|
||||||
|
syntax case ignore
|
||||||
|
syntax keyword typeScriptHtmlEvents onblur onclick oncontextmenu ondblclick onfocus onkeydown onkeypress onkeyup onmousedown onmousemove onmouseout onmouseover onmouseup onresize onload onsubmit
|
||||||
|
syntax case match
|
||||||
|
"}}}
|
||||||
|
|
||||||
|
" Follow stuff should be highligh within a special context
|
||||||
|
" While it can't be handled with context depended with Regex based highlight
|
||||||
|
" So, turn it off by default
|
||||||
|
if exists("typeScript_enable_domhtmlcss")
|
||||||
|
|
||||||
|
" DOM2 things"{{{
|
||||||
|
syntax match typeScriptDomElemAttrs contained /\%(nodeName\|nodeValue\|nodeType\|parentNode\|childNodes\|firstChild\|lastChild\|previousSibling\|nextSibling\|attributes\|ownerDocument\|namespaceURI\|prefix\|localName\|tagName\)\>/
|
||||||
|
syntax match typeScriptDomElemFuncs contained /\%(insertBefore\|replaceChild\|removeChild\|appendChild\|hasChildNodes\|cloneNode\|normalize\|isSupported\|hasAttributes\|getAttribute\|setAttribute\|removeAttribute\|getAttributeNode\|setAttributeNode\|removeAttributeNode\|getElementsByTagName\|getAttributeNS\|setAttributeNS\|removeAttributeNS\|getAttributeNodeNS\|setAttributeNodeNS\|getElementsByTagNameNS\|hasAttribute\|hasAttributeNS\)\>/ nextgroup=typeScriptParen skipwhite
|
||||||
|
"}}}
|
||||||
|
" HTML things"{{{
|
||||||
|
syntax match typeScriptHtmlElemAttrs contained /\%(className\|clientHeight\|clientLeft\|clientTop\|clientWidth\|dir\|id\|innerHTML\|lang\|length\|offsetHeight\|offsetLeft\|offsetParent\|offsetTop\|offsetWidth\|scrollHeight\|scrollLeft\|scrollTop\|scrollWidth\|style\|tabIndex\|title\)\>/
|
||||||
|
syntax match typeScriptHtmlElemFuncs contained /\%(blur\|click\|focus\|scrollIntoView\|addEventListener\|dispatchEvent\|removeEventListener\|item\)\>/ nextgroup=typeScriptParen skipwhite
|
||||||
|
"}}}
|
||||||
|
" CSS Styles in typeScript"{{{
|
||||||
|
syntax keyword typeScriptCssStyles contained color font fontFamily fontSize fontSizeAdjust fontStretch fontStyle fontVariant fontWeight letterSpacing lineBreak lineHeight quotes rubyAlign rubyOverhang rubyPosition
|
||||||
|
syntax keyword typeScriptCssStyles contained textAlign textAlignLast textAutospace textDecoration textIndent textJustify textJustifyTrim textKashidaSpace textOverflowW6 textShadow textTransform textUnderlinePosition
|
||||||
|
syntax keyword typeScriptCssStyles contained unicodeBidi whiteSpace wordBreak wordSpacing wordWrap writingMode
|
||||||
|
syntax keyword typeScriptCssStyles contained bottom height left position right top width zIndex
|
||||||
|
syntax keyword typeScriptCssStyles contained border borderBottom borderLeft borderRight borderTop borderBottomColor borderLeftColor borderTopColor borderBottomStyle borderLeftStyle borderRightStyle borderTopStyle borderBottomWidth borderLeftWidth borderRightWidth borderTopWidth borderColor borderStyle borderWidth borderCollapse borderSpacing captionSide emptyCells tableLayout
|
||||||
|
syntax keyword typeScriptCssStyles contained margin marginBottom marginLeft marginRight marginTop outline outlineColor outlineStyle outlineWidth padding paddingBottom paddingLeft paddingRight paddingTop
|
||||||
|
syntax keyword typeScriptCssStyles contained listStyle listStyleImage listStylePosition listStyleType
|
||||||
|
syntax keyword typeScriptCssStyles contained background backgroundAttachment backgroundColor backgroundImage gackgroundPosition backgroundPositionX backgroundPositionY backgroundRepeat
|
||||||
|
syntax keyword typeScriptCssStyles contained clear clip clipBottom clipLeft clipRight clipTop content counterIncrement counterReset cssFloat cursor direction display filter layoutGrid layoutGridChar layoutGridLine layoutGridMode layoutGridType
|
||||||
|
syntax keyword typeScriptCssStyles contained marks maxHeight maxWidth minHeight minWidth opacity MozOpacity overflow overflowX overflowY verticalAlign visibility zoom cssText
|
||||||
|
syntax keyword typeScriptCssStyles contained scrollbar3dLightColor scrollbarArrowColor scrollbarBaseColor scrollbarDarkShadowColor scrollbarFaceColor scrollbarHighlightColor scrollbarShadowColor scrollbarTrackColor
|
||||||
|
"}}}
|
||||||
|
" Highlight ways"{{{
|
||||||
|
syntax match typeScriptDotNotation "\." nextgroup=typeScriptPrototype,typeScriptDomElemAttrs,typeScriptDomElemFuncs,typeScriptHtmlElemAttrs,typeScriptHtmlElemFuncs
|
||||||
|
syntax match typeScriptDotNotation "\.style\." nextgroup=typeScriptCssStyles
|
||||||
|
"}}}
|
||||||
|
endif "DOM/HTML/CSS
|
||||||
|
|
||||||
|
"" end DOM/HTML/CSS specified things""}}}
|
||||||
|
|
||||||
|
|
||||||
|
"" Code blocks
|
||||||
|
syntax cluster typeScriptAll contains=typeScriptComment,typeScriptLineComment,typeScriptDocComment,typeScriptStringD,typeScriptStringS,typeScriptRegexpString,typeScriptNumber,typeScriptFloat,typeScriptLabel,typeScriptSource,typeScriptType,typeScriptOperator,typeScriptBoolean,typeScriptNull,typeScriptFuncKeyword,typeScriptConditional,typeScriptGlobal,typeScriptRepeat,typeScriptBranch,typeScriptStatement,typeScriptGlobalObjects,typeScriptMessage,typeScriptIdentifier,typeScriptExceptions,typeScriptReserved,typeScriptDeprecated,typeScriptDomErrNo,typeScriptDomNodeConsts,typeScriptHtmlEvents,typeScriptDotNotation,typeScriptBrowserObjects,typeScriptDOMObjects,typeScriptAjaxObjects,typeScriptPropietaryObjects,typeScriptDOMMethods,typeScriptHtmlElemProperties,typeScriptDOMProperties,typeScriptEventListenerKeywords,typeScriptEventListenerMethods,typeScriptAjaxProperties,typeScriptAjaxMethods,typeScriptFuncArg
|
||||||
|
|
||||||
|
if main_syntax == "typeScript"
|
||||||
|
syntax sync clear
|
||||||
|
syntax sync ccomment typeScriptComment minlines=200
|
||||||
|
" syntax sync match typeScriptHighlight grouphere typeScriptBlock /{/
|
||||||
|
endif
|
||||||
|
|
||||||
|
syntax keyword typeScriptFuncKeyword function contained
|
||||||
|
syntax region typeScriptFuncDef start="function" end="\([^)]*\)" contains=typeScriptFuncKeyword,typeScriptFuncArg keepend
|
||||||
|
syntax match typeScriptFuncArg "\(([^()]*)\)" contains=typeScriptParens,typeScriptFuncComma contained
|
||||||
|
syntax match typeScriptFuncComma /,/ contained
|
||||||
|
" syntax region typeScriptFuncBlock contained matchgroup=typeScriptFuncBlock start="{" end="}" contains=@typeScriptAll,typeScriptParensErrA,typeScriptParensErrB,typeScriptParen,typeScriptBracket,typeScriptBlock fold
|
||||||
|
|
||||||
|
syn match typeScriptBraces "[{}\[\]]"
|
||||||
|
syn match typeScriptParens "[()]"
|
||||||
|
syn match typeScriptOpSymbols "=\{1,3}\|!==\|!=\|<\|>\|>=\|<=\|++\|+=\|--\|-="
|
||||||
|
syn match typeScriptEndColons "[;,]"
|
||||||
|
syn match typeScriptLogicSymbols "\(&&\)\|\(||\)"
|
||||||
|
|
||||||
|
" typeScriptFold Function {{{
|
||||||
|
|
||||||
|
function! TypeScriptFold()
|
||||||
|
setl foldlevelstart=1
|
||||||
|
syn region foldBraces start=/{/ end=/}/ transparent fold keepend extend
|
||||||
|
|
||||||
|
setl foldtext=FoldText()
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
au FileType typeScript call TypeScriptFold()
|
||||||
|
|
||||||
|
" }}}
|
||||||
|
|
||||||
|
" Define the default highlighting.
|
||||||
|
" For version 5.7 and earlier: only when not done already
|
||||||
|
" For version 5.8 and later: only when an item doesn't have highlighting yet
|
||||||
|
if version >= 508 || !exists("did_typeScript_syn_inits")
|
||||||
|
if version < 508
|
||||||
|
let did_typeScript_syn_inits = 1
|
||||||
|
command -nargs=+ HiLink hi link <args>
|
||||||
|
else
|
||||||
|
command -nargs=+ HiLink hi def link <args>
|
||||||
|
endif
|
||||||
|
|
||||||
|
"Typescript highlighting
|
||||||
|
HiLink typeScriptParameters Operator
|
||||||
|
HiLink typescriptSuperBlock Operator
|
||||||
|
|
||||||
|
HiLink typeScriptEndColons Exception
|
||||||
|
HiLink typeScriptOpSymbols Operator
|
||||||
|
HiLink typeScriptLogicSymbols Boolean
|
||||||
|
HiLink typeScriptBraces Function
|
||||||
|
HiLink typeScriptParens Operator
|
||||||
|
HiLink typeScriptComment Comment
|
||||||
|
HiLink typeScriptLineComment Comment
|
||||||
|
HiLink typeScriptRef Include
|
||||||
|
HiLink typeScriptRefS String
|
||||||
|
HiLink typeScriptRefD String
|
||||||
|
HiLink typeScriptDocComment Comment
|
||||||
|
HiLink typeScriptCommentTodo Todo
|
||||||
|
HiLink typeScriptCvsTag Function
|
||||||
|
HiLink typeScriptDocTags Special
|
||||||
|
HiLink typeScriptDocSeeTag Function
|
||||||
|
HiLink typeScriptDocParam Function
|
||||||
|
HiLink typeScriptStringS String
|
||||||
|
HiLink typeScriptStringD String
|
||||||
|
HiLink typeScriptRegexpString String
|
||||||
|
HiLink typeScriptGlobal Constant
|
||||||
|
HiLink typeScriptCharacter Character
|
||||||
|
HiLink typeScriptPrototype Type
|
||||||
|
HiLink typeScriptConditional Conditional
|
||||||
|
HiLink typeScriptBranch Conditional
|
||||||
|
HiLink typeScriptIdentifier Identifier
|
||||||
|
HiLink typeScriptRepeat Repeat
|
||||||
|
HiLink typeScriptStatement Statement
|
||||||
|
HiLink typeScriptFuncKeyword Function
|
||||||
|
HiLink typeScriptMessage Keyword
|
||||||
|
HiLink typeScriptDeprecated Exception
|
||||||
|
HiLink typeScriptError Error
|
||||||
|
HiLink typeScriptParensError Error
|
||||||
|
HiLink typeScriptParensErrA Error
|
||||||
|
HiLink typeScriptParensErrB Error
|
||||||
|
HiLink typeScriptParensErrC Error
|
||||||
|
HiLink typeScriptReserved Keyword
|
||||||
|
HiLink typeScriptOperator Operator
|
||||||
|
HiLink typeScriptType Type
|
||||||
|
HiLink typeScriptNull Type
|
||||||
|
HiLink typeScriptNumber Number
|
||||||
|
HiLink typeScriptFloat Number
|
||||||
|
HiLink typeScriptBoolean Boolean
|
||||||
|
HiLink typeScriptLabel Label
|
||||||
|
HiLink typeScriptSpecial Special
|
||||||
|
HiLink typeScriptSource Special
|
||||||
|
HiLink typeScriptGlobalObjects Special
|
||||||
|
HiLink typeScriptExceptions Special
|
||||||
|
|
||||||
|
HiLink typeScriptDomErrNo Constant
|
||||||
|
HiLink typeScriptDomNodeConsts Constant
|
||||||
|
HiLink typeScriptDomElemAttrs Label
|
||||||
|
HiLink typeScriptDomElemFuncs PreProc
|
||||||
|
|
||||||
|
HiLink typeScriptHtmlElemAttrs Label
|
||||||
|
HiLink typeScriptHtmlElemFuncs PreProc
|
||||||
|
|
||||||
|
HiLink typeScriptCssStyles Label
|
||||||
|
" Ajax Highlighting
|
||||||
|
HiLink typeScriptBrowserObjects Constant
|
||||||
|
|
||||||
|
HiLink typeScriptDOMObjects Constant
|
||||||
|
HiLink typeScriptDOMMethods Exception
|
||||||
|
HiLink typeScriptDOMProperties Type
|
||||||
|
|
||||||
|
HiLink typeScriptAjaxObjects htmlH1
|
||||||
|
HiLink typeScriptAjaxMethods Exception
|
||||||
|
HiLink typeScriptAjaxProperties Type
|
||||||
|
|
||||||
|
HiLink typeScriptFuncDef Title
|
||||||
|
HiLink typeScriptFuncArg Special
|
||||||
|
HiLink typeScriptFuncComma Operator
|
||||||
|
|
||||||
|
HiLink typeScriptHtmlEvents Special
|
||||||
|
HiLink typeScriptHtmlElemProperties Type
|
||||||
|
|
||||||
|
HiLink typeScriptEventListenerKeywords Keyword
|
||||||
|
|
||||||
|
HiLink typeScriptNumber Number
|
||||||
|
HiLink typeScriptPropietaryObjects Constant
|
||||||
|
|
||||||
|
delcommand HiLink
|
||||||
|
endif
|
||||||
|
|
||||||
|
" Define the htmltypeScript for HTML syntax html.vim
|
||||||
|
"syntax clear htmltypeScript
|
||||||
|
"syntax clear typeScriptExpression
|
||||||
|
syntax cluster htmltypeScript contains=@typeScriptAll,typeScriptBracket,typeScriptParen,typeScriptBlock,typeScriptParenError
|
||||||
|
syntax cluster typeScriptExpression contains=@typeScriptAll,typeScriptBracket,typeScriptParen,typeScriptBlock,typeScriptParenError,@htmlPreproc
|
||||||
|
|
||||||
|
let b:current_syntax = "typeScript"
|
||||||
|
if main_syntax == 'typeScript'
|
||||||
|
unlet main_syntax
|
||||||
|
endif
|
||||||
|
|
||||||
|
" vim: ts=4
|
||||||
3278
syntax/xs.vim
Normal file
3278
syntax/xs.vim
Normal file
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user