vim-surround icon indicating copy to clipboard operation
vim-surround copied to clipboard

Repeating cst<c-t>div<cr>

Open sassanh opened this issue 9 years ago • 3 comments

Thanks for this super helpful extension, it really improves my productivity by an order. Though there's this minor issue I found:

Suppose that I have these lines of html code:

<div || class="some-class">text</div>
<div class="some-class">text</div>

double pipe indicates my cursor position, if I press cst<c-t>div<cr> (without double quotes) it changes to:

<div class="some-class">
    text
</div>
<div || class="some-class">text</div>

and if I change cursor position to double pipe and hit dot key, it'll change to:

<div class="some-class">
    text
</div>
<div>
    text
</div>

Removing the class (or any other html tag attribute) like I had > instead of <cr> in my command. Is there any workaround for this?

sassanh avatar Jan 25 '16 00:01 sassanh

More generally, no tag replacement works with repeat

█tr class="myclass">a</tr>
<tr class="myclass">b</tr>
<tr class="myclass">c</tr>

When I hit csttspan↵j.j., I get

<span class="myclass">a</span>
<span>b</span>
█span>c</span>

vojtechpachol avatar Apr 07 '17 09:04 vojtechpachol

I've noticed this, as well. I was going to file a bug. Glad I found this.

I got around it using a macro with the extended functionality of % in addition to markers.

Would be nice if this worked, though.

dylnmc avatar Jun 29 '17 18:06 dylnmc

@dylnmc Could you elaborate on your solution? This bug still exists and is quite annoying. (Repeating cst discards all attributes of the tag you use the repeat on.)

rluba avatar Feb 19 '21 10:02 rluba