On Monday, April 8, 2013 3:24:07 PM UTC-5, FlashBurn wrote:
> I'm trying to create a list of file using globpath(). The problem is that 
> globpath returns them as a single string, the other problem is that some of 
> the files contains white spaces in their path. Here is what I came up with
> 
> call writefile(split(escape(globpath(s:dir_str, '*.[hc]'), ' '), "^@"), 
> s:myfile)
> 
> The ^@ symbol shows up when globpath is written to a file without splitting 
> it, i.e if you do the following, your files will separated with ^@
> 
> writefile([escape(globpath(s:dir_str, '*.[hc]'), ' ')], s:myfile)
> 
> The problem is that split doesn't recognize ^@. I get the following errors
> 
> E114: Missing quote: "
> E116: Invalid arguments for function split(escape(globpath(s:dir_str, 
> '*.[hc]'), ' '), "
> E116: Invalid arguments for function writefile
> 
> Does anybody know how to make split recognize this funny symbol?
> 
> Any help is appreciated.

That "funny symbol" is a NULL character, which Vim uses internally to represent 
newline characters.

You can probably split on "\n" instead of "^@", but more likely you can just 
call writefile on the string directly to get each file on its own line.

-- 
-- 
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 [email protected].
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to