Skip to content

feat: Explicitly set marker for sexy comments#546

Open
albfan wants to merge 1 commit into
preservim:masterfrom
albfan:marker
Open

feat: Explicitly set marker for sexy comments#546
albfan wants to merge 1 commit into
preservim:masterfrom
albfan:marker

Conversation

@albfan
Copy link
Copy Markdown

@albfan albfan commented Dec 1, 2025

Instead of extract the marker from last char of longest left comment allow to explicity set it

relates with #329

Instead of extract the marker from last char of longest left comment
allow to explicity set it
@albfan albfan mentioned this pull request Dec 1, 2025
@albfan
Copy link
Copy Markdown
Author

albfan commented Dec 1, 2025

to turn:

  <metadata>
    <property name="variant">dark</property>
    <property name="light-variant">Adwaita</property>
  </metadata>

into

  <!-- <metadata>
    <property name="variant">dark</property>
    <property name="light-variant">Adwaita</property>
  </metadata> -->

instead of

  <!-- <metadata>
  -   <property name="variant">dark</property>
  -   <property name="light-variant">Adwaita</property>
  - </metadata> -->

using:

let g:NERDCustomDelimiters = {
        \ 'xml':  { 'left': '<!--', 'right': '-->', 'marker': '', 'nested': 1 }
    \ }

@albfan
Copy link
Copy Markdown
Author

albfan commented Dec 1, 2025

NOTE1: 'nested' is required to avoid an error:

        call s:NerdEcho('Sexy comment aborted. Nested sexy cannot be nested', 0)

NOTE2:
Expectation was to only need to set:

let g:NERDCustomDelimiters = {
        \ 'xml':  { 'marker': '' }
    \ }

But that doesn't do anything using .cs

@albfan albfan mentioned this pull request Dec 1, 2025
Copy link
Copy Markdown
Member

@alerque alerque left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Resolve case where marker is not set.


"if there is no hardcoded marker then we find one
if sexyComMarker ==# ''
if b:NERDSexyComMarkerSet == 0 && sexyComMarker ==# ''
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It doesn't look like this buffer value is getting set unconditionally, so this will error in the event it is not set ... no?

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

Successfully merging this pull request may close these issues.

2 participants