|
function! s:vsfiletype(s)
set fileencodings=utf-8
set fileformats=unix,dos
setlocal filetype=vs
" Set the syntax
exec 'setlocal syntax=' . a:s
" Assign how to build the damn thing
if filereadable("makefile") || filereadable("Makefile")
setlocal makeprg=make
setlocal errorformat=%f(%l\\\,%c):\ %m
else
compiler msbuild
endif
" Set the appropriate tagbar type
if a:s == "cs"
let g:tagbar_type_vs = {
\ 'kinds' : [
\ 'd:macros:1:0',
\ 'f:fields',
\ 'g:enums',
\ 'e:enumerators:0:0',
\ 't:typedefs',
\ 'n:namespaces',
\ 'i:interfaces',
\ 'c:classes',
\ 's:structs',
\ 'E:events',
\ 'm:methods',
\ 'p:properties',
\ ],
\ }
elseif a:s == "html"
let g:tagbar_type_vs = {
\ 'kinds' : [
\ 'f:JavaScript funtions',
\ 'a:named anchors',
\ ],
\ }
endif
endfunction
" Associate to common file formats
augroup filedetect
au! BufNewFile,BufRead *.cs call s:vsfiletype("cs")
au! BufNewFile,BufRead *.vb call s:vsfiletype("vb")
au! BufNewFile,BufRead *.csproj,*.csproj,*.vbproj,*.vbproj.user call s:vsfiletype("xml")
au! BufNewFile,BufRead *.sln call s:vsfiletype("xml")
au! BufNewFile,BufRead *.aspx,*.cshtml,*.vbhtml call s:vsfiletype("html")
augroup END
|