Editing multiple words on the same line at the same time with textmate
I know about using alt/op开发者_开发百科tion and the 'Edit each line in selection' tools in Textmate to edit multiple lines at the same time. What I'm wondering now is if there's a way to edit multiple words in a selection or single line. Here's an example
a, b, c -> self.a, self.b, self.c
Select a, b, c
, magic command, type self.
and get self.a, self.b, self.c
Even better if this could work on multiple lines
a, b, c, self.a, self.b, self.c,
d, e, f -> self.d, self.e, self.f
Is there such a thing in Textmate?
Here, I created a bundle for you: https://github.com/kizu/EditEachWord.tmbundle
There I created two simple commands which allow you to can insert something before or after all words in a line or a selection.
Actually, it's rather simple to create your own commands that would insert a custom generated snippets with multiple tabstops, so you could do a lot of things with them.
Also, if you'd want to edit multiple parts, you can try my other bundle: https://github.com/kizu/Hayaku.tmbundle with two features: multiple carets and inline replaces.
Enjoy!
精彩评论