Skip to content

Enclose the current line with tags

David-Apps edited this page Apr 30, 2022 · 4 revisions

Pass this function an element name and, optionally, some attributes. The function puts the opening tag for the element (with its attributes) at the start of the current line and the closing tag for the element at the end of the current line.

# Enclose the current line with tags.
# usage: <tag element [attributes]
function+tag {
s/.*/<~0>&<\/~1>/f
}