0

We know that pressing 'K' will trigger the manual page for the underlying language. I am writing a syntax file for a language, and the document is online only. So I would like to know

  1. How do I react to 'K'?
  2. How do I, rather than calling "man" on that keyword, pop up a new browser window and open the given page?

Thanks!

  • Behaviour belongs in a filetype plugin, not a syntax file. – Antony May 1 '17 at 20:09
8

Pressing K runs the program given by keywordprg (kp).

If you do :set keywordprg? it should reply keywordprg=man by default.

So simply set keywordprg to a program of choice, which will get the language name as input. Check if the language is the one you want and fire it up in the browser, otherwise call man on the input as usual.

:help K tells you this and more

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.