When I open Vim on my laptop and run regex like this:


vim inserts ^@ instead of line breaks.

This problem started happening last week. I'm running Ubuntu 18.04.04. I think the problem might have started after Ubuntu installed updates.

Things I've tried

encoding and fileencoding

I tried setting the encoding and fileencoding to utf-8, and then to latin1, but this made no difference.



If I call vim with

LC_ALL=C vim foo

then its makes no difference, the problem still occurs.


1 Answer 1


\n in vim for replacement does not mean newline, but null.

Use \r instead. E.g.


You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .