On Friday, December 20, 2013 7:51:25 AM UTC-6, Christian Brabandt wrote:
> Hi Aaron!
>
> On Do, 19 Dez 2013, Aaron Bohannon wrote:
>
> > To reproduce (on standard *nix installation):
> >
> > (1) start vim in your home directory
> > (2) :cd .vim
> > (3) :echo findfile('.vimrc', expand('$USER') . ';')
> >
> > In vim 7.3, you get something like "/home/$USER/.vimrc".
> >
> > In vim 7.4, you get nothing.
> >
> > I can't understand why no one's reported this. Am I the only person on the
> > planet who uses this feature? I don't know how to get by without it.
>
> You are giving only a partial directory name as stop dir. I am not sure,
> this was ever supposed to work. I think, echo findfile('.vimrc',
> '*'.expand('$USER').';') might work, however.
>
Well, I can confirm on Windows that the behavior changed between 7.3 and
7.4. But I think this is a case of misunderstanding how ';' is supposed
to work. I was a little confused myself to begin with and tried the
exact same thing to see the failure!
Looking at :help file-searching, in the section on "upward search", it
took a little while, but eventually I understood that you put the "stop
directory" AFTER the ';', not before.
I think both you and the OP intended to use ';'.expand('$USER') instead
of the other way around.
Some experimentation shows that these work, on Vim 7.4, when the
directory is C:\Users\Ben\vimfiles\plugin:
:echo findfile('_viminfo', ';')
:echo findfile('_viminfo', ';Ben')
This does NOT work, it doesn't echo anything as the OP reported:
:echo findfile('_viminfo', 'Ben;')
All three of these work as intended in Vim 7.3 on Windows.
But, if I now understand ; properly, I think that 'Ben;' is actually
saying, "starting in the subdirectory Ben of the current directory,
search upwards". But here in vimfiles/plugin, there IS no subdirectory
called "Ben". So Vim is probably correct to fail.
';Ben', on the other hand, tells Vim "starting in the current directory,
seach upwards until you encounter the "Ben" directory. I think this is
what the OP intended.
--
--
You received this message from the "vim_dev" 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
---
You received this message because you are subscribed to the Google Groups
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.