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

html tags with elements are too "sticky" #168

Open
jplindstrom opened this issue Aug 13, 2020 · 3 comments
Open

html tags with elements are too "sticky" #168

jplindstrom opened this issue Aug 13, 2020 · 3 comments

Comments

@jplindstrom
Copy link

jplindstrom commented Aug 13, 2020

Let's say I have this HTML:

some kind of <a href="a">link</a> somewhere

If I do delete surronding tag dst inside "link" to delete the <a> element, that works.

If I now visually select "somewhere" and do st to surround with a tag, and enter "<span", the attributes are remembered and used for the new elemen tag:

some kind of link <span href="a">somewhere</span>

This happens agan if I surround something else. If I add some extra attributes in my new tag, they are added along with the remembered attributes.

Maybe it's related to using e.g. "cst t span" to chang the existing tag to another tag and have the attributes remain (which does sound like a feature, not a bug :) ).

@ninrod
Copy link
Member

ninrod commented Aug 13, 2020

@jplindstrom , I like this feature, to be honest.

Allow me to place a shamless plug here and recommend Exato.el (Evil XML/HTML Attributes Text Object), which allows you to work attributes of html tags as vim objects. It's pretty neat and should help you in a bunch of cases. The source code is here: https://github.com/ninrod/exato.

I'll keep this issue open in case another user wants to chime in with a different opinion.

@jplindstrom
Copy link
Author

The way things actually work here doesn't look like it is an intended feature.

If it were a feature, there would be a simple way to not include the attributes, e.g. by adding space after the tag name.

If it were a feature, when you do specify new attributes for a tag, those attributes would override the remembered ones, and would in turn become the remembered attributes to use in the future.

@ninrod
Copy link
Member

ninrod commented Aug 13, 2020

@jplindstrom , I agree with you.

Maybe this behaviour could be "selected" through a specific configuration.

The default should be that tag elements are not sticky.

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

2 participants