Saturday, September 4, 2021

Re: How to replace pattern with shell command's output using matched pattern

On 2021-09-04 14:07, Andreas Perstinger wrote:
> Alternatively, without using an external command:
>
> :%s_^\[\(\d\+\)_\="[" . strftime("%c", submatch(1))_

This is much better than the suggestion I gave, keeping it all
internal to vim. To clean it up, I'd tweak it to

:%s/\[\zs\d\+\ze\]/\=strftime("%c", submatch(0))

-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/20210904102320.26dc731f%40bigbox.attlocal.net.

No comments: