Re: ^@ in my strings?
- David Fishburn wrote:
>Short answer: "\<C-J>" or "\n". :help NL-used-for-Nul
> Vim 6.1.165 W2K
> I have the following in my buffer:
> pid INT NOT NULL,
> cid INT NOT NULL,
> ctext decimal(5,2) NULL,
> I visually select these rows and then echo it:
> newly yanked: pid INT NOT NULL,^@ cid
> INT NOT NULL,^@ ctext decimal(5,2) NULL,
> I want to write a substitution string that returns this:
> pid, cid, ctext
> But I didn't realize that substitite would treat these as all one
> I was going to do this:
> substitute( columns, '^[ \t]*\([a-zA-Z0-9_]*\).*', '\1,', "ei" )
> This would have given me this:
> I am not sure how to reference ^@.
> Ctrl-v ctrl-M gives me ^M.
> How do I get ^@?
Long answer: it might be easier not to yank the selection into a string,
depending on what you want to do with it. Once the lines are selected, just do
Note that I use '\s' instead of '[ \t]' and '\k' instead of '[a-zA-Z0-9_]'
(maybe a little different, maybe exactly the same). Finally, AFAIK the only
flag that substitute() understands is "g"; I think it ignores your "ei".
HTH --Benji Fisher