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

Shift-K, Win2k, Java API. How?

Expand Messages
  • Kerry Sainsbury
    Hi Folks, I have a dream: When editing Java code I want Shift-K to fire up Java API docs for the current keyword. And this needs to work on a Win2K box.
    Message 1 of 7 , May 2, 2003
      Hi Folks,

      I have a dream:

      When editing Java code I want Shift-K to fire up Java API docs for the
      current keyword. And this needs to work on a Win2K box. Shudder.

      I found a winhelp version of the JDK api, and know that I can start
      "winhelp" with a keyword:

      c:\winnt\winhlp32 -kYourKeyword c:\docs\jdk-winhelp\jdk14.hlp

      ... and I know about "keywordprg", but it doesn't seem to support the
      arguments needed by the above, so I created a dumb batch file,
      "jdkhelp.bat" that looks like this:

      c:\winnt\winhlp32 -k%1 c:\docs\jdk-winhelp\jdk14.hlp
      and
      set keywordprg=jdkhelp.bat

      Now this works, but every man and his dog insists that I hit return, a lot.

      1. Press Shift-K on keyword
      2. See WinHelp popup with correct documentation (woo-hoo!)
      3. Close WinHelp (it's work here is done)
      4. See sneaky "vimrun.exe" dos box, demanding I "Hit any key to close
      this window"

      C:\WINNT\system32\cmd.exe /c jdkhelp.bat Properties
      c:\winnt\winhlp32 -kProperties c:\docs\jdk-winhelp\jdk14.hlp
      Hit any key to close this window...

      5. Hit the "any" key (twice!) and return to vim
      6. Vim asks me to "Hit ENTER or type command to continue"
      7. Hit ENTER
      8. Continue merrily to work.

      I've tried "start" ing winhlp32, but it made no difference to anything.
      I've tried "set keywordprg=jdkhelp.bat &", ditto.

      Anybody know how I can get rid of all those superfluous key-presses?

      Can I send steps 5, 6, and 7 to that great bit-bucket in the sky?
      Can I hide the vimrun dos-box in step 4?

      I've searching archives, faqs, and tips, but to no avail.

      (btw, the link at http://www.vim.org/maillist.php to the tips page is
      broken, it uses http://www.vim.org/tip_index.php, which gives a 404)

      Thanks for any help you can give.

      Cheers,
      Kerry
      PS: vim 6.1
    • Jürgen Krämer
      Hi, ... c: docs jdk-winhelp jdk14.hlp (this should go in one line). This obviously does not use keywordprg but a mapping. The word under the cursor is
      Message 2 of 7 , May 2, 2003
        Hi,

        Kerry Sainsbury wrote:
        >
        > When editing Java code I want Shift-K to fire up Java API docs for the
        > current keyword. And this needs to work on a Win2K box. Shudder.
        >
        > I found a winhelp version of the JDK api, and know that I can start
        > "winhelp" with a keyword:
        >
        > c:\winnt\winhlp32 -kYourKeyword c:\docs\jdk-winhelp\jdk14.hlp
        >
        > ... and I know about "keywordprg", but it doesn't seem to support the
        > arguments needed by the above, so I created a dumb batch file,
        > "jdkhelp.bat" that looks like this:>
        > c:\winnt\winhlp32 -k%1 c:\docs\jdk-winhelp\jdk14.hlp
        > and
        > set keywordprg=jdkhelp.bat
        >
        > Now this works, but every man and his dog insists that I hit return, a lot.
        >
        > 1. Press Shift-K on keyword
        > 2. See WinHelp popup with correct documentation (woo-hoo!)
        > 3. Close WinHelp (it's work here is done)
        > 4. See sneaky "vimrun.exe" dos box, demanding I "Hit any key to close
        > this window"
        >
        > C:\WINNT\system32\cmd.exe /c jdkhelp.bat Properties
        > c:\winnt\winhlp32 -kProperties c:\docs\jdk-winhelp\jdk14.hlp
        > Hit any key to close this window...
        >
        > 5. Hit the "any" key (twice!) and return to vim
        > 6. Vim asks me to "Hit ENTER or type command to continue"
        > 7. Hit ENTER
        > 8. Continue merrily to work.
        >
        > I've tried "start" ing winhlp32, but it made no difference to anything.
        > I've tried "set keywordprg=jdkhelp.bat &", ditto.
        >
        > Anybody know how I can get rid of all those superfluous key-presses?

        :nmap K :!start c:\winnt\system32\winhlp32.exe -k<C-R><C-W>
        c:\docs\jdk-winhelp\jdk14.hlp<CR><CR>

        (this should go in one line). This obviously does not use keywordprg but
        a mapping. The word under the cursor is inserted with <C-R><C-W>. The
        first <CR> at the end of the right hand side executes the !start command
        which does not open a console window as a side effect, and the second
        <CR> gives vim the return it demands.

        Regards,
        Jürgen

        --
        Sometimes I think the surest sign that intelligent life exists elsewhere
        in the universe is that none of it has tried to contact us. (Calvin)
      • Dan Sharp
        ... Not what you want with Shift-K, but you may want to look at http://www.vim.org/scripts/script.php?script_id=358 which appears to do what you want. It uses
        Message 3 of 7 , May 2, 2003
          Kerry Sainsbury wrote:
          > Hi Folks,
          >
          > I have a dream:
          >
          > When editing Java code I want Shift-K to fire up Java API docs for the
          > current keyword. And this needs to work on a Win2K box. Shudder.

          Not what you want with Shift-K, but you may want to look at
          http://www.vim.org/scripts/script.php?script_id=358 which appears to do
          what you want. It uses <F3>, but you could probably change the mapping
          yourself.

          Dan Sharp
        • Sean Richards
          ... http://www.vim.org/tips/tip.php?tip_id=232 Just change the keymap to suit Cheers, Sean --
          Message 4 of 7 , May 2, 2003
            Kerry Sainsbury wrote:
            > Hi Folks,
            >
            > I have a dream:
            >
            > When editing Java code I want Shift-K to fire up Java API docs for the
            > current keyword. And this needs to work on a Win2K box. Shudder.
            >
            > I found a winhelp version of the JDK api, and know that I can start
            > "winhelp" with a keyword:
            >

            http://www.vim.org/tips/tip.php?tip_id=232

            Just change the keymap to suit

            Cheers, Sean

            --
            +---------------------------------------------------------------+
            | All spelling errors are intentional and are there to show new |
            | and improved ways of spelling old words. |
            +---------------------------------------------------------------+
          • Martin Metz
            ... [Java API help on key] ... Sounds nice! But it s not working. I must have made something wrong. I wanted to test it with Mozilla (yes, I read the warnings)
            Message 5 of 7 , May 5, 2003
              Dan Sharp wrote:
              > Kerry Sainsbury wrote:

              [Java API help on key]

              > Not what you want with Shift-K, but you may want to look at
              > http://www.vim.org/scripts/script.php?script_id=358 which appears to do
              > what you want. It uses <F3>, but you could probably change the mapping
              > yourself.

              Sounds nice!
              But it's not working. I must have made something wrong.
              I wanted to test it with Mozilla (yes, I read the warnings) but nothing
              happens.
              My configuration is:

              " settings for plugin: java_apidoc.vim (Javadoc viewer):
              au FileType java let
              browser="D:\\Programme\\mozilla.org\\Mozilla_13\\mozilla.exe"
              au FileType java let
              javadoc_path="D:\\java\\jdk1.4.1_01\\JDK1.4\\docs\\index.html,H:\\global\\builds\\head\\doc\\java\\index.html"
              au FileType java nmap K viw"jy:call OpenJavadoc("^Rj")^M


              ^R and ^M are right (inserted with <CTRL>V) but when I press K I only
              read something like ":call OpenJavadoc("JList")" in the ex command line.
              Can anybody help me? I'm using Windows NT 4.0 an VIM 6.0


              --
              Gruesse,

              Martin Metz

              /***************************************************************
              * Dipl. Inform. (FH) Martin Metz - Software engineering
              *
              * OneVision Software AG | Phone: +49-941-780040
              * Dr.-Leo-Ritter-Str. 9 | FAX: +49-941-7800449
              * 93049 Regensburg | mailto:Martin.Metz@...
              * Germany | WWW: http://www.OneVision.de
              **************************************************************/
            • William Lee
              ... Also, see JavaImp.vim at http://www.vim.org/scripts/script.php?script_id=325. It does more than java docs (you can actually open the file from the name,
              Message 6 of 7 , May 5, 2003
                Dan Sharp wrote:
                > Kerry Sainsbury wrote:
                >
                >> Hi Folks,
                >>
                >> I have a dream:
                >>
                >> When editing Java code I want Shift-K to fire up Java API docs for the
                >> current keyword. And this needs to work on a Win2K box. Shudder.
                >
                >
                > Not what you want with Shift-K, but you may want to look at
                > http://www.vim.org/scripts/script.php?script_id=358 which appears to do
                > what you want. It uses <F3>, but you could probably change the mapping
                > yourself.
                >
                > Dan Sharp
                >

                Also, see JavaImp.vim at
                http://www.vim.org/scripts/script.php?script_id=325. It does more than
                java docs (you can actually open the file from the name, manage your
                import statements, etc.).

                --
                William Lee (Will) | Sendmail Inc.
                Email: wlee@... | http://www.sendmail.com
                Tel: (510) 594-5505 |
              • Martin Metz
                ... Great! I just tested this plugin and really love it. I used an older version (round about 1.1) but the new features (open docu, open souce) are much more
                Message 7 of 7 , May 6, 2003
                  William Lee wrote:
                  >
                  > Also, see JavaImp.vim at
                  > http://www.vim.org/scripts/script.php?script_id=325. It does more than
                  > java docs (you can actually open the file from the name, manage your
                  > import statements, etc.).

                  Great! I just tested this plugin and really love it.
                  I used an older version (round about 1.1) but the new features (open
                  docu, open souce) are much more valuable than the import statements.

                  --
                  Gruesse,

                  Martin Metz

                  /***************************************************************
                  * Dipl. Inform. (FH) Martin Metz - Software engineering
                  *
                  * OneVision Software AG | Phone: +49-941-780040
                  * Dr.-Leo-Ritter-Str. 9 | FAX: +49-941-7800449
                  * 93049 Regensburg | mailto:Martin.Metz@...
                  * Germany | WWW: http://www.OneVision.de
                  **************************************************************/
                Your message has been successfully submitted and would be delivered to recipients shortly.