Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Feature Request] Add in place commenting option #496

Open
Masquue opened this issue Jul 24, 2022 · 0 comments
Open

[Feature Request] Add in place commenting option #496

Masquue opened this issue Jul 24, 2022 · 0 comments

Comments

@Masquue
Copy link

Masquue commented Jul 24, 2022

Add a new option NERDInplaceComment or something to enable reusing the space of existing leading whitespace for left delim, e.g:

def f():
  print('foo')
  print('bar')

to be commented as:

def f():
# print('foo')
  print('bar')

This feature preserves the original indentation in code, making them much clear especially for language such as python, which uses indentation to indicate block structure. (This is also the behavior of <C-/> in VS Code and other editors alike)

Something to note:

  1. this option may require or override or collaborate with NERDCommentBeforeLeadingWhitespace in [Bug] Add left delim comment before leading space #495
  2. if there is not enough leading whitespace, insert as many as required (possible extra space)
  3. What's the behavior if some of the lines to formatted has enough leading whitespaces and some don't? I'm in favor of reverting back to the original insert comment mode thus all indentations within the commented lines don't change, e.g.
    # reverting
    # def f():
    #   print('foo')
    #   print('bar')
    instead of
    # still replacing for print lines
    # def f():
    # print('foo')
    # print('bar')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant