History
Article Edit this page Discussion

Open Windows Help files on a specific topic

From Vim Tips Wiki

Jump to: navigation, search

Tip 506 Previous Next Created: July 8, 2003 Complexity: intermediate Author: David Fishburn Version: 6.0


In Windows XP or similar, you can have Vim open a chm (HTML Help) file at a specific topic. The following example launches the ASA9 Help file on the CWORD at the cursor, or at the visually-selected topic.

nnoremap <C-F1> :silent! !cmd.exe /c start keyhh.exe -\#klink "<C-R><C-W>" "$ASANY9\docs\dbmaen9.chm"<CR><CR>
vnoremap <C-F1> :<C-U>let old_reg=@"<CR>gvy:silent!!cmd.exe /cstart keyhh.exe -\#klink "<C-R><C-R>"" "$ASANY9\docs\dbmaen9.chm"<CR><CR>:let @"=old_reg<CR>:echo ""<CR>

The nnoremap opens the help file using the <CWORD> that the cursor is on.

The vnoremap allows you to visually select a block of text and open the search window with that text. It also restores whatever was previously visually selected after the launch.

If you use the map repeatedly, the same HTML Help window will be used.

Download keyhh.exe (free) from http://www.keyworks.net/keyhh.htm

[edit] Comments

It would be really cool to use this as your keywordprg (:help 'keywordprg').

Unfortunately keywordprg requires that the keyword become the last argument to the program. Moreover the keywordprg is run through vimrun which requires you to close the command prompt that launch the program manually (the "Press any key to close this window" message).


Rate this article:

Share this article:

Hubs Highlights International Sites Wikia messages
Entertainment
Gaming
Cartoons & Comics
Science Fiction
Hobbies
Sports
See all...
Grand Theft Auto
Pixar
Legend of Zelda Wiki
Terminator Wiki
Everquest II Wiki
Dark Shadows
German
Spanish
Chinese
Japanese
More...
Wikia is hiring for several open positions


Vote for collaboration of the month.

Send this article to a friend
"Open Windows Help files on a specific topic"
 
 
Hi!

I thought you'd like this page from Wikia!

http://vim.wikia.com

Come check it out!
Send confirmation