From 22466411d11b03b7297c9ceb49d6e82b75a69a12 Mon Sep 17 00:00:00 2001 From: Didzis Gosko Date: Tue, 11 Jun 2019 02:35:25 +0300 Subject: [PATCH] closes #233 and #234 * always substitute comment markers in entire block comment * indentation of block comments respects tabstop and expandtab settings --- autoload/tcomment.vim | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/autoload/tcomment.vim b/autoload/tcomment.vim index 64b5866..4784761 100644 --- a/autoload/tcomment.vim +++ b/autoload/tcomment.vim @@ -817,7 +817,6 @@ endf function! s:CommentBlock(beg, end, cbeg, cend, comment_mode, comment_do, checkRx, cdef) abort Tlibtrace 'tcomment', a:beg, a:end, a:cbeg, a:cend, a:comment_do, a:checkRx, a:cdef - let indentStr = repeat(' ', a:cbeg) let t = @t let sel_save = &selection set selection=exclusive @@ -874,9 +873,13 @@ function! s:CommentBlock(beg, end, cbeg, cend, comment_mode, comment_do, checkRx endif endif else + let indentStr = repeat(' ', a:cbeg) + if &expandtab == 0 + let indentStr = substitute(indentStr, repeat(' ', &tabstop), '\t', 'g') + endif let cs = indentStr . substitute(cs, '%\@