preservim / nerdcommenter

Vim plugin for intensely nerdy commenting powers
Creative Commons Zero v1.0 Universal
4.97k stars 447 forks source link

[Bug] Add left delim comment before leading space #495

Open Masquue opened 2 years ago

Masquue commented 2 years ago

Add a new option NERDCommentBeforeLeadingWhitespace or something to allow behavior of AddLeftDelim to be changed to

function! s:AddLeftDelim(delim, theLine) abort
  return substitute(a:theLine, '^\(\s*\)', a:delim . '\1' , '')
endfunction
This behavior can be achieved by setting existing option `g:NERDDefaultAlign` to `'start'` (which is `'none'` by default), and this option is used in all formatting commands except `\cl` (AlignLeft) and `\cb` (AlighBoth). Is it a bug or design that using `\cl` or `\cb` does not respect the setting of `g:NERDDefaultAlign` when it is `'start'`?