Friday, November 4, 2022

Re: Changing Search and Replace Newline Character

On Do, 03 Nov 2022, Thomas Jakway wrote:

> According to https://vim.fandom.com/wiki/Search_and_replace:
>
>
> "When searching, \n is newline, \r is CR (carriage return = Ctrl-M = ^M)… When
> replacing, \r is newline, \n is a null byte (0x00)."
>
> There are also questions on StackOverflow about this, e.g. https://
> stackoverflow.com/q/71417.
>
>
> Is there any way to change my settings to make this consistent? I'd like \n to
> mean "newline" in replace as well. I'm aware that this means \n can no longer
> be used to mean null when replacing. Ideally I'd be able to change that to some
> other control sequence, but not constantly tripping over this pothole is more
> important. If necessary I'll insert nulls using sed or some other tool. I use
> search and replace all the time but hardly ever need to insert a null byte
> anywhere.

No, this is not possible, except for creating a mapping that evaluates
your expression and replaces the result, see, :h c_CTRL-\_e


Best,
Christian
--
Letzte Worte von A. Senna:
"Irgendetwas klappert da."

--
--
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/20221104105931.GC1394649%40256bit.org.

No comments:

Post a Comment