Loading ...
Sorry, an error occurred while loading the content.
 

Re: gf - incorrect behaviour

Expand Messages
  • Dimitar DIMITROV
    ... It s an issue with puppet code which uses paths like: puppet:///modules/module_name/my_file that maps to real paths like
    Message 1 of 4 , Dec 29, 2012
      > > 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 -- Bram@... -- 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


      --
      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
      ... As a workaround you can open this with gf if you setup an autocmd: augroup PuppetProto autocmd! BufReadCmd puppet://* :exe e .(v:cmdbang? ! : )
      Message 2 of 4 , Dec 29, 2012
        воскресенье, 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

        --
        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
      Your message has been successfully submitted and would be delivered to recipients shortly.