Tuesday, February 22, 2011

Re: v:fname mods

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

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

No comments: