roxma / nvim-completion-manager

:warning: PLEASE USE https://github.com/ncm2/ncm2 INSTEAD
MIT License
917 stars 49 forks source link

Python- docstring window option? #132

Closed bbkane closed 7 years ago

bbkane commented 7 years ago

Is there a way to display the docstring for Python in the preview window similar to Jedi:

the docstring window on top

the link to disable the feature in jedi-vim

roxma commented 7 years ago

:help g:cm_completeopt

Add preview into this option. Note that you need to add some code to close the window automatically.

bbkane commented 7 years ago

Thanks, that was just what I needed! Adding this code for others (stolen from jedi-vim's implementation) to close the preview window when insert mode is left.

    Plug 'roxma/nvim-completion-manager'
    " Add preview to see docstrings in the complete window.
    let g:cm_completeopt = 'menu,menuone,noinsert,noselect,preview'

    " Close the prevew window automatically on InsertLeave
    " https://github.com/davidhalter/jedi-vim/blob/eba90e615d73020365d43495fca349e5a2d4f995/ftplugin/python/jedi.vim#L44
    augroup ncm_preview
        autocmd! InsertLeave <buffer> if pumvisible() == 0|pclose|endif
    augroup END