summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAdam Stankiewicz <sheerun@sher.pl>2020-03-02 01:03:15 +0100
committerAdam Stankiewicz <sheerun@sher.pl>2020-03-02 01:03:15 +0100
commite558a218c6469c37cb17e17fd6789787090e6933 (patch)
tree6d9f9e90e624a67335418e1bbdec0c62e02db65f
parent16774887a3fe26a09326585f871748ddf158905e (diff)
downloadvim-polyglot-e558a218c6469c37cb17e17fd6789787090e6933.tar.gz
vim-polyglot-e558a218c6469c37cb17e17fd6789787090e6933.zip
Add razor syntax, fixes #450
-rw-r--r--README.md3
-rwxr-xr-xbuild1
-rw-r--r--ftdetect/polyglot.vim7
-rw-r--r--ftplugin/razor.vim30
-rw-r--r--indent/razor.vim14
-rw-r--r--syntax/razor.vim56
6 files changed, 110 insertions, 1 deletions
diff --git a/README.md b/README.md
index 961d3b18..56093b88 100644
--- a/README.md
+++ b/README.md
@@ -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)
diff --git a/build b/build
index 0f6b5d7c..44f39935 100755
--- a/build
+++ b/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
diff --git a/ftdetect/polyglot.vim b/ftdetect/polyglot.vim
index 85259f4f..d8f2679c 100644
--- a/ftdetect/polyglot.vim
+++ b/ftdetect/polyglot.vim
@@ -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
diff --git a/ftplugin/razor.vim b/ftplugin/razor.vim
new file mode 100644
index 00000000..76348dd0
--- /dev/null
+++ b/ftplugin/razor.vim
@@ -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
diff --git a/indent/razor.vim b/indent/razor.vim
new file mode 100644
index 00000000..d3990890
--- /dev/null
+++ b/indent/razor.vim
@@ -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
diff --git a/syntax/razor.vim b/syntax/razor.vim
new file mode 100644
index 00000000..af18d75c
--- /dev/null
+++ b/syntax/razor.vim
@@ -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