In expression :s/foo/bar\n/gWhen replacing \n inserts a null byte, according to the docs I have to use \r. Since I insert newlines more frequently than null bytes, is there a way to change this mapping? So I want :s/foo/bar\n/g to insert a newline, not nullbyte. 
Change '\r' to '\n' for search and replace?
search;regular expression;replace
You could do this via a :cnoremap <expr> \r that checks (via getcmdtype() and getcmdpos()) that the current command-line is a :s Ex command, and you're editing the replacement part.I would recommend against this, and just accept and learn that \r has to be used. Otherwise, you'll become dependent on your mapping and will struggle on systems that are not yours / do not have your configuration.