______________________________________________________________________
Hey Ted,
No. Based on recent changes I have to think this feature is bouncing around in the back of Rich's brain though. :)
That sort of refactoring has been commonly available in various IDEs and programming editors for a long time and is bloody useful, so I hope it makes its way into BBEdit sometime soon.
In the meantime it's possible to do this in a less organic fashion with AppleScript.
Select the word.
Hit a keyboard shortcut.
Popup a dialog.
Enter a string.
Hit the OK button.
All instances in the document are updated.
Selection is restored to the original instance.
This is most easily done on a whole word basis, but strings that begin words, end words, and are within words could be managed with some clever scripting.
Here is a very basic example.
I've used word boundaries in the regex, so currently this will only work on a string that has clear boundaries at beginning and end.
-------------------------------------------------------------------------------------------
# Auth: Christopher Stone
# dCre: 2016/07/13 13:30
# dMod: 2016/07/13 14:06
# Appl: BBEdit
# Task: Refactor selection in front BBEdit text document.
# Libs: None
# Osax: None
# Tags: @Applescript, @Script, @BBEdit, @Refactor, @Text
-------------------------------------------------------------------------------------------
tell application "BBEdit"
tell front text document's window
set selectedText to contents of selection
set regexPattern to "\\b" &
selectedText &
"\\b" set replacementWord to getReplacementWord(selectedText) of me
replace regexPattern using replacementWord options {search mode:grep, case sensitive:false, starting at top:true}
end tell
end tell
-------------------------------------------------------------------------------------------
--» HANDLERS
-------------------------------------------------------------------------------------------
on getReplacementWord(defaultText)
set replacementWord to text returned of (display dialog "Type your replacement text:" default answer defaultText with title "Refactor")
return replacementWord
end getReplacementWord
-------------------------------------------------------------------------------------------