On Mon, 15 Aug 2011, zergu wrote:

Hello.
Recently I've written my first Vim plugin which allows me to jump to most used files/directories in Symfony (PHP) projects. It works as expected in all of them but one. I have a project which is mounted to my local directory via sshfs (don't ask why ;)).

Seems reasonable.  That's why sshfs exists.


Plugin detects Symfony's main dir by finding 'symfony' file:
let l:maindir = findfile("symfony", ".*;")
And this is not working in this particular project. It seems that no file can be found with findfile() when mounted with sshfs, cause in normal situation
echo findfile("symfony", ".")
returns "symfony" and in sshfs one returns nothing. Is this a bug or I am doing something wrong?

This works for me. I have /mnt/work mounted via sshfs to my work machine's root directory. So, e.g. /mnt/work/etc/shadow is a file that exists. If I do:

:cd /mnt/work
:echo findfile('shadow','.*;')

It echoes 'etc/shadow'

The '.*;' means to start at all directories matching /.*/, but then also consider all parent directories, up to root. See:

:help file-searching | /Upward

The results of findfile() when the {path} portion contains a relative path (e.g. /.*/), depend on your current directory in Vim (Try :lcd). Try for example to change into the root directory of the project (or into the directory of some file in the project) and test it again, e.g.:

:cd %:h
:echo findfile('symfony', '.*;')

The version you're using for testing:
:echo findfile('symfony', '.')
will only find a 'symfony' file in the current directory (not in a subdirectory of the current).

--
Best,
Ben

--
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