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 check
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
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.
Well, as an ugly first-pass hack:
:let s = expand("*template")
:echo sub
> 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.
I'm adding a function to the potwiki script so that I can create
>> 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.
>
> Well, as an ugly first-pass hack:
>
> :let s = expand("*templ
Try
:set wildmenu
I put the above line in my .vimrc file and now can do the following:
:e *s*#then hit tab and any file in the current directory that
contains an 's' is displayed in a menu.
Good luck,
Kevin
On Jul 13, 2006, at 1:58 PM, Tom Purl wrote:
Hi, I'm a Vim scripting newbie,
Well, as an ugly first-pass hack:
:let s = expand("*template")
:echo substitute("\n".s."\n",
'^\%([^[:cntrl:]]*[[:cntrl:]]\)\{'.(confirm('Which file?',
s)).'}\([^[:cntrl:]]*\).*', '\1', 'g')
Thanks a *ton* Tim! This looks very succinct (if not a bit
frightening). I'll definitely try this one