I've recently refactored
vim-colors-solarized and I've stumbled on a code like this
let s:foo = s:bar " used in multiple places " ... many lines let s:goo = s:boo " used in multiple places
How can I inline all usages of such variables automatically easily. Of course I can write a function to do that. But maybe something like
g/let s:."=\s*s:.*/normal dw"adWdW"vdW" | exe "g/@v/s/@a/@v/g" | d in which I mean find all lines matching a pattern, yank variable name to be inlined into register
a it's value into register
v. Then inside of this global command execute another global command on all lines after the match substituting variable with its value and removing initially matched line.