On 3 Jan 2018, at 4:34, Tuk Bredsdorff wrote:
is there a quick way to transform for instance
[Role, User, UserRole, SourceAddress, BulkMessage, Message,
SingleSMSTemplate, Company, Contact]
(In this case it's Python but it could be more or less any language.)
I do this so often manually, there must be a better way?
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.