- Thanks a lot William, it works perfectly !
Quoting William Natter <wnatter@...>:
> antalsia@... wrote:
> >Hi !
> >Sorry if the question is trivial, but I wonder how to replace the EOL by the
> >NULL caracter...I want to print the content off a file on a single line then
> >format the text with x caracters per line. Does anyone has a solution ?
> >thanks in advanced,
> Bonjour Yoan,
> Assuming x is 10 and that you know how to use some "e" commands (using
> ":"), my solution would be:
> :set tw=10
> :%j means for every line in the buffer, join the lines
> :set tw=10 means set the "textwidth" parameter, also called "tw", to
> 10. This controls the behaviour of the next command.
> gqG means format from this line to the last one in the file into the
> given textwidth.
> Someone pointed to ggVGJ as a nice alternative to the first command.
> There are some assumptions made by the above commands with spaces, so if
> you absolutely require to cut at every single set of x characters, here
> is something a little better:
> The first line means: on every line, replace every newline character
> (\n) with nothing. The second line means: match ten characters, replace
> them with themselves (&) and a newline (\r).