wincent / scalpel

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

Edit all in scope #6

Open Crazor opened 7 years ago

Crazor commented 7 years ago

A nice feature would be a function akin to Xcode's "Edit all in scope". It basically allows you to rename a local variable throughout a function.

wincent commented 7 years ago

This would be a neat feature but probably requires a level of context-sensitive (language-aware) intelligence that Scalpel doesn't (and isn't likely to) posses.

Still if somebody wanted to take a stab at implementing it I'd be open to the idea. Thanks for the suggestion. Will add some appropriate labels.

Crazor commented 7 years ago

Well, at least Vim knows about methods, right? I can navigate sources with { and }. So maybe not a semantically perfect version like Xcode has, but one limited to the text object that { and } refer to?

wincent commented 7 years ago

{ and } are just jumping to the previous/next blank line, so not super sophisticated. Any "knowledge" of the code structure that Vim has is actually in the runtime files (language-specific ftplugins and syntax). I also know of some plugins that define some kind of "syntax-aware" text objects (these are probably built using pretty crude heuristics though). So there is something in there for a motivated individual to dig into, I think.