vim-surround
vim-surround copied to clipboard
How to support multiple elements?
Thanks, the plugin is great.
I have a question about how to supoort multiple elements
like let g:surround_{char2nr("d")} = "<div\1id: \r..*\r id=\"&\"\1>\r</div>"
I tried to amend it let g:surround_{char2nr("d")} = "<div\1class: \r..*\r \2id: \r..*\r class=\"&\" id=\"&\"\1\2>\n \r\n</div>"
but it didn't work.
Any solutions?
In the original, \1
to \1
handles the id
attribute. Your attempt has \2
between the \1
s. You need this:
let g:surround_{char2nr("d")} = "<div\1id: \r..*\r id=\"&\"\1\2class: \r..*\r class=\"&\"\2>\r</div>"