On Tuesday, January 29, 2013 6:57:44 PM UTC+8, Tony Mechelynck wrote:
> On 29/01/13 11:13, h2ero wrote:
>
> >
>
> > I use follow two method, but it only show ^M and ^@, who know how to add a newline. thanks
>
> > let n_line = substitute(n_line,'\({\)','\r\1','g')
>
> > let n_line = substitute(n_line,'\({\)','\n\1','g')
>
> >
>
>
>
> In :s[ubstitute], \n in the pattern finds a newline, \r in the
>
> replace-by string breaks the line.
>
>
>
> In substitute(), \n both finds a newline or replaces by one, but if the
>
> string is got from or inserted into a file, a newline in the string may
>
> mean a null byte in the file, depending how you lift the string or put
>
> it back. (IIUC, a newline in a register still means a linebreak in the
>
> file, but there, there is another hitch: any register whose contents end
>
> in a newline is regarded as linewise.)
>
>
>
> See :help NL-used-for-Nul
>
>
>
>
>
> Best regards,
>
> Tony.
>
> --
>
> The reasonable man adapts himself to the world; the unreasonable one
>
> persists in trying to adapt the world to himself. Therefore all
>
> progress depends on the unreasonable man.
>
> -- George Bernard Shaw
Tony, thank you.
You let me know reason.
I have fixed it use setline(n_line ,split("\r\nh","\n"))
--
--
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:
Post a Comment