1

When I'm using Vim in the terminal, I sometimes get stuff like this:enter image description here

The square bracket floating is what I'm talking about. When my autocompleter plugin stops completing, sometimes it "forgets" to delete some text and leaves it lying around (like that square bracket up there.) A Ctrl+L refresh fixes it, though.

I'm using coc.nvim right now, but this also happened on YouCompleteMe and clang complete, so I'm not sure what to really think about it.

How can I fix this "stuck text"?

3
  • 1
    I suppose this comes down to be using a different terminal emulator and configuring $TERM correctly. Commented Oct 25, 2019 at 7:06
  • Welcome to Vi and Vim! In previously similar questions, as @ChristianBrabandt points out, this is often a terminal configuration issue
    – D. Ben Knoble
    Commented Oct 25, 2019 at 10:30
  • Could you help point me to a previous similar question so I can see what the problem is? Thanks!
    – virchau13
    Commented Oct 25, 2019 at 11:15

1 Answer 1

2

I was breaking my head trying to debug this. It turns out it was a problem with my vim colorscheme. I was using Monokai from vim-colorschemes. In the definition for PMenu it specifies all colours as NONE, I think this somehow interferes with the autocomplete engine when it has to resize the popup window. The resize action leaves the debris of random text on the screen.

I worked around this by specifying a background color for the PMenu highlight in the colorscheme.

vim ~/.vim/plugged/vim-colorschemes/colors/Monokai.vim

changed:

hi Pmenu ctermfg=NONE ctermbg=NONE cterm=NONE guifg=NONE guibg=NONE gui=NONE

to

hi Pmenu ctermfg=NONE ctermbg=2 cterm=NONE guifg=NONE guibg=#004400 gui=NONE

This gives a green background to the popup window, you could modify as you see fit.

1
  • I'm glad this solved the problem for you, but at least for me the problem still showed up even when I used the default colorscheme :/ (In any case, I eventually switched to neovim, which doesn't have this problem.)
    – virchau13
    Commented Jul 29, 2020 at 5:17

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.