So, what I really want I guess is the following:
1.  gf - look for the file in current directory (already does this)
2.  gf - look for the file in current path (already does this)
3. gf - look for the file in current path after manipulating the name (already does this, suffixexadd) 4. gf - look for the file in current path after manipulating the filename path (already does this, includeexpr)
5.  findfile() - pass a flag to recursively search the path (new)
6. gf - if includeexpr is not found, call a function and perform more enhanced searching (new, let me use findfile() or taglist() and return the file I want opened).

So, includeexpr() can take a Vim function which allowed me to do this:

function FlexIncludeExpr(fname)
    let fname = a:fname
    let fname = substitute(fname,'\\.','/','g')

    for path in split(&path, ',')
let fullpath = findfile(fname, substitute(path, '\w\zs$', '/**', '') )

        if fullpath != ''
            return fullpath
        endif
    endfor

    let file_tags = taglist(fname)

    for file_match in file_tags
        return file_match.filename
    endfor

    return fname
endfunction

So, that gives me #5.

What I am left with is #6.

I am not sure if I can combine these 2 together (especially if they are in the same file). What I have above did work, but it simply left me on the same line which makes sense. I was hoping it would also take me to the match but it doesn't look like that is possible.

I tried changing this line to:
    for file_match in file_tags
        tag fname
        " return file_match.filename
    endfor

But it says you cannot use "tag" there.
The Dictionary returned from the taglist() call does not contain line numbers, so I can't navigate there myself either.

Dave

--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

Reply via email to