Re: How to find a file.

2006-10-17 Thread Peter Hodge
--- Zheng Da [EMAIL PROTECTED] wrote:

 Hello.
 I want to open a file, and I know its name, but don't know the path.
 I want to use the command find. For example I want to open the file
 space.cc, and use the command :find space.cc. I know the file may be
 in the current directory, or the subdirectories, but always get the
 error E345: Cannot find file space.cc in path. I use the default
 path, it should be .,/usr/include,,. (I use Linux).
 So what's the problem? And how to open the file I want?

Hello,

If you prefix '**/' to the filename, Vim should search through subdirectories
for the file:

  :edit **/space.cc
  :find **/space.cc

Also, if you use CTRL+D, Vim will show you a list of matching files:

  :find **/space.ccCTRL+D
src/space.cc
src/backup/space.cc

regards,
Peter




 
On Yahoo!7 
Music: Create your own personalised radio station. 
http://au.launch.yahoo.com/ 



Re: How to find a file.

2006-10-16 Thread Zheng Da

I have used your script, but it can't content me.
I want to find the file under the current dir, its subdir or maybe its
sub-subdir. So I hope while I'm inputting the filename, the popup menu
should display the paths with the file, not the dir, containing the
characters I input.

--
With regards
Zheng Da

On 10/15/06, Hari Krishna Dara [EMAIL PROTECTED] wrote:


On Sun, 15 Oct 2006 at 3:41pm, Zheng Da wrote:

 Hello.
 I want to open a file, and I know its name, but don't know the path.
 I want to use the command find. For example I want to open the file
 space.cc, and use the command :find space.cc. I know the file may be
 in the current directory, or the subdirectories, but always get the
 error E345: Cannot find file space.cc in path. I use the default
 path, it should be .,/usr/include,,. (I use Linux).
 So what's the problem? And how to open the file I want?

You got the answer for using :find command already, but I would like to
suggest you to try my LookupFile plugin that allows you to use the Vim7
popup completion to do this using custom tags files.

http://www.vim.org//script.php?script_id=1581

--
HTH,
Hari

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



Re: How to find a file.

2006-10-16 Thread A.J.Mechelynck

Zheng Da wrote:

I have used your script, but it can't content me.
I want to find the file under the current dir, its subdir or maybe its
sub-subdir. So I hope while I'm inputting the filename, the popup menu
should display the paths with the file, not the dir, containing the
characters I input.



Try (untested)

:set path=**

to search only in the current directory and below, or

:set path+=**

to add the whole tree starting at the current directory going down, to 
whatever 'path' is already set to.



This method uses no popup menu, it merely changes the set of directories 
searched by the :find command.



Best regards,
Tony.


Re: How to find a file.

2006-10-16 Thread panshizhu
I guess this may not be all you want, for example, if you want to search
files in ~/src, now you got a file in ~/src/abc/def/.

Then your current directory is ~/src/abc/def/. and when you need to search
within ~/src again to find something in ~/src/ghi/jkl/., how to do that?

I recommend a probably better approach, just create a filelist inside the
~/src, you can use the following command to create the file list:

in ~/src:
find .  filelist

okay, now each time you want to search for file, just open the filelist,
and search for the filename, when you've got the desired file, use gf to
open the file. You can also map a shortcut-key to open the filelist.

for example: I use f12 to open the file list, press f12 and now the
filelist opens.
use /foobar.txt and press enter to search for the file, if the file has
multiple occorences, press n.
when you've got the file, press gf and the file will be opened.

--
Sincerely, Pan, Shi Zhu. ext: 2606


Zheng Da [EMAIL PROTECTED] 写于 2006-10-16 22:24:47:

 I have used your script, but it can't content me.
 I want to find the file under the current dir, its subdir or maybe its
 sub-subdir. So I hope while I'm inputting the filename, the popup menu
 should display the paths with the file, not the dir, containing the
 characters I input.

 --
 With regards
 Zheng Da

 On 10/15/06, Hari Krishna Dara [EMAIL PROTECTED] wrote:
 
  On Sun, 15 Oct 2006 at 3:41pm, Zheng Da wrote:
 
   Hello.
   I want to open a file, and I know its name, but don't know the path.
   I want to use the command find. For example I want to open the file
   space.cc, and use the command :find space.cc. I know the file may be
   in the current directory, or the subdirectories, but always get the
   error E345: Cannot find file space.cc in path. I use the default
   path, it should be .,/usr/include,,. (I use Linux).
   So what's the problem? And how to open the file I want?
 
  You got the answer for using :find command already, but I would like to
  suggest you to try my LookupFile plugin that allows you to use the Vim7
  popup completion to do this using custom tags files.
 
  http://www.vim.org//script.php?script_id=1581
 
  --
  HTH,
  Hari
 
  __
  Do You Yahoo!?
  Tired of spam?  Yahoo! Mail has the best spam protection around
  http://mail.yahoo.com
 

How to find a file.

2006-10-15 Thread Zheng Da

Hello.
I want to open a file, and I know its name, but don't know the path.
I want to use the command find. For example I want to open the file
space.cc, and use the command :find space.cc. I know the file may be
in the current directory, or the subdirectories, but always get the
error E345: Cannot find file space.cc in path. I use the default
path, it should be .,/usr/include,,. (I use Linux).
So what's the problem? And how to open the file I want?

--
With regards
Zheng Da


Re: How to find a file.

2006-10-15 Thread A.J.Mechelynck

Zheng Da wrote:

Hello.
I want to open a file, and I know its name, but don't know the path.
I want to use the command find. For example I want to open the file
space.cc, and use the command :find space.cc. I know the file may be
in the current directory, or the subdirectories, but always get the
error E345: Cannot find file space.cc in path. I use the default
path, it should be .,/usr/include,,. (I use Linux).
So what's the problem? And how to open the file I want?



Maybe the file is not in that 'path'? Try expanding it, e.g.,

  :set path=.,,/usr/local/include,/usr/include,/usr/X11R6/include

or anything that you might think likely. Or try looking into the source of a 
(working) module which includes the file you're looking for.


If you're desperate, try setting 'path' temporarily to /**/* to search (this 
time) in your whole hard drive. But in that case this may take several 
minutes as the Microsoft upgrades say, so you shouldn't leave 'path' set at 
that value any longer than necessary.



Best regards,
Tony.


Re: How to find a file.

2006-10-15 Thread Yakov Lerner

On 10/15/06, Zheng Da [EMAIL PROTECTED] wrote:

Hello.
I want to open a file, and I know its name, but don't know the path.
I want to use the command find. For example I want to open the file
space.cc, and use the command :find space.cc. I know the file may be
in the current directory, or the subdirectories, but always get the
error E345: Cannot find file space.cc in path. I use the default
path, it should be .,/usr/include,,. (I use Linux).
So what's the problem? And how to open the file I want?


Try 'set acd'. Maybe you expect that '.' is same as dir of currently
open file but it actually isn't. Failing that, try the following:

Try to create reproducible sequence of commands
starting from 'vim -u NONE' that demonstrates the problem in such
simplest and compelte way that
others can reproduce it. Send this sequence to the list.
For example:

cd ~
touch x.cc # create file x.cc in current directory
cd /tmp
vim -u NONE # start vim with all default/clean settings
set path=.,/usr/include,,
find 

Yakov


Yakov