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

accessing vim's clipboard from java

Expand Messages
  • Ernie Rael
    Hi all, I ve just joined this list. I m not a vim developer per se. However, I put together jVi, http://jvi.sourceforge.net , whose core is a port of some of
    Message 1 of 3 , Apr 28, 2007
    • 0 Attachment
      Hi all,
      I've just joined this list. I'm not a vim developer per se. However, I
      put together jVi, http://jvi.sourceforge.net , whose core is a port of
      some of vim to java. It runs on NetBeans ( and JBuilder, but not
      supported any more). jVi is based on vim-5.6.

      A jVi user has added visual char/line and is now tackling block. So now
      I want to setup access to the *real* vim clipboard, so blockmode paste
      works between vim and jVi. So I'm learning how to access "native" data
      formats in clipboard from java.

      I couldn't get anything to work, so I looked at the vim7 source,
      couldn't find windows source (I run cygwin, but not cygwin's vim, at
      home). I downloaded extras. I now see that the clipboard name has
      changed to VimClipboard2, and there's a whole lot more... So I changed
      the name, but still no luck. I thought I'd ping this list in case anyone
      has accessed the vim clipboard from java or has some clues.

      As an experiment I'm doing
      public static final String VIM_CLIPBOARD2 = "VimClipboard2";
      SystemFlavorMap.addFlavorForUnencodedNative(
      ViManager.VIM_CLIPBOARD2, Misc.VimClipboardDataFlavor.get());
      and the other way around. But after a paste into jVi from vim the
      DataFlavor I've defined is not available.

      Any clues?

      In os_mswin.c it looks like VimClipboard2 is always made available, so
      it should be there somewhere.

      Once I get something working, I'll look at doing all the various
      encodings... based on VimClipboard2. Or maybe, I'll use VimClipboard2
      just to find out if it is MCHAR/MLINE/MBLOCK. Then go to the regular
      DataFlavors to pick the string type I'm looking for.

      -ernie
    • A.J.Mechelynck
      ... IIUC, there is no specific interface between Vim and java, so java will have to do whatever any other application may do, without special knowledge about
      Message 2 of 3 , Apr 29, 2007
      • 0 Attachment
        Ernie Rael wrote:
        > Hi all,
        > I've just joined this list. I'm not a vim developer per se. However, I
        > put together jVi, http://jvi.sourceforge.net , whose core is a port of
        > some of vim to java. It runs on NetBeans ( and JBuilder, but not
        > supported any more). jVi is based on vim-5.6.
        >
        > A jVi user has added visual char/line and is now tackling block. So now
        > I want to setup access to the *real* vim clipboard, so blockmode paste
        > works between vim and jVi. So I'm learning how to access "native" data
        > formats in clipboard from java.
        >
        > I couldn't get anything to work, so I looked at the vim7 source,
        > couldn't find windows source (I run cygwin, but not cygwin's vim, at
        > home). I downloaded extras. I now see that the clipboard name has
        > changed to VimClipboard2, and there's a whole lot more... So I changed
        > the name, but still no luck. I thought I'd ping this list in case anyone
        > has accessed the vim clipboard from java or has some clues.
        >
        > As an experiment I'm doing
        > public static final String VIM_CLIPBOARD2 = "VimClipboard2";
        > SystemFlavorMap.addFlavorForUnencodedNative(
        > ViManager.VIM_CLIPBOARD2, Misc.VimClipboardDataFlavor.get());
        > and the other way around. But after a paste into jVi from vim the
        > DataFlavor I've defined is not available.
        >
        > Any clues?
        >
        > In os_mswin.c it looks like VimClipboard2 is always made available, so
        > it should be there somewhere.
        >
        > Once I get something working, I'll look at doing all the various
        > encodings... based on VimClipboard2. Or maybe, I'll use VimClipboard2
        > just to find out if it is MCHAR/MLINE/MBLOCK. Then go to the regular
        > DataFlavors to pick the string type I'm looking for.
        >
        > -ernie
        >

        IIUC, there is no specific interface between Vim and java, so java will have
        to do whatever any other application may do, without special knowledge about Vim.

        Whatever gvim writes to the + register is available in the system clipboard,
        just as if you'd used "Edit => Copy" in just about any application. There's
        nothing Vim-specific there.


        Best regards,
        Tony.
        --
        You know you have a small apartment when Rice Krispies echo.
        -- S. Rickly Christian
      • Ernie Rael
        ... Up to now jVi does exactly as you say. But now I want to get hold of the structure of a VIsual area, so a block paste can be implemented. In os_win32.c
        Message 3 of 3 , Apr 30, 2007
        • 0 Attachment
          > java will have to do whatever any other application may do, without
          > special knowledge about Vim. ... There's nothing Vim-specific there.
          Up to now jVi does exactly as you say. But now I want to get hold of the
          "structure" of a VIsual area, so a block paste can be implemented. In
          os_win32.c there is
          clip_star.format = RegisterClipboardFormat("VimClipboard2");
          clip_star.format_raw = RegisterClipboardFormat("VimRawBytes");
          In java I've registered "VimClipboard2", but I'm not picking it up. The
          name I'm using may not the right one, possible there's some translation
          going on. I've no experience with windows system programming. Or the
          java code is not quite right. I'm pursuing the java side.

          I'm wondering if any vim developers know the exact string that
          VimClipboard2 shows up as if you asked windows what formats were available.

          Thanks,
          -ernie

          A.J.Mechelynck wrote:
          > Ernie Rael wrote:
          >> Hi all,
          >> I've just joined this list. I'm not a vim developer per se. However,
          >> I put together jVi, http://jvi.sourceforge.net , whose core is a port
          >> of some of vim to java. It runs on NetBeans ( and JBuilder, but not
          >> supported any more). jVi is based on vim-5.6.
          >>
          >> A jVi user has added visual char/line and is now tackling block. So
          >> now I want to setup access to the *real* vim clipboard, so blockmode
          >> paste works between vim and jVi. So I'm learning how to access
          >> "native" data formats in clipboard from java.
          >>
          >> I couldn't get anything to work, so I looked at the vim7 source,
          >> couldn't find windows source (I run cygwin, but not cygwin's vim, at
          >> home). I downloaded extras. I now see that the clipboard name has
          >> changed to VimClipboard2, and there's a whole lot more... So I
          >> changed the name, but still no luck. I thought I'd ping this list in
          >> case anyone has accessed the vim clipboard from java or has some clues.
          >>
          >> As an experiment I'm doing
          >> public static final String VIM_CLIPBOARD2 = "VimClipboard2";
          >> SystemFlavorMap.addFlavorForUnencodedNative(
          >> ViManager.VIM_CLIPBOARD2,
          >> Misc.VimClipboardDataFlavor.get());
          >> and the other way around. But after a paste into jVi from vim the
          >> DataFlavor I've defined is not available.
          >>
          >> Any clues?
          >>
          >> In os_mswin.c it looks like VimClipboard2 is always made available,
          >> so it should be there somewhere.
          >>
          >> Once I get something working, I'll look at doing all the various
          >> encodings... based on VimClipboard2. Or maybe, I'll use VimClipboard2
          >> just to find out if it is MCHAR/MLINE/MBLOCK. Then go to the
          >> regular DataFlavors to pick the string type I'm looking for.
          >>
          >> -ernie
          >>
          >
          > IIUC, there is no specific interface between Vim and java, so java
          > will have to do whatever any other application may do, without special
          > knowledge about Vim.
          >
          > Whatever gvim writes to the + register is available in the system
          > clipboard, just as if you'd used "Edit => Copy" in just about any
          > application. There's nothing Vim-specific there.
          >
          >
          > Best regards,
          > Tony.
        Your message has been successfully submitted and would be delivered to recipients shortly.