CTRL-W f versus gf

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

CTRL-W f versus gf

Stefan Karlsson
Hi all,

Suppose i have the following line in a C document:

    #include "..\..\Test\test.h"

When I use gf the included file is found, but when I use CTRL-W f it is not.
However, if I write

  #include "test.h"

Both methods finds the file. Is there any setting I can use to fix this?


Best regards,

Stefan Karlsson


Reply | Threaded
Open this post in threaded view
|

Re: CTRL-W f versus gf

Aaron Griffin
> When I use gf the included file is found, but when I use CTRL-W f it is not.
> However, if I write
>
>   #include "test.h"
>
> Both methods finds the file. Is there any setting I can use to fix this?

set the path=..... path to where your includes are... mine (on windows)

set path+=d:/include,d:/include/vc7,.,./include,./inc
Reply | Threaded
Open this post in threaded view
|

Re: CTRL-W f versus gf

A.J.Mechelynck
In reply to this post by Stefan Karlsson
Stefan Karlsson wrote:

> Hi all,
>
> Suppose i have the following line in a C document:
>
>     #include "..\..\Test\test.h"
>
> When I use gf the included file is found, but when I use CTRL-W f it is not.
> However, if I write
>
>   #include "test.h"
>
> Both methods finds the file. Is there any setting I can use to fix this?
>
>
> Best regards,
>
> Stefan Karlsson
>
>
>
>
>

The KISS method ("Keep It Simple and Stupid") would be

        :nnoremap <C-W>f <C-W>sgf

It has the side effect that the window is split even if the file does
not exist.

Best regards,
Tony.

Reply | Threaded
Open this post in threaded view
|

Re: CTRL-W f versus gf

Charles E Campbell Jr
In reply to this post by Stefan Karlsson
Quoting Stefan Karlsson <[hidden email]>:

> Suppose i have the following line in a C document:
>
>     #include "..\..\Test\test.h"
>
> When I use gf the included file is found, but when I use CTRL-W f it is not.
> However, if I write
>
>   #include "test.h"
>
> Both methods finds the file. Is there any setting I can use to fix this?

Just checking your setup...

* does test.h exist in the current directory?
* does test.h only exist in ../../Test/test.h?
* do both methods work after   :set path=   ?

When I tried this under RH8 Linux, admittedly using a different path
(in my case,  #include ".HDR/xtdio.h"), when the path setting included
/home/cec/.HDR, both methods found the header file, and when the path
setting was "", neither method found the file.

Regards,
Chip Campbell

Reply | Threaded
Open this post in threaded view
|

SV: CTRL-W f versus gf

Stefan Karlsson
> * does test.h exist in the current directory?
No

> * does test.h only exist in ../../Test/test.h?
Yes

> * do both methods work after   :set path=   ?
No, only gf works. Strange, it seams that my 'path' settings doesn't have
any effect :-)

Do you know if there *should* be any difference in search behavior between
gf and ^Wf?

Regards,

Stefan Karlsson

> -----Ursprungligt meddelande-----
> Från: [hidden email] [mailto:[hidden email]]
> Skickat: 26 maj 2005 18:54
> Till: Stefan Karlsson
> Kopia: [hidden email]
> Ämne: Re: CTRL-W f versus gf
>
> Quoting Stefan Karlsson <[hidden email]>:
> > Suppose i have the following line in a C document:
> >
> >     #include "..\..\Test\test.h"
> >
> > When I use gf the included file is found, but when I use
> CTRL-W f it is not.
> > However, if I write
> >
> >   #include "test.h"
> >
> > Both methods finds the file. Is there any setting I can use
> to fix this?
>
> Just checking your setup...
>
> * does test.h exist in the current directory?
> * does test.h only exist in ../../Test/test.h?
> * do both methods work after   :set path=   ?
>
> When I tried this under RH8 Linux, admittedly using a
> different path (in my case,  #include ".HDR/xtdio.h"), when
> the path setting included /home/cec/.HDR, both methods found
> the header file, and when the path setting was "", neither
> method found the file.
>
> Regards,
> Chip Campbell
>