Tuesday, February 22, 2011

RE: v:fname mods


 
> Date: Tue, 22 Feb 2011 13:47:02 +0100
> Subject: Re: v:fname mods
> From: cblists@256bit.org
> To: vim_use@googlegroups.com
>
> On Tue, February 22, 2011 1:32 pm, Roy Fulbright wrote:
> >
> > I have a fullpath filename in v:fname minus the filetype, for example:
> > A::B::C::Mymodule
> >
> > How can I modify v:fname to contain: A/B/C/Mymodule/Mymodule.pm (note:
> > the last part of the path is duplicated before adding '.pm')
> > I used 'substitute' to replace '::' with '/'. I looked for a vim function
> > to parse pathname in order to get the last part, but found nothing.
> >
> > My ultimate goal is to set 'includeexpr' to an expression that will
> > convert the object of a Perl "use" command to a filename for 'gf'.
>
> :let a="A::B::C::Mymodule"
> :let b=split(a, '::')
> :echo join(b, '/') . '/' . b[-1] . '.pm'
> A/B/C/Mymodule/Mymodule.pm
>
> regards,
> Christian
>

Thanks for the speedy reply, Christian. Unfortunately I am constrained
to use vim version 6.2 (at work) which does not recognize split. Is there an
alternative that will work on this ancient version? Thanks.
 

No comments: