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
--
--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php
---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/vim_use/ZD6264ioV0s2XZFJ%40thechases.com.
Tuesday, April 18, 2023
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment