I've recently decided to give Vim a try and am trying to get it set up for work with Python.
I've installed YCM, so I have autocompletion now, which is good, but there are a few things documentation-wise that I'd like to have set up.
K will open up a window beautifully which can be closed easily with :q
. I really like that, but a big problem is that it only seems to work for official documentation. That is, if the cursor is on a function imported from a standard library module, say, range
, timeit
etc, everything goes as expected.
But if import one of my own modules, even if I define doctrings for a function or class or method, or the module itself, K will tell me there's no documentation to be found. How can I solve this so as to be able to pull the documentation for my own code or code outside the official stdlib one?
The second thing is related to the first: it's about docstrings. In Emacs when the cursor was on anything that had a docstring (whether standard library or some personal module, or something defined in the current file), it would display it in the minibuffer (i.e. where you type in ex commands in vim). The question here is, how do I make it so that the docstring of a function/method/whatever is printed out (whether in the 'minibuffer', or in a popup or some other way)?
Any help would be much appreciated
ctrl+k
opens a window with the doc I think you instead meanK
(orshift+k
), right? Or maybe you have a custom configuration. I think vim-jedi has an improved support ofkeywordprg
(which is what is triggered byK
,:h K
) but I rarely use python so other people on here will probably have better suggestions.nnoremap <F1> :silent YcmCompleter GetDoc<CR>
? And one more to close window:nnoremap <S-F1> :pclose<CR>