On 2023-04-18 07:29, 'Devin Weaver' via vim_use wrote:
> leads me to wonder what are the "vim --clean" ways to perform the
> same actions that vim-surround offers.
vim-surround offers a number of features, some easier to replicate,
others more challenging.
I commonly use
c<motion/object>'<c-r>"'<esc>
to wrap <motion/object> in quotes, using control+r followed by
double-quote to enter the text of the most recent deletion/yank.
It's not repeatable with "." (well, it is, but it repeats the
original replacement, not with the second text). However you can
record a macro if you need to redo that. I can do the same sort
of thing if I'm using tags, things like
caw<a href="#target"><c-r>"</a><esc>
to wrap the current link in an HTML <a> element.
For large numbers of changes, I tend to switch to using :g or :s
commands
:g/pattern/-pu='<p>'|+pu='</p>'
:%s@pattern@<a href="#target">&</a>@g
rather than trying to do one and then "."-repeat subsequent ones.
-tim