Friday, February 4, 2011

Re: Using vimgrep

Excerpts from Michael(Xi Zhang)'s message of Sat Feb 05 02:31:15 +0000 2011:
> function s:Searchwordgl()
>
> let searchstring = expand("<cword>") "search string under the cursor
>
> let searchdirlist = readfile('sdir.txt','',6) "read directories into
> list
> string
>
> if searchstring != ""
> endif
>
> endfunction


> let searchdir = join(searchdirlist) " join the list into
> execute "vimgrep " searchstring searchdir

spaces will cause trouble.
Consider using
join(map(copy(searchdirlist)), 'fnaameescape(v:val)'))
instead

Also 6 lines is bad. Maybe do

, 7)

if len(list) > 6
throw "something went wrong. file has too many lines"
endif

Yours
Marc Weber

--
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

No comments: