19

I'm looking for a .cshtml vim syntax file. Are there any projects that haven't made it to www.vim.org?

Conner
  • 30,144
  • 8
  • 52
  • 73
John Weldon
  • 39,849
  • 11
  • 94
  • 127
  • Interesting question. I would suppose that it's at least very difficult to do syntax highlighting without reproducing a lot of what razor does. – Gleno Jul 02 '11 at 18:52
  • Yes, I think it would be a fairly involved syntax file, but there has to be a way to at least get an 80% solution... – John Weldon Jul 03 '11 at 14:23

5 Answers5

12

":setf html" solves the 80% part :)

jasoni
  • 816
  • 5
  • 12
8

this guy has razor support planned, but is not yet there. However, it does add some features to the existing c# support. https://github.com/OrangeT/vim-csharp

twomm
  • 551
  • 5
  • 16
6

Settled with adding this to .vimrc

" add html syntax to dotnet razor files
autocmd BufNewFile,BufRead *.cshtml set syntax=html
arcseldon
  • 35,523
  • 17
  • 121
  • 125
2

You can find nice vim-razor plugin in https://github.com/adamclerk/vim-razor

$ cd ~/.vim/bundle
$ git clone https://github.com/adamclerk/vim-razor
1

Russ Martinez (or maybe Daniel Dabrowski's) cshtml.vim file seems to be a candidate. It's not perfect, but at least it's a start. https://bitbucket.org/rod/dotfiles/src/8aaae8635165/vim/syntax/cshtml.vim

TankorSmash
  • 12,186
  • 6
  • 68
  • 106