Vim Tips Wiki
Advertisement

Use this page to discuss script 1542 pythoncomplete: Python Omni Completion

  • Add constructive comments, bug reports, or discuss improvements (see the guideline).
  • Do not document the script here (the author should do that on vim.org).
  • This page may be out of date: check the script's vim.org page above, and its release notes.

Known issues

The docstrings buffer doesn't disappear after the autocompleted option is selected.

This is not an issue with the plugin, this is just how Vim works when you have "preview" in your 'completeopt'. The following helps me for C completion. --Fritzophrenic 18:11, May 4, 2011 (UTC)
    " close the preview window if it was opened in insert mode (probably because
    " of omnicompletion with the 'preview' option set in completeopt)
    augroup closepreview
      " Detect if the preview window existed before entering insert mode.
      autocmd InsertEnter * let t:preview_open=IsPreviewWinOpen()

      " Close the preview window when exiting insert mode so that the
      " completion-menu "preview" option doesn't get in the way of editing.
      " But, don't close it if it was already open before insert mode, or if on
      " the command line (pclose is not allowed on the command line)
      autocmd InsertLeave *
            \ if !t:preview_open && bufname('') !~# (v:version < 702 ? 'command-line' : '\[Command Line\]') |
            \   pclose |
            \ endif
    augroup END

    function! IsPreviewWinOpen()
      let winnum=winnr('$')
      while winnum > 0
        if getwinvar(winnum, '&previewwindow')
          return 1
        endif
        let winnum -= 1
      endwhile
      return 0
    endfunction

Comments

Advertisement