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

Double space delimiter for some languages with g:NERDSpaceDelims=1 #278

Open
namedots opened this issue Dec 31, 2016 · 6 comments
Open

Double space delimiter for some languages with g:NERDSpaceDelims=1 #278

namedots opened this issue Dec 31, 2016 · 6 comments

Comments

@namedots
Copy link

namedots commented Dec 31, 2016

Python and a few others with a space in the comment string end up having two spaces when setting
let g:NERDSpaceDelims=1

I don't agree with having spaces in the Python comment, because someone with g:NERDSpaceDelims=0 would rightly expect not to get an extra space. So I would suggest removing it, but I see that there are those who want it to be there. They're of course wrong, but they're gonna think the same of me and so my other suggestion is:

That g:NERDSpaceDelims=1 doesn't add an extra space when there already is one, that the interpretation of this option is to ensure that there is a trailing space, rather than adding one.

This allows for having a default trailing space for languages like Python where style guides recommend having a space without introducing double spacing for those who prefer to always have a trailing space which is what g:NERDSpaceDelims accommodates

Those who want double spaces could change the comment string to have two spaces, and these would need to adjust their settings, the rest wouldn't.

@alerque
Copy link
Member

alerque commented Dec 31, 2016

This sounds like a much simpler approach and a great tide over until such a time as somebody takes a stab at all the python related problems.

I would be willing to review and merge any contributions to this effect.

Obirvalger added a commit to Obirvalger/nerdcommenter that referenced this issue Aug 19, 2017
@guyhughes
Copy link

guyhughes commented Sep 14, 2017

temporary lazy workaround:

" vim 8 / neovim HEAD runtime: when ft==python, cms:=#\ %s
"   -- when g:NERDSpaceDelims==1, then NERDComment results in double space
let g:NERDCustomDelimiters = {
      \ 'python': { 'left': '#', 'right': '' }
      \ }

@alerque
Copy link
Member

alerque commented Oct 31, 2017

For reference, the other open issue on this topic is #202 which suggests a more exhaustive fix. I'd be willing to accept contributions which either implement the partial fix discussed here or the more complete one there. Note that end users can hack around this according to their won preference as mention by @guyhughes, but I won't be accepting that change to the plugin itself because it breaks to many existing users's configurations out of the box. Thanks for understanding.

@laixintao
Copy link

@alerque I still have the problem with python file.

@im-n1
Copy link

im-n1 commented Apr 26, 2020

This problem still persists (Python).

@alerque
Copy link
Member

alerque commented Apr 27, 2020

That's why this issue is still open @im-n1 and @laixintao. We will close this issue when it is fixed, but so far nobody has stepped up to actually contribute a proper fix. Note there are two different workarounds in these related issue comments, but neither is something we can integrate into the plugin without breaking other scenarios. We'd be happy to accept a PR that deals with this properly (ala #421).

huyu398 added a commit to huyu398/nvim that referenced this issue Jun 23, 2022
追加の設定で暫定的に回避できるが、Issue は Open なままなので根本的には直っていない
preservim/nerdcommenter#278
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

5 participants