mirror of
https://github.com/davidhalter/jedi.git
synced 2025-12-08 14:54:47 +08:00
vim-jedi pydoc: better formatting
This commit is contained in:
@@ -98,7 +98,7 @@ class Definition(object):
|
|||||||
|
|
||||||
if isinstance(d, evaluate.Array):
|
if isinstance(d, evaluate.Array):
|
||||||
d = 'class ' + d.type
|
d = 'class ' + d.type
|
||||||
elif isinstance(d, (evaluate.Class, evaluate.Instance)):
|
elif isinstance(d, (parsing.Class, evaluate.Class, evaluate.Instance)):
|
||||||
d = 'class ' + str(d.name)
|
d = 'class ' + str(d.name)
|
||||||
elif isinstance(d, (evaluate.Function, evaluate.parsing.Function)):
|
elif isinstance(d, (evaluate.Function, evaluate.parsing.Function)):
|
||||||
d = 'def ' + str(d.name)
|
d = 'def ' + str(d.name)
|
||||||
|
|||||||
@@ -117,7 +117,7 @@ if 1:
|
|||||||
PYTHONEOF
|
PYTHONEOF
|
||||||
if bufnr("__doc__") > 0
|
if bufnr("__doc__") > 0
|
||||||
" If the __doc__ buffer is open in the current window, jump to it
|
" If the __doc__ buffer is open in the current window, jump to it
|
||||||
silent execute "sbuffer" bufnr("__doc__")
|
silent execute "sbuffer ".bufnr("__doc__")
|
||||||
else
|
else
|
||||||
split '__doc__'
|
split '__doc__'
|
||||||
endif
|
endif
|
||||||
@@ -137,9 +137,15 @@ PYTHONEOF
|
|||||||
endif
|
endif
|
||||||
execute "resize ".l:doc_lines
|
execute "resize ".l:doc_lines
|
||||||
|
|
||||||
" TODO more highlightings
|
nnoremap <buffer> q ZQ
|
||||||
"highlight jedi_doc ctermbg=green guibg=green
|
unlet! b:current_syntax
|
||||||
"match jedi_doc /^|.*|\n/
|
let l:pythonpath = fnameescape(globpath(&rtp,"syntax/python.vim"))
|
||||||
|
exe "syn include @rstPythonScript ".l:pythonpath
|
||||||
|
" 4 spaces
|
||||||
|
syn region rstPythonRegion start=/^\v {4}/ end=/\v^( {4}|\n)@!/ contains=@rstPythonScript
|
||||||
|
" >>> python code
|
||||||
|
syn region rstPythonRegion matchgroup=pythonDoctest start=/^>>>\s*/ end=/\n/ contains=@rstPythonScript
|
||||||
|
let b:current_syntax = "rst"
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
" ------------------------------------------------------------------------
|
" ------------------------------------------------------------------------
|
||||||
@@ -253,6 +259,7 @@ if g:jedi#popup_on_dot
|
|||||||
autocmd FileType python imap . .<C-R>=jedi#do_popup_on_dot() ? "\<lt>C-X>\<lt>C-O>" : ""<CR>
|
autocmd FileType python imap . .<C-R>=jedi#do_popup_on_dot() ? "\<lt>C-X>\<lt>C-O>" : ""<CR>
|
||||||
end
|
end
|
||||||
|
|
||||||
|
setlocal switchbuf=useopen " needed for pydoc
|
||||||
let s:current_file=expand("<sfile>")
|
let s:current_file=expand("<sfile>")
|
||||||
|
|
||||||
python << PYTHONEOF
|
python << PYTHONEOF
|
||||||
|
|||||||
@@ -1,3 +1,14 @@
|
|||||||
|
# -----------------
|
||||||
|
# cursor position
|
||||||
|
# -----------------
|
||||||
|
#? 0 int
|
||||||
|
int()
|
||||||
|
#? 3 int
|
||||||
|
int()
|
||||||
|
#? 4 str
|
||||||
|
int(str)
|
||||||
|
|
||||||
|
|
||||||
# -----------------
|
# -----------------
|
||||||
# if/else/elif
|
# if/else/elif
|
||||||
# -----------------
|
# -----------------
|
||||||
|
|||||||
Reference in New Issue
Block a user