75945Re: question on gf and path
- Dec 1, 2006On Fri, Dec 01, 2006 at 10:30:26AM -0600, Ben K. wrote:
> Is there a way to make gf open "some.file" from this line?That's exactly where you can use my little script (which will isntall
> where the file is actually sitting under web server root, like
> I tried adding "/var/www/html" to the :set path but vim will not recognize
> it. /var/www/html/; was the same. Basically I'm looking for a way to add
> On the same note, would it be possible to let gf open
> when I gf on this string
> or by defining a new command (say wf)?
some dependencies, too)
Just add this into your ftplgugin/filetype.vim file:
------ >8 ------ >8 filetype_sourced.vim -- >8 ------ >8 ------ >8
noremap gf :call vl#ui#navigation#gfHandler#HandleGF()<cr>
------ 8< ------ 8< ------ 8< ------ 8< ------ 8< ------ 8< ------ 8<
and source the installer file
(Don't be afraid. The installer will ask for confirmation before doing
I would suggest saving it to another directory (eg ~/.vimlib or
~/.vim_gf) and adding this folder to your runtimepath.
Then its easy to remove it again if you don't like it.
I think you can see that [matchstr ... does the interesting thing which
is getting the file from under the cursor by calling expand('<cWORD>')
and remvoving the Include text. You
have to adjust it the way you like. You have to write your own code
which removes /includes and adds /var/www/html/includes/ which would
look like this:
You can even add different include directories:
Then you'll be asked which file to open if it doesn't exist.
Unfortunately the documentation
isn't up to date because vim segfaults while creating it and I don't
have the time to find the code causing it.
If something doesn't work drop me a mail.
- << Previous post in topic Next post in topic >>