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

fix: correct logic for switching alt delimiters #536

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

carlostobon
Copy link

  • Fixed a problem where toggling delimiters was not working due to copy statement.
  • Confirmed that toggling works correctly across different buffers.

- Fixed a problem where toggling delimiters was not working due to copy statement.
- Confirmed that toggling works correctly across different buffers.
@alerque
Copy link
Member

alerque commented Aug 22, 2024

This is a direct revert of fea637c from #531 by @svalaskevicius. There must me something one or both of you are not testing because it can't be right both ways. What versions of VIM are you using to test with?

@carlostobon
Copy link
Author

Yeah it's essentially a revert of. Running archlinux with binary from the pkg manager and current version VIM - Vi IMproved 9.1 (2024 Jan 02, compiled Aug 11 2024 20:40:17). Im probably doing something wrong but certainly that line is causing the bug.

@alerque
Copy link
Member

alerque commented Aug 22, 2024

It looks like a pretty safe bet that @svalaskevicius is running NeoVIM based on his dotfiles:

https://github.com/svalaskevicius/dotfiles/blob/master/.config/nvim/conf/plugins.vim#L25

That might have something to do with why you're coming to opposite conclusions. I don't think we should just revert either way or even just gate it on VIM vs. NeoVIM, there is probably an actually right way to do this that works properly in both environments. That's what we should go for.

@carlostobon
Copy link
Author

Completely agree with you. Thanks for your time.

@alerque alerque reopened this Aug 22, 2024
@alerque
Copy link
Member

alerque commented Aug 22, 2024

(Personally I'd prefer to keep this open to track the known problem until we find a fix, the "closed" label doesn't encourage participation or responses which we kind of need here to sort this out.)

@carlostobon
Copy link
Author

Sounds perfect!

@anthdono
Copy link

Confirming commit 3f860f2 breaks alternate delims in the latest Neovim nightly as of writing, however it is working fine in Vim 9.1.

I agree with @alerque, as this is a Vim library, it may not be appropriate to revert the change due to behaviour in Neovim, albeit a nuisance.

I'll try find some time to investigate a solution for #531 that works for both Vim and Neovim.

@anthdono
Copy link

anthdono commented Aug 27, 2024

I am incorrect, it looks like 3f860f2 breaks alternate delims in Vim too. Just re-tested on Vim 9.1.650 with react typescript, minimal config for reproduction below:

nmap <leader>/ <Plug>NERDCommenterToggle
vmap <leader>/ <Plug>NERDCommenterToggle
let g:NERDSpaceDelims = 1
let g:NERDDefaultAlign = 'left'
let g:NERDCommentEmptyLines = 1
let g:NERDCustomDelimiters = {
\   'typescript': { 'left': '//', 'leftAlt': '/**', 'rightAlt': '*/' },
\   'typescriptreact': { 'left': '//', 'leftAlt': '{/*', 'rightAlt': '*/}' },
\   'javascript': { 'left': '//', 'leftAlt': '{/*', 'rightAlt': '*/}' },
\   'kotlin': { 'left': '//', 'leftAlt': '/*', 'rightAlt': '*/' }
\ }

Reverting 3f860f2 fixes the issue, this commit should be merged.

@GDivino
Copy link

GDivino commented Oct 30, 2024

+1 on merging this PR, the toggling of alternative delimiters stopped working for me as well. Would be really nice to have this fix ASAP :)

@scottchiefbaker
Copy link

I like my comments in C/C++ to be // so I use alternate delimiters. I'm also a frequent user of NERDCommenterToggle. When I toggle in a C file the first time it uses // and then every time after that it uses /* ... */. Applying this pull-request to the nerdcommenter code solves this problem for me.

This gets a +1 to merge from me.

I'm running Vim 8.0.1763 on Linux.

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.

5 participants