Логика примерно такая, надо допилить для многострочных комментариев
function RetFileType()
let file_name = buffer_name("%")
if file_name =~ '\.vim'
return ["\"", ""]
elseif __is_django_template() == 1
return ['{% comment %}' , '{% endcomment %}']
elseif file_name =~ '\.html$' || file_name =~ '\.xhtml$' || file_name =~ '\.xml'
return ["<!--", "-->"]
endif
return ["#", ""]
endfunction
au BufEnter * let b:comment = RetFileType()
function! CommentLine()
let stsymbol = b:comment[0]
let endsymbol = b:comment[1]
execute ":silent! normal 0i" . stsymbol . "\<ESC>A" . endsymbol . "\<ESC>"
endfunction
vmap <C-c> :call CommentLine()<cr>
vmap <C-u> :call UnCommentLine()<cr>