Monday, March 11, 2013

Re: vim: want control character in substitution string

On 2013-03-11, Paul wrote:

> After much reading, I found that I can match ^@ with \%x00 in the
> search string, but I haven't found a way to specify control characters
> in the substitution string. Is there a way?

You can use the nr2char() function as a replacement expression,
e.g.,

:%s/\^D/\=nr2char(4)/g

See

:help sub-replace-expression
:help nr2char()

HTH,
Gary

--
--
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.
For more options, visit https://groups.google.com/groups/opt_out.

No comments: