gf - incorrect behaviour

45 views
Skip to first unread message

Dimitar DIMITROV

unread,
Dec 28, 2012, 5:42:20 PM12/28/12
to vim...@googlegroups.com
Hi all,

I think the following might (I am testing with Vim 7.3.409) be a bug:

command vim -nNX -u NONE
then insert: bla:///path/to/file
then, with cursor being on p, use gf
It tries to open bla:///path/to/file although : is not in 'isf and bla:/// isn't a protocol
 
Dimitar

---
GPG Key: 2048R/160C6FA8 2012-10-11 Dimitar Dimitrov (kurkale6ka) <mit...@yahoo.fr>

Bram Moolenaar

unread,
Dec 29, 2012, 4:35:38 PM12/29/12
to Dimitar DIMITROV, vim...@googlegroups.com

Dimitar Dimitrov wrote:

> Hi all,
>
> I think the following might (I am testing with Vim 7.3.409) be a bug:
>
> command vim -nNX -u NONE
> then insert: bla:///path/to/file
> then, with cursor being on p, use gf
> It tries to open bla:///path/to/file although : is not in 'isf and bla:/// =
> isn't a protocol

I haven't checked the sources but I think this is hard coded.
It's intentional that this does not depend in 'isfname', so that things
like http:// work with the default 'isfname' value.

Is this really a problem?

--
hundred-and-one symptoms of being an internet addict:
208. Your goals for the future are obtaining an T1 connection and
a 130 gig hard drive.

/// Bram Moolenaar -- Br...@Moolenaar.net -- http://www.Moolenaar.net \\\
/// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\ an exciting new programming language -- http://www.Zimbu.org ///
\\\ help me help AIDS victims -- http://ICCF-Holland.org ///

Dimitar DIMITROV

unread,
Dec 29, 2012, 6:38:19 PM12/29/12
to vim...@googlegroups.com
> > Hi all,
> >
> > I think the following might (I am testing with Vim 7.3.409) be a bug:
> >
> > command vim -nNX -u NONE
> > then insert: bla:///path/to/file
> > then, with cursor being on p, use gf
> > It tries to open bla:///path/to/file although : is not in 'isf and bla:/// =
> > isn't a protocol
>
> I haven't checked the sources but I think this is hard coded.
> It's intentional that this does not depend in 'isfname', so that things
> like http:// work with the default 'isfname' value.
>
> Is this really a problem?

It's an issue with puppet code which uses paths like:
puppet:///modules/module_name/my_file that maps to real paths like
$base_path/modules/module_name/files/my_file
I wanted to be able to use gf with 'inex in order to be able to open 'my_file'
this is the 'inex I was trying to use: set includeexpr=substitute(v:fname,'modules/.\\{-1,}/\zs','files/','')

If puppet is the only language using this kind of paths, no, this is not a real issue


--
hundred-and-one symptoms of being an internet addict:
208. Your goals for the future are obtaining an T1 connection and
    a 130 gig hard drive.

/// Bram Moolenaar -- Br...@Moolenaar.net -- http://www.Moolenaar.net  \\\
///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\  an exciting new programming language -- http://www.Zimbu.org        ///
\\\            help me help AIDS victims -- http://ICCF-Holland.org    ///

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


ZyX

unread,
Dec 30, 2012, 2:25:14 AM12/30/12
to vim...@googlegroups.com, Dimitar DIMITROV
воскресенье, 30 декабря 2012 г., 3:38:19 UTC+4 пользователь Dimitar DIMITROV написал:
> > > Hi all,
>
>
>
> > >
> > > I think the following might (I am testing with Vim 7.3.409) be a bug:
> > >
> > > command vim -nNX -u NONE
> > > then insert: bla:///path/to/file
> > > then, with cursor being on p, use gf
> > > It tries to open bla:///path/to/file although : is not in 'isf and bla:/// =
> > > isn't a protocol
> >
> > I haven't checked the sources but I think this is hard coded.
> > It's intentional that this does not depend in 'isfname', so that things
> > like http:// work with the default 'isfname' value.
> >
> > Is this really a problem?
>
> It's an issue with puppet code which uses
> paths like:
> puppet:///modules/module_name/my_file that maps to real paths like
> $base_path/modules/module_name/files/my_file
> I wanted to be able to use gf with 'inex in order to be able to open 'my_file'
> this is the 'inex I was trying to use: set includeexpr=substitute(v:fname,'modules/.\\{-1,}/\zs','files/','')
>
> If puppet is the only language using this kind of paths, no, this is not a real issue

As a workaround you can open this with “gf” if you setup an autocmd:

augroup PuppetProto
autocmd! BufReadCmd puppet://* :exe 'e'.(v:cmdbang?'!':'') v:cmdarg fnameescape($base_path.expand('<amatch>')[9:])
autocmd! BufWriteCmd puppet://* :exe 'w'.(v:cmdbang?'!':'') v:cmdarg fnameescape($base_path.expand('<amatch>')[9:])
augroup END
Reply all
Reply to author
Forward
0 new messages