History Report a problem
Article Edit this page Discussion

Access Python Help

From Vim Tips Wiki

Jump to: navigation, search
 

Tip 556Previous TipNext Tip

Created: September 11, 2003 Complexity: basic Author: Fritz Cizmarov Minimum version: 6.0 Karma: 4/4 Imported from: Tip#556


Add the following two lines to your ~/.vim/ftplugin/python.vim. Then open any Python script. You can place the cursor on a keyword, and press F2 to view Help.

map <F2> :exec "!xterm -e 'pydoc ".expand("<cword>")."'"<CR><CR>
imap <F2> <ESC>:exec "!xterm -e 'pydoc ".expand("<cword>")."'"<CR><CR>i

If it does not work, be sure that xterm and pydoc exist. To see the return message in Vim, delete the last <CR> in the lines.

[edit] Comments

 

You can open the doc inside Vim like this:

function! ShowDoc(name)
  enew
  execute "read !pydoc " . a:name
  setlocal nomodifiable
  setlocal nomodified
  set filetype=man
  normal 1G
endfunction
map <buffer> <silent> +m :call ShowDoc("<C-R><C-W>")<CR>

This is not tested, but I use something very similar for Perl.


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
Doctor Who
Legend of Zelda Wiki
Terminator Wiki
Everquest II Wiki
Mystery Science Theater 3000
German
Spanish
Chinese
Japanese
More...
Wikia is hiring for several open positions
Send this article to a friend
"Access Python Help"
 
 
Hi!

I thought you'd like this page from Wikia!

http://vim.wikia.com

Come check it out!
Send confirmation