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

Uncommenting does not work when left delimiter starts with backslash #498

Open
nano-o opened this issue Sep 11, 2022 · 7 comments
Open

Uncommenting does not work when left delimiter starts with backslash #498

nano-o opened this issue Sep 11, 2022 · 7 comments

Comments

@nano-o
Copy link
Contributor

nano-o commented Sep 11, 2022

Uncommenting lines starting with \* does not work in tla files with the following configuration:

let g:NERDCustomDelimiters = { 'tla': { 'left': '\\*', 'leftAlt': '(*', 'rightAlt': '*)' } }
@alerque
Copy link
Member

alerque commented Sep 12, 2022

What happens — is this something about backslash escaping that isn't working right?

@nano-o
Copy link
Contributor Author

nano-o commented Sep 12, 2022

The uncommenting command just doesn't do anything.
To reproduce, set g:NERDCustomDelimiters = { 'tla': { 'left': '\\*', 'leftAlt': '(*', 'rightAlt': '*)' } }
Then create a file myfile.tla with contents:

\* this is a comment

Set filetype to tla.
Now try the uncommenting command. It does not work.

@alerque
Copy link
Member

alerque commented Sep 12, 2022

let g:NERDCustomDelimiters = { 'tla': { 'left': '\\*', 'leftAlt': '(*', 'rightAlt': '*)' } }

Using this (which as of your PR #497 is merged so you don't need to add it to your configs, just update your plugins) produces a commented line prefixed with \\* not \* as in your example file. Of course it won't reverse. It works for me to uncomment the lines it comments. Did you use the wrong comment string or mistake when escaping backslashes are needed?

@nano-o
Copy link
Contributor Author

nano-o commented Sep 12, 2022

Okay that's strange. I removed the line above from my config and update the plugin. The commenting command <Leader>c<space> produces \* and not \\*. But you're right that if I start a line with \\* then uncommenting works. I'm using neovim btw; is that the problem?

@nano-o
Copy link
Contributor Author

nano-o commented Sep 12, 2022

Well, I get the same behavior in vim.
If I start with

this is a comment

and hit <Leader>c<space>, I get

\* this is a comment

Hitting <Leader>c<space> again I get

\* \* this is a comment

If I start with

\\* this is a comment

and hit <Leader>c<space>, I get

this is a comment

@alerque
Copy link
Member

alerque commented Sep 12, 2022

I'm in Neovim too. <Leader>c<Space> only toggles \\* prefixes for me, using the current state of this plugin with no modifications.

@nano-o
Copy link
Contributor Author

nano-o commented Sep 12, 2022

Okay, maybe it's something platform specific. I just tried in a fresh Ubuntu jammy docker image with a fresh vim install where the only thing I did is install nerdcommenter with vimplug. I get the behavior I described above.

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

2 participants