I'm forwarding this to the list so that everyone can help :)

---------- Forwarded message ----------
Date: Tue, 9 May 2006 19:36:45 +0200
From: Benjamin Reitzammer <[EMAIL PROTECTED]>
To: Gerald Lai <[EMAIL PROTECTED]>
Subject: Re: fast file opening / find file as you type

Hi,

On 5/9/06, Gerald Lai <[EMAIL PROTECTED]> wrote:
On Tue, 9 May 2006, Benjamin Reitzammer wrote:

[snip]
>> Regarding :find. It does not do &path-full completion, and
>> no 'incremental completion menu'. To write such plugin, you'd
>> need to process every typed character.
>
> Yes I tried, :find and that it's not doing completion of my filename,
> is something that makes it a lot less useful. Sure it broadened my vim
> skills ;) but it's still not as good as the described solution the
> jedit plugin offers.
[snip]

This has been suggested in the list before (by Hari, I think). Put these
lines in your vimrc:

==
command! -nargs=? -complete=custom,PathFileComplete -bang -bar Find find<bang> <args>
   function! PathFileComplete(ArgLead, CmdLine, CursorPos)
     return substitute(globpath(&path, a:ArgLead."*"), "[^\n]\\+/", "", "g")
   endfunction

   set wildmenu wildmode=longest:full
==

Then instead of doing

   :find <partial filename>

do

   :Find <partial filename>
   (notice the capital "F")

Completion will work now. :Find is :find with completion.

Wow, thanks ... this is cool.

Take note of what J??rgen & Tim had to say. :Find will look in the
directories specified in the option 'path', as J??rgen mentioned.

Don't call me picky ... but there's the problem (at least if
understand the help for the path option correctly). If a path ends
with ** it searches only for directory names, while * searches only
the direct subdirectories for the given paths.
This is a good start, but what if I have a *lot* of paths I want to be
searchable (just think about Java and it's nice way of structuring
classes into packages ;).

So my subsequent question is:
Is there a way to set the path option programmatically. Say "scan dir
_x_ and add all subdirectories up to a given depth to the path
option"?

After typing your <partial filename>, you can hit the <Tab> button, as
Tim mentioned, to complete the filename and/or bring up the wildmenu so
you can scroll through the matching filenames from left to right. You
can also type Ctrl-d to list the matching filenames.

This is really helpful already. Thanks a lot.

Cheers

Benjamin

Reply via email to