Thursday, February 9, 2012

vim notes

Replace bracket indexing by member indexing.
:%s/variable\['\(\w\+\)'\]/variable.\1/gc
And more general:
:%s/\['\(\w\+\)'\]/.\1/gc
Change: "smth1 = smth2; " to "smth2: 'smth1',". :%s/\W*\(.*\) = \(.*\);/ \2: '\1',/gc

No comments:

Post a Comment