On Monday, March 18, 2013, FlashBurn wrote: > I want to create a list of files that my project is using. This list will > be stored in a file and subsequently will be used by cscope. > > Here is what I have so far: > > function! BuildFileList() > s:dir_list = ['dir1', 'dir2', 'dir3'] > s:output_file = 'cscope.files' > redir! > s:output_file > for dir in s:dir_list > glob(dir.'*.[ch]') > endfor > redir END > endfunction > > silent call BuildFileList > > I'm getting the following errors when I execute this function: > E190: Cannot open "s:output_file" for writing > E486: Pattern not found: dir."*.[ch]" > > Obviously there is something wrong with the way I use redir and glob, but > I can't get my finger on it. Does anybody know what am I doing wrong? > > Any help is really appreciated. > > -- > -- > 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] <javascript:;>. > For more options, visit https://groups.google.com/groups/opt_out. > > Redir requires an actual file name, not a variable name. Use :execute.
execute "redir! > " . s:variable Also, unless the "dir" ends in a slash, you will end up with the pattern right next to the directory name without the separator. Stick a slash in there to see if it helps. dir . "/*.[ch]" You didn't ask this, but unless your files end in [ch] (and not just ch), you may be out of luck. Salman -- سلمان حلیم -- -- 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.
