On 13/02/09 14:12, Jeenu wrote:
> Hi,
>
> This thought came to mind when I was browsing source code. I know find
> command finds files of a name using 'path' option, and prefixing a
> count 'n' would give you the nth occurrence of the file with same
> name.
>
> I often find that I open a file using find, and realize it's not the
> file that I looked for. Then I use 2find, 3find so on, until I reach
> the actual file I wanted. Wouldn't it be nice if there is a command
> like :ts where VIM lists all files by the name, and then let the use
> choose one he wants? I'm assuming that such a feature is not present
> currently - I couldn't find any with ":h :find". I might be able to
> use the find utility, but something inside VIM would be nice.
>
> Please share your thoughts.
> :J

You can use the vimgrep command: for instance with

        :vimgrep /^\%1l/ file ...

where "file ..." means one or more filenames, optionally with wildcards, 
it will produce a quickfix list for the first character in each of these 
files (each of the files matching the wildcards if you use any). Then, 
of course, ":copen" opens the quickfix list, with one line per file, 
where you can open any of these files by placing the cursor on it then 
hitting Enter.

Or you could use filename completion:

        :set wildmenu
        :e pattern<Tab>

where "pattern" is part of a filename, optionally with wildcards, you'll 
get a menu on the status line:
        <Left> <Right> selects an item in the menu
        <Down> (when a directory is selected) goes down into it
        <Up> goes back to the parent directory
        <Enter> accepts the current selection
        <Esc> cancels

or

        :e pattern<Ctrl-D>

shows all possible completions then comes back to the command line.


Not sure if I answered your question, but this is what I could come up 
with off the top of my head.


Best regards,
Tony.
-- 
Q:  How many right-to-lifers does it take to change a light bulb?
A:  Two.  One to screw it in and one to say that light started when the
     screwing began.

--~--~---------~--~----~------------~-------~--~----~
You received this message from the "vim_use" maillist.
For more information, visit http://www.vim.org/maillist.php
-~----------~----~----~----~------~----~------~--~---

Reply via email to