mirror of
https://github.com/preservim/nerdcommenter.git
synced 2025-02-01 10:49:45 +08:00
Add an option: NERDDisableTabsInBlockComm (#374)
* Add an option: NERDDisableTabsInBlockComm. 1 disables adding tabs before the comment symbols in the block style. * Add doc for the new option.
This commit is contained in:
parent
67950d4b5d
commit
17b68e47d7
|
@ -811,6 +811,30 @@ Default 0.
|
||||||
When this option is set to 1, NERDCommenterToggle will check all selected line,
|
When this option is set to 1, NERDCommenterToggle will check all selected line,
|
||||||
if there have oneline not be commented, then comment all lines.
|
if there have oneline not be commented, then comment all lines.
|
||||||
|
|
||||||
|
------------------------------------------------------------------------------
|
||||||
|
*'NERDDisableTabsInBlockComm'*
|
||||||
|
Values: 0 or 1.
|
||||||
|
Default 0.
|
||||||
|
|
||||||
|
When this option is set to 1, NERDDisableTabsInBlockComm will not add
|
||||||
|
whitespaces align the start location of the ending comment symbol with the
|
||||||
|
end location of the starting comment symbol. For example, in Fortran, the new
|
||||||
|
style will be as the following: >
|
||||||
|
close (inpt,iostat=ierr,iomsg=error_message)
|
||||||
|
call io_error(pname,input_fname,2,__LINE__,__FILE__,ierr,error_message)
|
||||||
|
<
|
||||||
|
to >
|
||||||
|
!===BEGIN===!
|
||||||
|
! close (inpt,iostat=ierr,iomsg=error_message)
|
||||||
|
! call io_error(pname,input_fname,2,__LINE__,__FILE__,ierr,error_message)
|
||||||
|
!===END===!
|
||||||
|
<
|
||||||
|
for the block comment style if customized comment symbols are set up in vimrc
|
||||||
|
file by the following line >
|
||||||
|
let g:NERDCustomDelimiters = {
|
||||||
|
\ 'fortran':{'left':'!','leftAlt':'!===BEGIN===!','rightAlt':'!===END===!'}
|
||||||
|
\ }
|
||||||
|
<
|
||||||
|
|
||||||
------------------------------------------------------------------------------
|
------------------------------------------------------------------------------
|
||||||
3.3 Default delimiter customisation *NERDComDefaultDelims*
|
3.3 Default delimiter customisation *NERDComDefaultDelims*
|
||||||
|
|
|
@ -66,6 +66,7 @@ call s:InitVariable("g:NERDSpaceDelims", 0)
|
||||||
call s:InitVariable("g:NERDDefaultAlign", "none")
|
call s:InitVariable("g:NERDDefaultAlign", "none")
|
||||||
call s:InitVariable("g:NERDTrimTrailingWhitespace", 0)
|
call s:InitVariable("g:NERDTrimTrailingWhitespace", 0)
|
||||||
call s:InitVariable("g:NERDToggleCheckAllLines", 0)
|
call s:InitVariable("g:NERDToggleCheckAllLines", 0)
|
||||||
|
call s:InitVariable("g:NERDDisableTabsInBlockComm", 0)
|
||||||
|
|
||||||
let s:NERDFileNameEscape="[]#*$%'\" ?`!&();<>\\"
|
let s:NERDFileNameEscape="[]#*$%'\" ?`!&();<>\\"
|
||||||
|
|
||||||
|
@ -997,7 +998,11 @@ function s:CommentLinesSexy(topline, bottomline)
|
||||||
" the lines down when we added the left delimiter
|
" the lines down when we added the left delimiter
|
||||||
call cursor(a:bottomline+1, 1)
|
call cursor(a:bottomline+1, 1)
|
||||||
execute 'normal! o'
|
execute 'normal! o'
|
||||||
let theLine = repeat(' ', leftAlignIndx) . repeat(' ', strlen(left)-strlen(sexyComMarker)) . right
|
if g:NERDDisableTabsInBlockComm
|
||||||
|
let theLine = repeat(' ', leftAlignIndx) . right
|
||||||
|
else
|
||||||
|
let theLine = repeat(' ', leftAlignIndx) . repeat(' ', strlen(left)-strlen(sexyComMarker)) . right
|
||||||
|
endif
|
||||||
|
|
||||||
" Make sure tabs are respected
|
" Make sure tabs are respected
|
||||||
if !&expandtab
|
if !&expandtab
|
||||||
|
@ -1023,7 +1028,11 @@ function s:CommentLinesSexy(topline, bottomline)
|
||||||
endif
|
endif
|
||||||
|
|
||||||
" add the sexyComMarker
|
" add the sexyComMarker
|
||||||
let theLine = repeat(' ', leftAlignIndx) . repeat(' ', strlen(left)-strlen(sexyComMarker)) . sexyComMarkerSpaced . strpart(theLine, leftAlignIndx)
|
if g:NERDDisableTabsInBlockComm
|
||||||
|
let theLine = repeat(' ', leftAlignIndx) . sexyComMarkerSpaced . strpart(theLine, leftAlignIndx)
|
||||||
|
else
|
||||||
|
let theLine = repeat(' ', leftAlignIndx) . repeat(' ', strlen(left)-strlen(sexyComMarker)) . sexyComMarkerSpaced . strpart(theLine, leftAlignIndx)
|
||||||
|
endif
|
||||||
|
|
||||||
if lineHasTabs
|
if lineHasTabs
|
||||||
let theLine = s:ConvertLeadingSpacesToTabs(theLine)
|
let theLine = s:ConvertLeadingSpacesToTabs(theLine)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user