Skip to content

Handle arbitrary delimiters with cs and ds - #107

Merged
tpope merged 1 commit into
tpope:masterfrom
DanielleSucher:support-arbitrary-delimiters
Sep 9, 2013
Merged

tpope merged 1 commit into
tpope:masterfrom
DanielleSucher:support-arbitrary-delimiters

Conversation

@DanielleSucher

Copy link
Copy Markdown
Contributor

Resolves #105 by adding flexibility such that cs/ds can change/remove any arbitrary surrounding character, rather than just the usual text object delimiters and html tags &c.

@tpope

tpope commented Sep 6, 2013

Copy link
Copy Markdown
Owner

That's ... simpler than I expected. Nice.

Can you switch it so this only takes effect for punctuation (minus the exceptions you already found)? That way custom text objects should still work, in theory. The magic regex incantation is [[:punct:]]. Thanks!

@DanielleSucher

Copy link
Copy Markdown
Contributor Author

Thank you!

And sure, no prob - I'll amend my commit in just a moment.

@chriskaukis

Copy link
Copy Markdown

Will this handle pound signs? For example, ColdFusion: #variable_name#

Currently, if I add a surround (in visual mode also), it adds a comment tag instead: <!--- variable_name --->

I haven't looked exactly why though yet.

@DanielleSucher

Copy link
Copy Markdown
Contributor Author

Yes, it handles pound signs.

@tpope

tpope commented Sep 6, 2013

Copy link
Copy Markdown
Owner

Latest commit actually ignores alphanumerics entirely. You'll need something like char =~# '[[:punct:]]' && char !~# '[][(){}<>]' for your logic and then restore the original else.

@tpope

tpope commented Sep 6, 2013

Copy link
Copy Markdown
Owner

@chriskaukis that's ragtag.vim shenanigans. I didn't have this use case in mind when I chose # to mean comment.

@DanielleSucher

Copy link
Copy Markdown
Contributor Author

Ah, I misread your earlier comment and thought that you wanted alphanumerics to be ignored, so that was intentional. Gotcha, just a moment.

@DanielleSucher

Copy link
Copy Markdown
Contributor Author

Is this more what you're looking for?

@chriskaukis

Copy link
Copy Markdown

@tpope Thanks, forgot I had that installed. I don't even think I need it or use it. Seems to work after removing it for now. Thanks!

tpope added a commit that referenced this pull request Sep 9, 2013
@tpope
tpope merged commit 9bf527a into tpope:master Sep 9, 2013
@chiphogg

Copy link
Copy Markdown

Can I just say: this is awesome.

I've been wishing for this for years (but too lazy to actually do anything about it, naturally). Thanks!!

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

Successfully merging this pull request may close these issues.

Cannot change surrounding when it is '_' (underscore)

4 participants