From a6ffae1776eee15a1e153fd499f36b0ec852618f Mon Sep 17 00:00:00 2001 From: David Halter Date: Wed, 5 Sep 2012 14:19:40 +0200 Subject: [PATCH] pydoc works now also if the cursor is on the class / created context possibility for completions (backward tokenizer) --- jedi.vim | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/jedi.vim b/jedi.vim index 3e141bd..5371a04 100644 --- a/jedi.vim +++ b/jedi.vim @@ -109,9 +109,11 @@ if 1: vim.command('normal! K') vim.command('return') else: - docs = ['|Docstring of %s|\n%s' % (d, d.doc) for d in definitions] - text = ('-' * 79).join(docs) + docs = ['|Docstring for %s|\n%s' % (d, d.doc) if d.doc + else '|No Docstring for %s|' % d for d in definitions] + text = ('\n' + '-' * 79 + '\n').join(docs) vim.command('let l:doc = %s' % repr(PythonToVimStr(text))) + vim.command('let l:doc_lines = %s' % len(text.split('\n'))) PYTHONEOF if bufnr("__doc__") > 0 " If the __doc__ buffer is open in the current window, jump to it @@ -119,6 +121,7 @@ PYTHONEOF else split '__doc__' endif + setlocal modifiable setlocal noswapfile setlocal buftype=nofile @@ -128,6 +131,11 @@ PYTHONEOF setlocal nomodifiable setlocal nomodified + if l:doc_lines > 20 " max 20 lines for plugin + let l:doc_lines = 20 + endif + execute "resize ".l:doc_lines + " TODO more highlightings highlight jedi_doc ctermbg=green guibg=green match jedi_doc /^|.*|\n/