Answer the question
In order to leave comments, you need to log in
Answer the question
In order to leave comments, you need to log in
The logic is something like this, you need to finish it for multi-line comments
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>
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question