tyru / caw.vim

Vim comment plugin: supported operator/non-operator mappings, repeatable by dot-command, 300+ filetypes
378 stars 48 forks source link

Can't uncomment a wrapped portion of a line #26

Closed bounceme closed 4 years ago

bounceme commented 9 years ago

The plugin can wrap some of a line from visual mode but can't uncomment it.

tyru commented 9 years ago

Please give me more details.

bounceme commented 9 years ago

When you make a wrapped comment using a visual selection that isn't a full line,or is several lines where there is some unincluded text at either end,you can't unwrap that comment it seems. I've tried with both the gcuw and the gcuu maps in both visual and normal modes.

tyru commented 8 years ago

@bounceme I can't reproduce this. Please tell me the followings.

  1. &filetype while making a wrapped comment
  2. example source code
  3. steps to reproduce
tyru commented 8 years ago

And sorry for delay to reply... ;(

tyru commented 8 years ago

I tried to reproduce in filetype=c.

Code

    /* printf("hello\n"); */
    printf("hello\n");

Steps to reproduce

  1. Select above 2 lines using V command.
  2. Type gcuw

Above steps change current buffer like below

    printf("hello\n");
    printf("hello\n");
tyru commented 8 years ago

the gcuu maps

Hm, what keymapping do you mean? caw.vim doesn't provide such default keymapping.

bounceme commented 8 years ago

Hey, thanks for getting to this issue. you can use visual mode to select just the word "hello", then press "gcw" which comments out the selected word. The issue is that using any keycap from this plugin won't uncomment that word in the middle of the line.I don't really find this to be a very important problem though

tyru commented 8 years ago

Okay, now I understand. I will implement gcuw in a wrapped portion of a line.

gcw (comment) currently working

[...] is selected range.

int one_or_two = 1;
if (one_or_two == 1) {
} else [if (one_or_two == 2)] {

to

int one_or_two = 1;
if (one_or_two == 1) {
} else /* if (one_or_two == 2) */ {

gcuw (uncomment) currently not working

In wrap comment and while normal-mode:

} else /* if (one_or_two == 2) */ {

to

} else if (one_or_two == 2) {
tyru commented 4 years ago

Concise example (from #84)

Expected

Typing <Plug>(caw:wrap:uncomment) in comment string

int i = /* 1 ? 2 : */ 0;

results in

int i = 1 ? 2 : 0;

Got

Typing <Plug>(caw:wrap:uncomment) in comment string does not change anything.

int i = /* 1 ? 2 : */ 0;
tyru commented 4 years ago

Fixed in #118