mirror of
https://github.com/sheerun/vim-polyglot.git
synced 2025-11-08 11:33:52 -05:00
Add razor syntax, fixes #450
This commit is contained in:
@@ -10,7 +10,7 @@ A collection of language packs for Vim.
|
||||
> One to rule them all, one to find them, one to bring them all and in the darkness bind them.
|
||||
|
||||
- It **won't affect your startup time**, as scripts are loaded only on demand\*.
|
||||
- It **installs and updates 120+ times faster** than the <!--Package Count-->146<!--/Package Count--> packages it consists of.
|
||||
- It **installs and updates 120+ times faster** than the <!--Package Count-->147<!--/Package Count--> packages it consists of.
|
||||
- Solid syntax and indentation support (other features skipped). Only the best language packs.
|
||||
- All unnecessary files are ignored (like enormous documentation from php support).
|
||||
- No support for esoteric languages, only most popular ones (modern too, like `slim`).
|
||||
@@ -149,6 +149,7 @@ If you need full functionality of any plugin, please use it directly with your p
|
||||
- [racket](https://github.com/wlangstroth/vim-racket) (syntax, indent, ftplugin)
|
||||
- [ragel](https://github.com/jneen/ragel.vim) (syntax)
|
||||
- [raml](https://github.com/IN3D/vim-raml) (syntax, ftplugin)
|
||||
- [razor](https://github.com/adamclerk/vim-razor) (syntax, indent, ftplugin)
|
||||
- [reason](https://github.com/reasonml-editor/vim-reason-plus) (syntax, indent)
|
||||
- [rspec](https://github.com/keith/rspec.vim) (syntax)
|
||||
- [rst](https://github.com/marshallward/vim-restructuredtext) (syntax, indent, autoload, ftplugin)
|
||||
|
||||
1
build
1
build
@@ -267,6 +267,7 @@ PACKS="
|
||||
racket:wlangstroth/vim-racket
|
||||
ragel:jneen/ragel.vim
|
||||
raml:IN3D/vim-raml
|
||||
razor:adamclerk/vim-razor
|
||||
reason:reasonml-editor/vim-reason-plus
|
||||
rspec:keith/rspec.vim
|
||||
rst:marshallward/vim-restructuredtext
|
||||
|
||||
@@ -1174,6 +1174,13 @@ au BufRead,BufNewFile *.raml set ft=raml
|
||||
augroup end
|
||||
endif
|
||||
|
||||
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'razor') == -1
|
||||
augroup filetypedetect
|
||||
" razor, from razor.vim in adamclerk/vim-razor
|
||||
autocmd BufNewFile,BufRead *.cshtml setf razor
|
||||
augroup end
|
||||
endif
|
||||
|
||||
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'reason') == -1
|
||||
augroup filetypedetect
|
||||
" reason, from reason.vim in reasonml-editor/vim-reason-plus
|
||||
|
||||
30
ftplugin/razor.vim
Normal file
30
ftplugin/razor.vim
Normal file
@@ -0,0 +1,30 @@
|
||||
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'razor') == -1
|
||||
|
||||
" Vim filetype plugin
|
||||
" Language: LessCSS
|
||||
" Author: Tim Pope <vimNOSPAM@tpope.org>
|
||||
" Maintainer: Leonard Ehrenfried <leonard.ehrenfried@web.de>
|
||||
" Last Change: 2011 Sep 30
|
||||
|
||||
" Only do this when not done yet for this buffer
|
||||
:UltiSnipsAddFiletypes razor.html
|
||||
|
||||
if exists("b:did_ftplugin")
|
||||
finish
|
||||
endif
|
||||
let b:did_ftplugin = 1
|
||||
|
||||
"let b:undo_ftplugin = "setl cms< def< inc< inex< ofu< sua<"
|
||||
|
||||
"setlocal iskeyword+=-
|
||||
"setlocal commentstring=//\ %s
|
||||
"setlocal define=^\\s*\\%(@mixin\\\|=\\)
|
||||
"setlocal includeexpr=substitute(v:fname,'\\%(.*/\\\|^\\)\\zs','_','')
|
||||
"setlocal omnifunc=csscomplete#CompleteCSS
|
||||
"setlocal suffixesadd=.less
|
||||
|
||||
"let &l:include = '^\s*@import\s\+\%(url(\)\=["'']\='
|
||||
|
||||
" vim:set sw=2:
|
||||
|
||||
endif
|
||||
14
indent/razor.vim
Normal file
14
indent/razor.vim
Normal file
@@ -0,0 +1,14 @@
|
||||
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'razor') == -1
|
||||
|
||||
" Vim indent file
|
||||
" Language: Razor
|
||||
" Maintainer: Adam Clark <adamclerk@gmail.com>
|
||||
" Last Change: 2013 Jan 24
|
||||
|
||||
if exists("b:did_indent")
|
||||
finish
|
||||
endif
|
||||
runtime! indent/html.vim
|
||||
runtime! indent/javscript.vim
|
||||
|
||||
endif
|
||||
56
syntax/razor.vim
Normal file
56
syntax/razor.vim
Normal file
@@ -0,0 +1,56 @@
|
||||
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'razor') == -1
|
||||
|
||||
if exists("b:current_syntax")
|
||||
finish
|
||||
endif
|
||||
|
||||
runtime! syntax/html.vim
|
||||
|
||||
"razor
|
||||
syn cluster rBlocks add=rCodeBlock,rCodeLine,rComment,rInherits,rUsing
|
||||
syn match rCodeLine "@[a-zA-Z0-9_\.()]*" containedin=ALLBUT,@rBlocks
|
||||
syn region rCodeBlock start="@{" end="}" contains=@rcsAll containedin=ALLBUT,@rBlocks keepend
|
||||
syn region rComment start="@\*" end="\*@" contains=rcsComment containedin=ALLBUT,@rBlocks keepend
|
||||
|
||||
"not recursive for namespaces with generic types
|
||||
syn region rInherits start="^@inherits" end="$" containedin=ALLBUT,@rBlocks
|
||||
syn match rNamespacedGenericType "\s\+\w\+\(\.\w\+\)*\(<\w\+\(\.\w\+\)*>\)\?" containedin=rInherits contained
|
||||
|
||||
syn region rUsing start="^@using " end="$" containedin=ALLBUT,@rBlocks
|
||||
syn match rNamespace "\s\+\w\+\(\.\w\+\)*" containedin=rUsing contained
|
||||
|
||||
syn match rCodeInCodeBlock "[a-zA-Z]\+" containedin=rCodeBlock contained
|
||||
|
||||
|
||||
"cs
|
||||
syn keyword rcsType contained bool byte char decimal double float int
|
||||
syn keyword rcsType contained long object sbyte short string uint ulong
|
||||
syn keyword rcsType contained ushort void var
|
||||
syn keyword rcsRepeat contained break continue do for foreach goto return
|
||||
syn keyword rcsRepeat contained while yield
|
||||
syn keyword rcsConditional contained if else switch
|
||||
syn keyword rcsLabel contained case default
|
||||
syn region rcsComment start="/\*" end="\*/" contained
|
||||
syn match rcsComment "//.*$" contained
|
||||
syn cluster rcsAll add=rcsType,rcsRepeat,rcsConditional,rcsLabel,rcsComment
|
||||
|
||||
"Highlighting
|
||||
"cs
|
||||
hi def link rcsType Type
|
||||
hi def link rcsRepeat Repeat
|
||||
hi def link rcsConditional Conditional
|
||||
hi def link rcsLabel Label
|
||||
hi def link rcsComment Comment
|
||||
|
||||
"razor
|
||||
hi def link rCodeLine Special
|
||||
hi def link rComment Comment
|
||||
hi def link rInherits Preproc
|
||||
hi def link rNamespacedGenericType Type
|
||||
hi def link rUsing Preproc
|
||||
hi def link rNamespace Type
|
||||
|
||||
let b:current_syntax = "razor"
|
||||
|
||||
|
||||
endif
|
||||
Reference in New Issue
Block a user