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

Re: Autocommand-Event for Clipboard-Changed

Expand Messages
  • Nikolai Weibull
    ... The windows api provides an easy way to be notified of such changes. It s just a WM_ message that you hook into by calling some function that I can t
    Message 1 of 10 , Oct 2, 2006
    • 0 Attachment
      On 10/2/06, Bram Moolenaar <Bram@...> wrote:
      >
      > Suresh Govindachar wrote:
      >
      > > Is it possible to add an autocommand-event for "Clipboard Changed"?
      >
      > Not really. This is not something that happens inside Vim. Polling for
      > changes in the system is not really something I would like to add to Vim.

      The windows api provides an easy way to be notified of such changes.
      It's just a WM_ message that you hook into by calling some function
      that I can't remember the name of.

      X11 and Gdk has something similar as well, but I've never used it.

      I have no idea if there's a good way to do it on other systems,
      though. (I'm guessing that OS X has something like this as well.)

      nikolai
    • Charles E Campbell Jr
      ... Bram -- would you be willing to give out a bit of code that will send a remote message to vim? Some function, perhaps SendCmd2Vim( string ). That way
      Message 2 of 10 , Oct 3, 2006
      • 0 Attachment
        Bram Moolenaar wrote:

        >Suresh Govindachar wrote:
        >
        >
        >>Is it possible to add an autocommand-event for "Clipboard Changed"?
        >>
        >>
        >
        >Not really. This is not something that happens inside Vim. Polling for
        >changes in the system is not really something I would like to add to Vim.
        >
        >
        Bram -- would you be willing to give out a bit of code that will send a
        remote message to vim?
        Some function, perhaps SendCmd2Vim("string"). That way it'll be simple
        for folks to make their
        own external programs to send a command to vim via the already available
        remote vim stuff.

        Presumably the code snippet wouldn't be a Part of Vim itself; maybe
        something for vim.sf.net?

        Just an idea...
        Chip Campbell
      • A.J.Mechelynck
        ... etc. For other programs: there are two protocols used: Windows and X11. You may want to dig into the Vim source to see how it does it. The server code (or
        Message 3 of 10 , Oct 3, 2006
        • 0 Attachment
          Charles E Campbell Jr wrote:
          > Bram Moolenaar wrote:
          >
          >> Suresh Govindachar wrote:
          >>
          >>
          >>> Is it possible to add an autocommand-event for "Clipboard Changed"?
          >>>
          >>
          >> Not really. This is not something that happens inside Vim. Polling for
          >> changes in the system is not really something I would like to add to Vim.
          >>
          >>
          > Bram -- would you be willing to give out a bit of code that will send a
          > remote message to vim?
          > Some function, perhaps SendCmd2Vim("string"). That way it'll be simple
          > for folks to make their
          > own external programs to send a command to vim via the already available
          > remote vim stuff.
          >
          > Presumably the code snippet wouldn't be a Part of Vim itself; maybe
          > something for vim.sf.net?
          >
          > Just an idea...
          > Chip Campbell
          >
          >

          :call remote_send({server}, {string}[, {idvar}])

          :let x = remote_expr({server}, {string}[, {idvar}])

          etc.

          For other programs: there are two protocols used: Windows and X11. You may
          want to dig into the Vim source to see how it does it. The server code (or the
          X11 server code?) is in src/if_xcmdsrv.c. The client code may be in eval.c or
          something -- look for Vim functions with names starting "remote_" (or C
          functions with names starting "f_remote_"). In the source I have here
          (7.0.114) there is an #ifdef FEAT_CLIENTSERVER at eval_c line 13051.


          Best regards,
          Tony.
        • Bram Moolenaar
          ... I don t know what you mean with would you be willing . src/if_xcmdsrv.c contains info for writing a C program. os_mswin.c also has some code that can be
          Message 4 of 10 , Oct 3, 2006
          • 0 Attachment
            Charles Campbell wrote:

            > Bram Moolenaar wrote:
            >
            > >Suresh Govindachar wrote:
            > >
            > >>Is it possible to add an autocommand-event for "Clipboard Changed"?
            > >
            > >Not really. This is not something that happens inside Vim. Polling for
            > >changes in the system is not really something I would like to add to Vim.
            >
            > Bram -- would you be willing to give out a bit of code that will send a
            > remote message to vim?
            > Some function, perhaps SendCmd2Vim("string"). That way it'll be simple
            > for folks to make their own external programs to send a command to vim
            > via the already available remote vim stuff.
            >
            > Presumably the code snippet wouldn't be a Part of Vim itself; maybe
            > something for vim.sf.net?

            I don't know what you mean with "would you be willing".
            src/if_xcmdsrv.c contains info for writing a C program. os_mswin.c also
            has some code that can be used for Win32. It's not easy, of course.
            I can't remember seeing a program that actually does this.

            --
            Engineers will go without food and hygiene for days to solve a problem.
            (Other times just because they forgot.)
            (Scott Adams - The Dilbert principle)

            /// Bram Moolenaar -- Bram@... -- http://www.Moolenaar.net \\\
            /// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
            \\\ download, build and distribute -- http://www.A-A-P.org ///
            \\\ help me help AIDS victims -- http://ICCF-Holland.org ///
          • Yakov Lerner
            ... Charles, What s wrong with doing system( vim --remote-xxx yyy zzz ) in any programming language ? Yakov
            Message 5 of 10 , Oct 3, 2006
            • 0 Attachment
              On 10/3/06, Charles E Campbell Jr <drchip@...> wrote:
              > Bram Moolenaar wrote:
              >
              > >Suresh Govindachar wrote:
              > >
              > >
              > >>Is it possible to add an autocommand-event for "Clipboard Changed"?
              > >>
              > >>
              > >
              > >Not really. This is not something that happens inside Vim. Polling for
              > >changes in the system is not really something I would like to add to Vim.
              > >
              > >
              > Bram -- would you be willing to give out a bit of code that will send a
              > remote message to vim?
              > Some function, perhaps SendCmd2Vim("string"). That way it'll be simple
              > for folks to make their
              > own external programs to send a command to vim via the already available
              > remote vim stuff.

              Charles,
              What's wrong with doing system("vim --remote-xxx yyy zzz") in
              any programming language ?

              Yakov
            • Charles E Campbell Jr
              ... Seems grossly inefficient: with this call one is bringing up both a new shell and a new vim, although the new vim probably doesn t do too much other than
              Message 6 of 10 , Oct 3, 2006
              • 0 Attachment
                Yakov Lerner wrote:

                > What's wrong with doing system("vim --remote-xxx yyy zzz") in
                > any programming language ?

                Seems grossly inefficient: with this call one is bringing up both a new
                shell and a new vim,
                although the new vim probably doesn't do too much other than send the
                command.

                Regards,
                Chip Campbell
              • Yegappan Lakshmanan
                Hi Charles, ... Are you referring to a sample code similar to the xcmdsrv_client.c file under the $VIM/tools directory? This sample code shows how to send
                Message 7 of 10 , Oct 3, 2006
                • 0 Attachment
                  Hi Charles,

                  On 10/3/06, Charles E Campbell Jr <drchip@...> wrote:
                  > Bram Moolenaar wrote:
                  >
                  > >Suresh Govindachar wrote:
                  > >
                  > >
                  > >>Is it possible to add an autocommand-event for "Clipboard Changed"?
                  > >>
                  > >>
                  > >
                  > >Not really. This is not something that happens inside Vim. Polling for
                  > >changes in the system is not really something I would like to add to Vim.
                  > >
                  > >
                  > Bram -- would you be willing to give out a bit of code that will send a
                  > remote message to vim?
                  > Some function, perhaps SendCmd2Vim("string"). That way it'll be simple
                  > for folks to make their
                  > own external programs to send a command to vim via the already available
                  > remote vim stuff.
                  >
                  > Presumably the code snippet wouldn't be a Part of Vim itself; maybe
                  > something for vim.sf.net?
                  >
                  > Just an idea...
                  > Chip Campbell
                  >

                  Are you referring to a sample code similar to the xcmdsrv_client.c file under
                  the $VIM/tools directory? This sample code shows how to send commands
                  to a remote Vim from a C program in Unix systems running X-Windows.
                  A similar sample code for MS-Windows is needed.

                  - Yegappan
                • Charles E Campbell Jr
                  ... Looks like Bram is a precognitive! Yep, that s what I meant. Regards, Chip Campbell
                  Message 8 of 10 , Oct 3, 2006
                  • 0 Attachment
                    Yegappan Lakshmanan wrote:

                    > Are you referring to a sample code similar to the xcmdsrv_client.c
                    > file under
                    > the $VIM/tools directory? This sample code shows how to send commands
                    > to a remote Vim from a C program in Unix systems running X-Windows.
                    > A similar sample code for MS-Windows is needed.

                    Looks like Bram is a precognitive! Yep, that's what I meant.

                    Regards,
                    Chip Campbell
                  Your message has been successfully submitted and would be delivered to recipients shortly.