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

Re: active links for opening files

Expand Messages
  • Marius Roets
    ... Or rather etc.
    Message 1 of 8 , Oct 31, 2006
    • 0 Attachment
      On 10/30/06, Yakov Lerner <iler.ml@...> wrote:
      > On 10/30/06, Michael M. Tung <michael.m.tung@...> wrote:
      > > Hi all:
      > >
      > > I am working on a simple plugin and want to make vim
      > > open a file which appears in text e.g. as
      > >
      > > [/tmp/test.txt]
      > >
      > > by clicking on it. The path and filename always appears
      > > in brackets.
      >
      > You can do this by mapping <MouseDown> and <MouseUp>
      > pseudo-keys:
      >
      > nmap <MouseDown> .....
      > nmap <MouseUp> ......
      >
      > Yakov
      >
      Or rather <LeftMouseRelease> etc.
    • Michael M. Tung
      ... Thanks for all the helpful replies! I am using the following hack in the ftplugin based on Yakov s suggestion: define function to open gtd file function!
      Message 2 of 8 , Nov 1, 2006
      • 0 Attachment
        Yakov Lerner [iler.ml@...] wrote:
        > On 10/30/06, Michael M. Tung <michael.m.tung@...> wrote:
        > >Hi all:
        > >
        > >I am working on a simple plugin and want to make vim
        > >open a file which appears in text e.g. as
        > >
        > > [/tmp/test.txt]
        > >
        > >by clicking on it. The path and filename always appears
        > >in brackets.
        >
        > You can do this by mapping <MouseDown> and <MouseUp>
        > pseudo-keys:
        >
        > nmap <MouseDown> .....
        > nmap <MouseUp> ......
        >
        > Yakov

        Thanks for all the helpful replies! I am using the
        following hack in the ftplugin based on Yakov's
        suggestion:

        " define function to open gtd file
        function! OpenGTDFile()
        let line = getline('.')
        let line = matchstr(line, "\[.*$")
        let line = substitute(line, "gtd\]", "gtd", "")
        let line = substitute(line, "\ *\[", "", "")
        exec ":e ".line
        endfunction

        " bind open function to mouse event
        nmap <2-LeftMouse> :call OpenGTDFile()<CR>

        I just discovered that this function propagates to
        all other files which are opened afterwards (regardless
        of filetype).

        Is there any way to keep OpenGTDFile local, i.e.
        only to the specified filetype (in this case gtd)?

        I appreciate any help.
        Best,
        Mike

        --
        -------------------------------------------------------------------------
        Dr. Michael M. Tung Email: mtung@...
        Departamento de Matemática Aplicada michael.tung@...
        Universidad Politécnica de Valencia Phone: +34 96 3877000 x88287
        Inst. de Matemática Multidisciplinar +34 96 38-79777
        Edificio 8-G, 2º piso IM: ICQ96423950
        Camino de Vera, s/n
        46022 Valencia (Spain)
        -------------------------------------------------------------------------
        PGP Public Key http://personales.upv.es/mictun/mtung_pubkey.pgp
        -------------------------------------------------------------------------
      • Yegappan Lakshmanan
        Hello, ... You can use the s: prefix to make this function local to the filetype plugin file. ... You can use the attribute to the map command to
        Message 3 of 8 , Nov 1, 2006
        • 0 Attachment
          Hello,

          On 11/1/06, Michael M. Tung <michael.m.tung@...> wrote:
          >
          > Yakov Lerner [iler.ml@...] wrote:
          > > On 10/30/06, Michael M. Tung <michael.m.tung@...> wrote:
          > > >Hi all:
          > > >
          > > >I am working on a simple plugin and want to make vim
          > > >open a file which appears in text e.g. as
          > > >
          > > > [/tmp/test.txt]
          > > >
          > > >by clicking on it. The path and filename always appears
          > > >in brackets.
          > >
          > > You can do this by mapping <MouseDown> and <MouseUp>
          > > pseudo-keys:
          > >
          > > nmap <MouseDown> .....
          > > nmap <MouseUp> ......
          > >
          > > Yakov
          >
          > Thanks for all the helpful replies! I am using the
          > following hack in the ftplugin based on Yakov's
          > suggestion:
          >
          > " define function to open gtd file
          > function! OpenGTDFile()
          >

          You can use the "s:' prefix to make this function local to the
          filetype plugin file.

          > let line = getline('.')
          > let line = matchstr(line, "\[.*$")
          > let line = substitute(line, "gtd\]", "gtd", "")
          > let line = substitute(line, "\ *\[", "", "")
          > exec ":e ".line
          > endfunction
          >
          > " bind open function to mouse event
          > nmap <2-LeftMouse> :call OpenGTDFile()<CR>
          >

          You can use the <buffer> attribute to the map command to
          make this map local to a specific buffer. If you make the
          function a script-local function, then you have to use the
          <SID> prefix for calling the function.

          - Yegappan

          >
          > I just discovered that this function propagates to
          > all other files which are opened afterwards (regardless
          > of filetype).
          >
          > Is there any way to keep OpenGTDFile local, i.e.
          > only to the specified filetype (in this case gtd)?
          >
          > I appreciate any help.
          > Best,
          > Mike
          >
          > --
          > -------------------------------------------------------------------------
          > Dr. Michael M. Tung Email: mtung@...
          > Departamento de Matemática Aplicada michael.tung@...
          > Universidad Politécnica de Valencia Phone: +34 96 3877000 x88287
          > Inst. de Matemática Multidisciplinar +34 96 38-79777
          > Edificio 8-G, 2º piso IM: ICQ96423950
          > Camino de Vera, s/n
          > 46022 Valencia (Spain)
          > -------------------------------------------------------------------------
          > PGP Public Key http://personales.upv.es/mictun/mtung_pubkey.pgp
          > -------------------------------------------------------------------------
          >
          >
        • Michael M. Tung
          Hi Samuel: Thanks for the link to GtdWithVim! Actually I saw it on the vim script site just after writing my hack. I didn t have a chance yet to try it out,
          Message 4 of 8 , Nov 3, 2006
          • 0 Attachment
            Hi Samuel:

            Thanks for the link to GtdWithVim! Actually I saw it
            on the vim script site just after writing my hack.

            I didn't have a chance yet to try it out, but as far
            as I understand from the script description it's
            philosophy is quite different.

            GtdWithVim seems to work independently from any
            external program. With vimGTD I just wanted to quickly
            write a frontend to PyGTD. So all the power is in there...

            I use vimGTD in mutt and it works well. The UTL plugin
            sounds great stuff. Maybe it also resolves some of my
            other problems with various links in email which I want
            to combine with external launchers.

            If you want to get in touch with me about some more
            thoughts, just write me directly to mtung@....

            Best,
            Mike


            Samuel Wright [lykoszine@...] wrote:
            > Hi Michal,
            >
            > I notice you are working on a GTD plugin. Have you tried the existing
            > plugin?
            > http://www.bartholomew.id.au/projects/Project.aspx?ProjectCode=GtdWithVim
            >
            > The other thing of interest (perhaps) is vim outliner
            >
            > I started playing around with that a few days ago.
            >
            > Mor sepcifically regarding your questions, the UTL plugin lets you
            > open plain text 'links' including emails, and other files.
            >
            > I'd be interested to swap thoughts on where you are going with GTD on vim.
            >
            > S

            --
            -------------------------------------------------------------------------
            Dr. Michael M. Tung Email: mtung@...
            Departamento de Matemática Aplicada michael.tung@...
            Universidad Politécnica de Valencia Phone: +34 96 3877000 x88287
            Inst. de Matemática Multidisciplinar +34 96 38-79777
            Edificio 8-G, 2º piso IM: ICQ96423950
            Camino de Vera, s/n
            46022 Valencia (Spain) http://www.uv.es/~tung/
            -------------------------------------------------------------------------
            PGP Public Key http://personales.upv.es/mictun/mtung_pubkey.pgp
            -------------------------------------------------------------------------
          • Stefan Bittner
            Hi Michal, ... The upcoming version utl.vim V2.1 will support preliminary support to reference emails via a new mail: URL like
            Message 5 of 8 , Nov 7, 2006
            • 0 Attachment
              Hi Michal,

              On Fri, Nov 03, 2006 at 11:49:19PM +0100, Michael M. Tung wrote:
              > > Hi Samuel:
              > >
              > > Thanks for the link to GtdWithVim! Actually I saw it
              > > on the vim script site just after writing my hack.
              > >
              > > I didn't have a chance yet to try it out, but as far
              > > as I understand from the script description it's
              > > philosophy is quite different.
              > >
              > > GtdWithVim seems to work independently from any
              > > external program. With vimGTD I just wanted to quickly
              > > write a frontend to PyGTD. So all the power is in there...
              > >
              > > I use vimGTD in mutt and it works well. The UTL plugin
              > > sounds great stuff. Maybe it also resolves some of my
              > > other problems with various links in email which I want
              > > to combine with external launchers.

              The upcoming version utl.vim V2.1 will support preliminary
              support to reference emails via a new mail: URL like

              <URL:mail:///Inbox?07.11.2006 18:38>

              This would open the email which you received on the
              specific date. Other example:

              <URL:mail:///Sent Items?07.11.2006 18:40> .

              Currently I only have an implementation for MS-Outlook
              (which is implemented using OLE Automation via Visual
              Basic Script). It seems you are using the mutt mailer
              though. Anyway, I would be interested to know what
              you mean with "other problems with various links in
              emails..."; perhaps we can dicuss some requirements.
              An implementation for mutt mailer / mbox format should
              not be to difficult then.

              Regards,
              Stefan

              > >
              > > If you want to get in touch with me about some more
              > > thoughts, just write me directly to mtung@....
              > >
              > > Best,
              > > Mike
              > >
              > >
              > > Samuel Wright [lykoszine@...] wrote:
              > > > Hi Michal,
              > > >
              > > > I notice you are working on a GTD plugin. Have you tried the existing
              > > > plugin?
              > > > http://www.bartholomew.id.au/projects/Project.aspx?ProjectCode=GtdWithVim
              > > >
              > > > The other thing of interest (perhaps) is vim outliner
              > > >
              > > > I started playing around with that a few days ago.
              > > >
              > > > Mor sepcifically regarding your questions, the UTL plugin lets you
              > > > open plain text 'links' including emails, and other files.
              > > >
              > > > I'd be interested to swap thoughts on where you are going with GTD on vim.
              > > >
              > > > S
              > >
              > > --
              > > -------------------------------------------------------------------------
              > > Dr. Michael M. Tung Email: mtung@...
              > > Departamento de Matemática Aplicada michael.tung@...
              > > Universidad Politécnica de Valencia Phone: +34 96 3877000 x88287
              > > Inst. de Matemática Multidisciplinar +34 96 38-79777
              > > Edificio 8-G, 2º piso IM: ICQ96423950
              > > Camino de Vera, s/n
              > > 46022 Valencia (Spain) http://www.uv.es/~tung/
              > > -------------------------------------------------------------------------
              > > PGP Public Key http://personales.upv.es/mictun/mtung_pubkey.pgp
              > > -------------------------------------------------------------------------
              > >
              >
              >
              >
              > --
            Your message has been successfully submitted and would be delivered to recipients shortly.