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

let g:NERDDefaultAlign = 'left' , does not comment at start of line #467

Open
HariSekhon opened this issue Apr 19, 2021 · 4 comments
Open

Comments

@HariSekhon
Copy link

HariSekhon commented Apr 19, 2021

If I've read the docs correctly,

let g:NERDDefaultAlign = 'left'

should result in NerdCommenter adding the comment to the start of the line instead of the indented position just before the first non-whitespace character.

However, testing this it doesn't seem to change the default behaviour and still adds comments indented instead of at the start of the line.

@kqvanity
Copy link

it seems that only cs is the only keybinding to activate that sort of commenting format , the aforementioned option didn't work out for me too .

@HariSekhon
Copy link
Author

it seems that only cs is the only keybinding to activate that sort of commenting format , the aforementioned option didn't work out for me too .

cs?

@jorge-precich
Copy link

it seems that only cs is the only keybinding to activate that sort of commenting format , the aforementioned option didn't work out for me too .

cs?

From :h NERDCommenterSexy

3.2.6 Sexy comment map                                     *NERDCommenterSexy*

Default mapping: [count]|<Leader>|cs
Mapped to: <plug>NERDCommenterSexy
Applicable modes: normal, visual-line.

Comments the selected line(s) ``sexily''. See |NERDCommenterSexyComments| for
a description of what sexy comments are. Can only be done on filetypes for
which there is at least one set of multipart comment delimiters specified.

Sexy comments cannot be nested and lines inside a sexy comment cannot be
commented again.

If a [count] is given in normal mode, the mapping works as though that many
lines were selected in visual-line mode.

Related options:
|'NERDCompactSexyComs'|

@Maxattax97
Copy link

I stumbled across this when I became frustrated that NERDCommenter was butchering my YAML for when I'd have to uncomment it later. I agree the documentation is confusing.

With the default setting (none), if you perform a visual select of your text and block comment, this will occur:

talos05:
  vars:
    service_replica_set_kubeconfig: "{{ config_path }}/fdk001_k8s_talos_05_config.config"
  # hosts:
    # agg01_cuup:
      # service_replica_set_namespace: ran
      # service_replica_set_app_name: cu-up
    # agg01_cucp:
      # service_replica_set_namespace: ran
      # service_replica_set_app_name: cu-cp

I hated this option, because when I went to save, the file auto-formatted and destroyed all the indentation...

But if you instead set let g:NERDDefaultAlign = 'left', this happens:

talos05:
  vars:
    service_replica_set_kubeconfig: "{{ config_path }}/fdk001_k8s_talos_05_config.config"
  # hosts:
  #   agg01_cuup:
  #     service_replica_set_namespace: ran
  #     service_replica_set_app_name: cu-up
  #   agg01_cucp:
  #     service_replica_set_namespace: ran
  #     service_replica_set_app_name: cu-cp

which in my case was did preserve indentation when auto-formatting.

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

4 participants