wincent / scalpel

🔪 Fast within-file word replacement for Vim
MIT License
118 stars 4 forks source link

Escape '$' when launching Scalpel #11

Closed kengkiat closed 4 years ago

kengkiat commented 4 years ago

Fixes #10

I've decided to only escape $ as I can't think of any other special characters where this is useful. However, this can easily expanded to include other characters.

wincent commented 4 years ago

With something like this we have a few ways to do it:

I almost never want to do the first option, in case there's some use case I haven't thought about; I don't want to risk breaking somebody's usage scenario.

I think my preference here is basically in the order of the list above (from least to most preferred):

  1. Change it for everybody.
  2. Make it optional (off by default).
  3. Make it optional (on by default).
  4. Make it configurable.
  5. Make it "smart".

The only risk is that sometimes "smart" things end up being dumb. 😂 Any thoughts on this?

wincent commented 4 years ago

Ok, thinking about it, it seems that we can just blanket-escape anything that might have special meaning for /\v. I don't think there is risk of this breaking anybody's workflow, and I don't think we need to try and be "smart" and vary the behavior based on what's in 'iskeyword'.

Thanks for the PR!

kengkiat commented 4 years ago

Sorry for the late response. I think it make sense to make it configurable (but with sensible defaults). Will probably submit another PR when I have the time.

kengkiat commented 4 years ago

Nvm... I see that it's done :)