vim-surround icon indicating copy to clipboard operation
vim-surround copied to clipboard

How to support multiple elements?

Open Elinpf opened this issue 6 years ago • 1 comments

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?

Elinpf avatar Jul 12 '18 08:07 Elinpf

In the original, \1 to \1 handles the id attribute. Your attempt has \2 between the \1s. You need this:

let g:surround_{char2nr("d")} = "<div\1id: \r..*\r id=\"&\"\1\2class: \r..*\r class=\"&\"\2>\r</div>"

graywh avatar Dec 17 '18 22:12 graywh