On Thu, 13 Jul 2006 at 12:58pm, Tom Purl wrote:

> Hi, I'm a Vim scripting newbie, and had a pretty general question.
>
> I'm would like to write a function that does the following:
>
> 1. Searches a directory for all files that end in the string "Template"
> 2. Return those file names to the user as chooseable list, similar to
> the way that the spell checker functionality works when you use the z=
> command.
>
> Would anyone know how to do this?  I checked the functions help in Vim,
> but couldn't find what I was looking for.
>
> Thanks in advance for any guidance!
>
> Tom Purl
>

>From your description, it is not clear if this will be part of a larger
script that you are developing. If all that you want to do is ability to
search and open the file, one of the existing plugins might be able to
help you. But if you want to ask the user to select one and do something
with that selection, you can use the glob() and inputlist() functions to
do this, something like this:

let files = glob(dir.'*Template')
if files != ''
  let filelist = split(files, "\n")
  let sel = inputlist(['Select file:']+filelist)
  if sel != -1
    let selectedFile = filelist[sel]
  endif
endif

-- 
HTH,
Hari

__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 

Reply via email to