kylechui / nvim-surround

Add/change/delete surrounding delimiter pairs with ease. Written with :heart: in Lua.
MIT License
2.92k stars 60 forks source link

Respect visual range on change surrounding pair #277

Closed afonsocarlos closed 7 months ago

afonsocarlos commented 8 months ago

Checklist

Is your feature request related to a problem? Please describe. Changing surrounding pairs inside a visual range performs changes outside of the range. I think changes should stick within the range. Example issue:

const names = [
   |'Jane',
    "John",
    "Mario",
    "Mary",
];

const roles = [
    "admin",
    "client",
    "maintainer",
];

Selecting within braces in array names: vi[ Then changing items inside array: :'<,'>norm cs"' Actually changes all quotes from names and one from roles (because the first item in names doesn't match the cs"')

Describe the solution you'd like I think the change actions should be performed only inside the '<,'> range if it's provided.

kylechui commented 7 months ago

Hey there, I wasn't able to replicate this on my system. By default the a" text object only "searches" on the current line for a surrounding pair; do you have targets.vim or mini.ai (or similar) installed?

afonsocarlos commented 7 months ago

Hi, thank you for your reply. Hmmm yes, I have targets.vim installed and it seems that's what's causing the problem! Removing it solved the issue :sweat_smile: thanks a lot for the help. I'll close the issue.