xiancode / vim

Automatically exported from code.google.com/p/vim
0 stars 0 forks source link

Combining completeopt=menu,preview and cursorcolumn will make completion menu vanish #3

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
If both, completeopt=menu,preview and cursorcolumn are set, the completion menu 
will vanish upon the first completion choice that would bring up the preview 
window. The preview window still works and is browseable, the menu still is 
gone, though.

The bug has bitten other people too:
https://github.com/Rip-Rip/clang_complete/issues/6
http://leetless.de/vimrc.txt

To reproduce, follow this (will assume installed python completion support):
1) Open a new python file with vim
1) a) vim foo.py
2) Set completion
2) a) filetype plugin on
2) b) set omnifunc=pythoncomplete#Complete
2) c) set completeopt=menuone,menu,longest,preview
3) Set cursorcolumn
3) a) set cursorcolumn
4) Import some stdlib that has docstrings

import string
foo = ""
foo.

5) Press <C-X><C-O>
6) Choose from list
7) Menu will vanish

The last rev I tested this on was 177 and there don't seem to be any relevant 
changes since then.

Hopefully that's helpful. 

Original issue reported on code.google.com by svenst...@gmail.com on 23 May 2011 at 7:17

GoogleCodeExporter commented 9 years ago
I was not able to reproduce on Windows gvim 7.3.198 following the instructions 
given, after launching Vim with "gvim -N -u NONE -i NONE".

Nevertheless, I see similar behavior all the time when editing C code in my 
normal Vim configuration (i.e. using omnicompletion in C code causes the menu 
to flash briefly then vanish). I finally investigated a little and came up with 
two separate causes, either of which will independently trigger the behavior.

My completeopt is set to menuone,preview,longest. When editing C code with the 
default omnifunc in the C ftplugin, and with fdm=syntax, and with foldlevel=1, 
the BufEnter autocmds of the Taglist plugin seem to trigger this behavior 
(discovered by removing all autocmds one group at a time from my config until I 
found the group doing it, then trying again and removing autocmds one event at 
a time from the group found previously). Also, the following commands in my 
.vimrc seem to trigger it:

    " get rid of scrolloff option for certain buffers like the quickfix and
    " preview windows
    autocmd BufEnter *
          \ if (&ft=='qf' || &previewwindow || bufname('%') ==# "__Tag_List__") && !exists('s:scrolloff_sav') |
          \   let s:scrolloff_sav=&scrolloff |
          \   set scrolloff=0 |
          \ endif
    " File type will not be set on the first BufEnter
    autocmd Filetype qf
          \ if !exists('s:scrolloff_sav') |
          \   let s:scrolloff_sav=&scrolloff |
          \   set scrolloff=0 |
          \ endif
    autocmd BufLeave *
          \ if (&ft=='qf' || &previewwindow || bufname('%') ==# "__Tag_List__") && exists('s:scrolloff_sav') |
          \   let &scrolloff=s:scrolloff_sav |
          \   unlet s:scrolloff_sav |
          \ endif

I plan to investigate further to get a much more refined set of 
triggers/simpler test case, but that's as far as I've gotten so far in the hour 
or two I've spent on it.

The original issue report does not mention trying without .vimrc or plugins 
(they launch Vim with just "vim foo.py") so I wonder if maybe they also have 
Taglist installed or a plugin that does something similar.

Original comment by fritzoph...@gmail.com on 25 May 2011 at 2:35

GoogleCodeExporter commented 9 years ago
You are absolutely right, I idiotically tested with my own .vimrc. Anyhow, 
using awesome debug magic I traced down :set ruler to be additional culprit 
here, no plugins.

Updated instructions:
1) Open a new python file with vim
1) a) vim -N -u NONE -U NONE -i NONE foo.py
2) Set completion
2) a) filetype plugin on
2) b) set omnifunc=pythoncomplete#Complete
2) c) set completeopt=menuone,menu,longest,preview
3) Set trouble makers
3) a) set cursorcolumn
3) b) set ruler
4) Import some stdlib that has docstrings

import string
foo = ""
foo.

5) Press <C-X><C-O>
6) Choose from list
7) Menu will vanish

Original comment by svenst...@gmail.com on 26 May 2011 at 5:10

GoogleCodeExporter commented 9 years ago
I confirm – I can reproduce the problem using Vim 7.3.189 and C++ omni 
completion from Vissale NEANG.

Original comment by lech.lor...@gmail.com on 26 May 2011 at 8:51

GoogleCodeExporter commented 9 years ago
Fixed by 7.3.807

Original comment by chrisbr...@googlemail.com on 29 Sep 2014 at 5:08