I would like to change the text below
[One]
,[Two]
,[Three]
(there are tab characters at the start of each line)
into
[One] = @One
,[Two] = @Two
,[Three] = @Three
Where for each line the text within the square brackets is copied to the right after an equals sign and an @ symbol is prepended to the text
This is as far as I've got but unsure how to modify it to ignore the tabs and commas and then extract the text within the square brackets
:%s/.*/& = &
I think in your example you meant @One
instead of @one
. Try this:
:%s/\[\(.*\)\]/& = @\1