Adding new stuff
This commit is contained in:
parent
7b21428a6d
commit
1af5220491
449 changed files with 2 additions and 1 deletions
37
vim-plugins/bundle/python-mode/autoload/pymode/doc.vim
Normal file
37
vim-plugins/bundle/python-mode/autoload/pymode/doc.vim
Normal file
|
|
@ -0,0 +1,37 @@
|
|||
" Python-mode search by documentation
|
||||
"
|
||||
PymodePython import pymode
|
||||
|
||||
fun! pymode#doc#find() "{{{
|
||||
" Extract the 'word' at the cursor, expanding leftwards across identifiers
|
||||
" and the . operator, and rightwards across the identifier only.
|
||||
"
|
||||
" For example:
|
||||
" import xml.dom.minidom
|
||||
" ^ !
|
||||
"
|
||||
" With the cursor at ^ this returns 'xml'; at ! it returns 'xml.dom'.
|
||||
let l:line = getline(".")
|
||||
let l:pre = l:line[:col(".") - 1]
|
||||
let l:suf = l:line[col("."):]
|
||||
let word = matchstr(pre, "[A-Za-z0-9_.]*$") . matchstr(suf, "^[A-Za-z0-9_]*")
|
||||
call pymode#doc#show(word)
|
||||
endfunction "}}}
|
||||
|
||||
fun! pymode#doc#show(word) "{{{
|
||||
if a:word == ''
|
||||
call pymode#error("No name/symbol under cursor!")
|
||||
return 0
|
||||
endif
|
||||
|
||||
call pymode#tempbuffer_open('__doc__')
|
||||
PymodePython pymode.get_documentation()
|
||||
setlocal nomodifiable
|
||||
setlocal nomodified
|
||||
setlocal filetype=rst
|
||||
if g:pymode_doc_vertical
|
||||
wincmd L
|
||||
endif
|
||||
wincmd p
|
||||
|
||||
endfunction "}}}
|
||||
Loading…
Add table
Add a link
Reference in a new issue