fs111 / pydoc.vim Goto Github PK
View Code? Open in Web Editor NEWpydoc integration for the best text editor on earth
Home Page: http://www.vim.org/scripts/script.php?script_id=910
pydoc integration for the best text editor on earth
Home Page: http://www.vim.org/scripts/script.php?script_id=910
pydoc.vim integrates Python documentation system into Vim. If you use Vim and Python, you want to use it :-) pydoc.vim is an ftplugin and has to be installed in your ftplugin directory. Installing it in the plugin directory won't work. Also note that you need a line like the following in your .vimrc file: filetype plugin on You can find the complete documentation in the code itself. Happy hacking!
I found that pydoc conflicts with the python.vim
filetype script that comes with Vim. In my system, this file is /usr/share/vim/vim73/ftplugin/python.vim
.
I discovered this because the omnifunc
was set to nothing. If I remove pydoc, omnifunc
is set again correctly to omnifunc=pythoncomplete#Complete
as it always should be.
The thing is that I don't know if two filetype scripts can be executed for some file of a certain type (e.g.: Python), which would solve this issue. We just have to let the original python.vim to run again.
I'm gonna try to look for a solution.
Any suggestion?
The next lines which enables the mapping <leader>p...
do not work if the first file is a Python file, because those autocmd are activated in the next buffer created with a Python file:
au FileType python,man map <buffer> <leader>pw :call ShowPyDoc('<C-R><C-W>', 1)<CR>
au FileType python,man map <buffer> <leader>pW :call ShowPyDoc('<C-R><C-A>', 1)<CR>
au FileType python,man map <buffer> <leader>pk :call ShowPyDoc('<C-R><C-W>', 0)<CR>
au FileType python,man map <buffer> <leader>pK :call ShowPyDoc('<C-R><C-A>', 0)<CR>
And, could be better to use noremap
than map
, safer?
I am going to fork this project and try to fix it if you want ;-)
By the way, I like the plugin!
It would be nice if the mappings were done through <Plug>
mappings (see :h using-<Plug>
).
This way you could create your own maps more easily.
Maybe also / instead the main function s:ShowPyDoc
could be made public, e.g. as PydocShowDoc
.
The python_pydoc.vim file will set b:did_ftplugin = 1
, which will prevent the official ftplugin from loading (and setting up the omnifunc variable).
WIthout digging too much into both ftplugins I would say that python_pydoc.vim should either not change b:did_ftplugin or at least handle omnifunc, too.
Update the README to explain the correct installation and upload the latest version to vim.org
does it show help in scratch buffer instead of split ?
When modules are imported as from foo import bar
the plugin fails to find the documentation of bar
.
For instance, <leader>pw
on bar
in the following code will result in no Python documentation found
:
from foo import bar
my_var = bar(my_args)
while <leader>pW
on bar
in the following code works as expected:
import foo.bar
my_var = foo.bar(my_args)
I'm having an unusual problem in that pydoc is opening on the right-hand side of a diff window instead of just in a split. I've checked my vimrc and I haven't redefined the pydoc_open_cmd
command. When I do :verbose map K
I get:
*@:call ShowPyDoc(expand("<cword>"), 1)<CR>
which is correct (I think). I've actually tried to set let g:pydoc_open_cmd = \"tabnew"
in my vimrc, but that gives me an error: E127: Cannot redefine function ShowPyDoc: It is in use
Actually I expect this plugin to only change the mapping for K
if I currently edit a python file.
If I edit a c file or any other format, I still want to open man
with K
.
It gets set using setlocal
, but is a global setting.
https://github.com/fs111/pydoc.vim/blob/master/ftplugin/python_pydoc.vim#L120
I'd suggest adding info to the header documentation in the ftplugin, about the position-dependent behavior of K. Specifically, that it doesn't cross '.' boundaries to the right, only to the left. I can see why you did it that way, and I can see the value, but it wasn't what I was expecting K to do, as it doesn't normally act that way. I didn't discover that I wasn't going to have to remap K or manually use pW until I read the definition of ExpandModulePath :).
Thanks. Quite liking the ftplugin so far.
I just checked out the repo and now receive this when opening a Python file: any thoughts? http://cl.ly/0h1y3W0x2I2C1j2H3v1W
Matthews-MacBook-Air:~/code/libgreader$ vim --version
VIM - Vi IMproved 7.3 (2010 Aug 15, compiled Jul 30 2011 14:34:38)
MacOS X (unix) version
Included patches: 1-260
Compiled by [email protected]
Huge version with MacVim GUI. Features included (+) or not (-):
+arabic +autocmd +balloon_eval +browse ++builtin_terms +byte_offset +cindent
+clientserver +clipboard +cmdline_compl +cmdline_hist +cmdline_info +comments
+conceal +cryptv -cscope +cursorbind +cursorshape +dialog_con_gui +diff
+digraphs +dnd -ebcdic +emacs_tags +eval +ex_extra +extra_search +farsi
+file_in_path +find_in_path +float +folding -footer +fork() +fullscreen
-gettext -hangul_input +iconv +insert_expand +jumplist +keymap +langmap
+libcall +linebreak +lispindent +listcmds +localmap -lua +menu +mksession
+modify_fname +mouse +mouseshape +mouse_dec -mouse_gpm -mouse_jsbterm
+mouse_netterm -mouse_sysmouse +mouse_xterm +multi_byte +multi_lang -mzscheme
+netbeans_intg +odbeditor +path_extra +perl +persistent_undo +postscript
+printer +profile +python -python3 +quickfix +reltime +rightleft +ruby
+scrollbind +signs +smartindent -sniff +startuptime +statusline -sun_workshop
+syntax +tag_binary +tag_old_static -tag_any_white +tcl +terminfo +termresponse
+textobjects +title +toolbar +transparency +user_commands +vertsplit
+virtualedit +visual +visualextra +viminfo +vreplace +wildignore +wildmenu
+windows +writebackup -X11 -xfontset +xim -xsmp -xterm_clipboard -xterm_save
system vimrc file: "$VIM/vimrc"
user vimrc file: "$HOME/.vimrc"
user exrc file: "$HOME/.exrc"
system gvimrc file: "$VIM/gvimrc"
user gvimrc file: "$HOME/.gvimrc"
system menu file: "$VIMRUNTIME/menu.vim"
fall-back for $VIM: "/Applications/MacVim.app/Contents/Resources/vim"
Compilation: gcc -c -I. -Iproto -DHAVE_CONFIG_H -DFEAT_GUI_MACVIM -Wall -Wno-unknown-pragmas -pipe -DMACOS_X_UNIX -no-cpp-precomp -g -O2 -isysroot /Developer/SDKs/MacOSX10.7.sdk -mmacosx-version-min=10.7 -arch x86_64 -D_FORTIFY_SOURCE=1 -I/System/Library/Frameworks/Tcl.framework/Headers -D_REENTRANT=1 -D_THREAD_SAFE=1 -D_DARWIN_C_SOURCE=1
Linking: gcc -L. -L. -Wl,-syslibroot,/Developer/SDKs/MacOSX10.7.sdk -mmacosx-version-min=10.7 -arch x86_64 -L/usr/local/lib -o Vim -framework Cocoa -framework Carbon -lncurses -liconv -framework Cocoa -fstack-protector -L/usr/local/lib -L/System/Library/Perl/5.12/darwin-thread-multi-2level/CORE -lperl -lm -lutil -lc -framework Python -F/System/Library/Frameworks -framework Tcl -framework CoreFoundation -framework Ruby
Installed plugins:
Matthews-MacBook-Air:~/.vim/bundle$ la
total 32
-rw-r--r--@ 1 askedrelic staff 15K Sep 25 21:10 .DS_Store
drwxr-xr-x 7 askedrelic staff 238B Jul 22 06:55 ManPageView/
drwxr-xr-x 4 askedrelic staff 136B Jul 22 06:55 TaskList.vim/
drwxr-xr-x 5 askedrelic staff 170B Jul 22 06:55 lusty/
drwxr-xr-x 4 askedrelic staff 136B Jul 22 06:55 nerdcommenter/
drwxr-xr-x 6 askedrelic staff 204B Jul 22 06:55 nerdtree/
drwxr-xr-x 6 askedrelic staff 204B Nov 6 00:24 pydoc.vim/
drwxr-xr-x 6 askedrelic staff 204B Jul 22 06:55 tabular/
drwxr-xr-x 6 askedrelic staff 204B Jul 22 06:55 tagbar/
drwxr-xr-x 13 askedrelic staff 442B Oct 10 22:23 utilsnips/
drwxr-xr-x 4 askedrelic staff 136B Jul 22 06:55 vim-fugitive/
drwxr-xr-x 7 askedrelic staff 238B Jul 22 06:55 vim-git/
drwxr-xr-x 4 askedrelic staff 136B Jul 22 06:55 vim-matchit/
drwxr-xr-x 3 askedrelic staff 102B Jul 22 06:55 vim-pydoc/
drwxr-xr-x 3 askedrelic staff 102B Jul 22 06:55 vim-python_match/
drwxr-xr-x 3 askedrelic staff 102B Jul 22 06:55 vim-repeat/
drwxr-xr-x 6 askedrelic staff 204B Oct 8 22:48 vim-room/
drwxr-xr-x 4 askedrelic staff 136B Jul 22 06:55 vim-speeddating/
drwxr-xr-x 4 askedrelic staff 136B Jul 22 06:55 vim-surround/
drwxr-xr-x 4 askedrelic staff 136B Jul 22 06:55 vim-unimpaired/
drwxr-xr-x 5 askedrelic staff 170B Jul 22 06:55 zzfuzzyfinder/
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.