Every time I need to create a list of strings in python or another language with similar list syntax (and they more or less the same everywhere) I have to do the following.
# resulting expression a = ('word1', 'word2', 'word3') #cursor is between the parenthesis a = (|)
'word1<ESC>a, etc for each word. I don't have to type single quote twice, because I'm using delimitmate, but I have to use esc to move cursor out of the quotes.
There is a better way to do it.
What if I would type
a = (word1 word2 word3)
instead and then use regex to surround all words inside parens with quotes and add comma after that? This would save me 3 key strokes for each word if I would remap this to some key. The problem is I don't know how to do this replacement via regex. So the best I've got so far is
The dots in the end is because I need to replace it with backreference in substitute, but I don't know how to do that.