I do this a lot in Python as well. If there aren’t that many, I’ll just select the first Space and hit ⌃W repeatedly until I have them all, then hit ↩. This preserves indentation.
If you had string literals that might contain spaces, you could select something more unique, like “, “ or “', “ then hit ⌃W as before, but before hitting return, use the right arrow to deselect, then ⇧← to select just the Space before hitting ↩.
For longer lists, you can select what you want to replace, hit ⌘E to make that the search term, hit ⇧⌘L to select the entire line (to avoid messing with the rest of the file) then hit ⌥⌘F to select all occurrences of the search term on that line. From there, adjust the selection as needed and hit ↩ when ready.
Finally, be sure to go back and add a comma after the last item. Your diff output will thank you.
Thanks Rob, that was some really useful tricks I didn’t know! Allan never ceases to surprise me with the capabilities of TextMate ☺️ . Så cool with the repeated usage of ^W, I had know idea it could that. And ⌥⌘F to select all occurrences, I’m gonna remember that as well. That will do until I find or make a bundle command that automates it.
I’m also glad I found out the mailing list is so active.
And happy new year to everybody!
·t