terrortylor / nvim-comment

A comment toggler for Neovim, written in Lua
MIT License
479 stars 23 forks source link

Comments with no indent are not toggled #4

Closed ghost closed 3 years ago

ghost commented 3 years ago

Anything with a comment that has no indent is not toggled, like this for example:

--local test = 0

Actual:

-- --local test = 0

Expected:

local test = 0

This also happens with any language with a comment that has no indent.

terrortylor commented 3 years ago

I'm unable to replicate this issue, can you see if it still persists when you are using latest commit and you load a file with: vi -u NONE <SOME FILE GOES HERE> -c "packadd nvim-comment | lua require('nvim_comment').setup()" Note that this assumes that you plugin is in the 'opt' directory and usings vim's default package manager stucture.

ghost commented 3 years ago

Yep, it still happens.

terrortylor commented 3 years ago

Oh couldn't see the wood for the trees! It assumes there is a space between the space and the rest of the line. If you don't have the padding them there is a setting you can use to not use the padding.

require('nvim_comment').setup({marker_padding = false })

On Fri, 12 Feb 2021, 15:02 Loaf of Bread, notifications@github.com wrote:

Yep, it still happens.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/terrortylor/nvim-comment/issues/4#issuecomment-778247231, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAJEXTKJHDMHFNBUVSDZO63S6U7I5ANCNFSM4XO64D6Q .

ghost commented 3 years ago

Oh that makes sense now, thanks!

SaraSmiseth commented 3 years ago

I have the same issue. Setting marker_padding to false does not solve it for me because I actually want the space between marker and comment.

Toggling the following two comments

--local test = 0
-- local test = 0

should uncomment both:

local test = 0
local test = 0

And toggling again should give me:

-- local test = 0
-- local test = 0

Is this somehow possible?

tkkcc commented 3 years ago

same issue as @SaraSmiseth, kommentary and vim-commentary does it correct.