Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
GoogleCodeExporter opened this issue Aug 18, 2015 · 4 comments

Comments

@GoogleCodeExporter
Copy link

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
Copy link
Author

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
Copy link
Author

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
Copy link
Author

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
Copy link
Author

Fixed by 7.3.807

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

  • Changed state: Fixed

rbtnn referenced this issue in rbtnn/vim Apr 9, 2016
rbtnn referenced this issue in rbtnn/vim Apr 9, 2016
zdohnal referenced this issue in zdohnal/vim Feb 6, 2017
nuko8 added a commit to nuko8/vim that referenced this issue Oct 1, 2017
Currently, when the darwin feature is enabled, Vim is unconditionally
linked against Cocoa, but that's too much for most of the cases.

For Tiny, os_macosx.m is excluded from the build to avoid link errors.
Then, if +multi_byte is not required for the build, we could exclude
os_mac_conv.c, too.  In other words, we don't need the empty
os_mac_conv.o to build an -multi_byte Vim.

As to Small, it's possible for Vim to have +clipboard with +multi_byte.
But that obviously compromises the interoperability of the clipboard.

This patch corrects those unreasonable things.

The following table summarizes the proposed changes:

                          (*1)
Feature             Clipboard   Extra Files             Framework
====================================================================
      -multi_byte   disabled    None                    None
tiny  --------------------------------------------------------------
      +multi_byte   disabled    os_mac_conv.c           CoreServices
--------------------------------------------------------------------
      -multi_byte   enabled     os_macosx.m             AppKit (*2)
                                os_mac_conv.c (vim#3)
small --------------------------------------------------------------
      +multi_byte   enabled     os_macosx.m             AppKit
                                os_mac_conv.c
--------------------------------------------------------------------

*1: For macOS, FEAT_CLIPBOARD is defined in vim.h for FEAT_SMALL.
*2: The linker automatically adds CoreServices in favor of AppKit.
*3: As mentioned above, +clipboard prefers +multi_byte.
nuko8 added a commit to nuko8/vim that referenced this issue Oct 3, 2017
Currently, when the darwin feature is enabled, Vim is unconditionally
linked against Cocoa, but that's too much for most of the cases.

For Tiny, os_macosx.m is excluded from the build to avoid link errors.
Then, if +multi_byte is not required for the build, we could exclude
os_mac_conv.c, too.  In other words, we don't need the empty
os_mac_conv.o to build an -multi_byte Vim.

As to Small, it's possible for Vim to have +clipboard with +multi_byte.
But that obviously compromises the interoperability of the clipboard.

This patch corrects those unreasonable things.

The following table summarizes the proposed changes:

                          (*1)
Feature             Clipboard   Extra Files             Framework
====================================================================
      -multi_byte   disabled    None                    None
tiny  --------------------------------------------------------------
      +multi_byte   disabled    os_mac_conv.c           CoreServices
--------------------------------------------------------------------
      -multi_byte   enabled     os_macosx.m             AppKit (*2)
                                os_mac_conv.c (vim#3)
small --------------------------------------------------------------
      +multi_byte   enabled     os_macosx.m             AppKit
                                os_mac_conv.c
--------------------------------------------------------------------

*1: For macOS, FEAT_CLIPBOARD is defined in vim.h for FEAT_SMALL.
*2: The linker automatically adds CoreServices in favor of AppKit.
*3: As mentioned above, +clipboard prefers +multi_byte.
seandewar added a commit to seandewar/neovim that referenced this issue May 18, 2021
Problem:    Cannot save and restore a register properly.
Solution:   Add getreginfo() and make setreg() accept a dictionary. (Andy
            Massimino, closes vim/vim#3@@370)
https://github.com/vim/vim/commit/b@@b861e293e0170455184079fa537278754b07911

TODO: port related missing test_eval_stuff.vim functions, port setreg()
changes for accepting list, double check everything, remove @@s in links
above
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant