Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

user defined function args

0 views
Skip to first unread message

lomilomi

unread,
Dec 14, 2009, 8:35:12 PM12/14/09
to
Hi, I wrote my own function that accepts as it's arguments a path to
search and the filename to search for. What I would like to do is
store some predefined paths in my vimrc so that I don't have to type
out long paths when calling my function. So that for example instead
of:

:F /myDir/mySubdir/mySubSubDir/** myFile

I would rather type

:F myPathVar myFile

where in my vimrc i have myPathVar = "/myDir/mySubdir/mySubSubDir/
**". But the problem is my function automatically assumes that
myPathVar is a string. How can I change my function to make it view
myPathVar as a variable? Thanks.

Luc Hermitte

unread,
Dec 16, 2009, 8:17:29 AM12/16/09
to
Hello,

On 15 déc, 02:35, lomilomi <lomilom...@gmail.com> wrote:
> So that for example instead of:
> :F /myDir/mySubdir/mySubSubDir/** myFile
> I would rather type
> :F myPathVar myFile
>
> where in my vimrc i have myPathVar = "/myDir/mySubdir/mySubSubDir/
> **".  But the problem is my function automatically assumes that
> myPathVar is a string.  How can I change my function to make it view
> myPathVar as a variable?  Thanks.

Have a look at my :SearchInVar command in http://code.google.com/p/lh-vim/wiki/searchInRuntime
It performs what you are looking for (and it also support tab-
expansion) -- by evaluating the string obtained so it is considered as
a variable.

HTH,

--
Luc Hermitte
http://code.google.com/p/lh-vim/
http://hermitte.free.fr/vim/

lomilomi

unread,
Dec 18, 2009, 1:54:05 PM12/18/09
to
On Dec 16, 5:17 am, Luc Hermitte <luc.hermi...@gmail.com> wrote:
> Hello,
>
> On 15 déc, 02:35, lomilomi <lomilom...@gmail.com> wrote:
>
> > So that for example instead of:
> >    :F /myDir/mySubdir/mySubSubDir/** myFile
> > I would rather type
> >    :F myPathVar myFile
>
> > where in my vimrc i have myPathVar = "/myDir/mySubdir/mySubSubDir/
> > **".  But the problem is my function automatically assumes that
> > myPathVar is a string.  How can I change my function to make it view
> > myPathVar as a variable?  Thanks.
>
> Have a look at my :SearchInVar command inhttp://code.google.com/p/lh-vim/wiki/searchInRuntime

> It performs what you are looking for (and it also support tab-
> expansion) -- by evaluating the string obtained so it is considered as
> a variable.
>
> HTH,
>
> --
> Luc Hermittehttp://code.google.com/p/lh-vim/http://hermitte.free.fr/vim/

thanks I'll look into it.

0 new messages