I often want to surround a div tag with another div tag. https://github.com/tpope/vim-surround is a real help there.
|<div>
...
</div>
if the cursor is at | and I typeysat<div> I get
<div><div>
...
</div><div>
instead I want
<div>
<div>
...
</div>
</div>
how can I force the div to be on a new line?
:help atsays:The low-level mechanism used by Surround for its
yscustom operator consumes the given motion as a visual selection, the type of which is then used by the plugin to decide what to do. In this case, Surround gets a characterwise motion which makes it operate in a characterwise fashion.In order to achieve your goal, you will need to force a linewise motion by adding a
Vbetween the operator (ys) and the motion (at):See
:help forced-motion: