11

I had vim installed on ubuntu 12.04 not long ago. Sometimes when I run my cursor (using keyboard, not mouse) over code, text disappears, as though there is a problem rendering the character. When I run the cursor back again, it usually reappears.

This seems to happen quite randomly but is often enough to make it irritating.

To make it clearer, here's an example:

1.Original text:

Hi! How are you today.

2.Text after cursor runs over it

H ! How re yo today.

3.After running the cursor over the sentence again

i! How ar you tod y.

  1. Finally, after running the cursor over the sentence a few times, it is back to normal

.vimrc file:

set nocompatible               " be iMproved
 syntax on        "Syntax highlighting
 filetype off 
 set rtp+=~/.vim/bundle/vundle/
 call vundle#rc()

 colorscheme evening 
  
 "font
 set nu
 set guifont=Monospace\ 12
 set foldmethod=indent
 set foldlevel=99
 set lines=50 columns=80
 set ignorecase "searching is not case sensitive 
 set smartcase "if a pattern contains uppercase, searching IS case sensitive 
 set autoindent
 set tabstop=4
 
 winpos 1068 24
 " Type 'za' to open and close a fold
 " let Vundle manage Vundle
 
 Bundle 'gmarik/vundle'

 " original repos on github
 Bundle 'tpope/vim-fugitive'
 " vim-scripts repos
 Bundle 'L9'
 Bundle 'FuzzyFinder'
 " git repos on your local machine (ie. when working on your own plugin)
 
 "Bundles I install
 Bundle 'https://github.com/scrooloose/nerdtree.git' 
 Bundle 'scrooloose/syntastic'
 Bundle 'dbakker/vim-lint'
 Bundle 'Lokaltog/powerline', {'rtp': 'powerline/bindings/vim/'} 

 "snipmate
 Bundle "MarcWeber/vim-addon-mw-utils"
 Bundle "tomtom/tlib_vim"
 Bundle "snipmate-snippets"

"Install snipmate:
 Bundle "garbas/vim-snipmate"

 Bundle "sudar/vim-arduino-snippets"

 "PYTHON
 filetype plugin indent on
 Bundle 'klen/python-mode'
 autocmd BufRead *.py nmap <F5> :!python %<CR>
 set laststatus=2
 " :BundleList          - list configured bundles
 " :BundleInstall(!)    - install(update) bundles
 " :BundleSearch(!) foo - search(or refresh cache first) for foo
 " :BundleClean(!)      - confirm(or auto-approve) removal of unused bundles
 " see :h vundle for more details or wiki for FAQ
 " NOTE: comments after Bundle command are not allowed..
 " ARDUINO
 autocmd! BufNewFile,BufRead *.pde,*.ino  setlocal ft=arduino

Edit:

I tried to take a screenshot of the problem, but realized that after taking a screenshot, gvim would sort of "refresh", and missing fonts appear again. Alt-Tabbing helps too. But I have not found a permanent solution to this problem.

Also, moving my cursor over the line of text with characters missing would sometimes cause other characters to go missing while old characters appear. Sometimes the cursor would also leave behind static images of other cursors.

I've also got vim installed on windows, shall try it there to see if the same problem appears.

Screenshot, notice the empty rectangle in the bottom left:

Disappearing text on screen with GVim on Ubuntu

Update: So I've reinstalled ubuntu (this time to 14.04), gvim and vim. There are still some annoying rendering issues, although it manifests differently (see screenshot 2). Line numbers and percentages go haywire and scroll along with the page when I scroll down using "j". Only happens for vim so far. Gvim is working okay. enter image description here

Community
  • 1
  • 1
Yan Yi
  • 763
  • 1
  • 10
  • 29
  • 2
    Not experienced with this, but could be a problem with your graphics card/driver. What card do you have? Proprietary driver? Does this also happen when you start [tag:vim] with `vim -u NONE`? – pfnuesel Dec 15 '13 at 10:00
  • The problem sounds like something that could happen in terminal, with improper tcap settings. But in GVim... :S – mike3996 Dec 15 '13 at 10:32
  • 1
    It looks much like a problem with glyphs not present in your font. E.g. you will see some weird displaying problems if you have diacritics not present in Monospace present on some character near characters that did disappear or you have signs column displaying some fancy characters for specific errors: after failing to locate requested glyph in the current font GTK searches it in other fonts (there are some fontconfig configuration files that control this behavior). Glyph from the other font has size different from glyphs in the current font which results in weird artifacts. – ZyX Dec 15 '13 at 13:26
  • So can you post the file you are viewing and also the screenshot? – ZyX Dec 15 '13 at 13:27
  • About screnshots: how do you take it? I would use `import` command for this (like `import ~/image.png`), binded by fluxbox. Does not cause refresh normally. Suggested command causes cursor to change into a cross which will take screenshot of the window you click on, but you may indefinitely ignore this cross and use keyboard (you will need this if you launch `import` from command-line (effectively causing redraw by switching to a terminal emulator) instead of having it binded). – ZyX Dec 16 '13 at 16:23
  • 1
    I can reproduce this problem, exactly as described here. Yan Yi, I've added a picture, is that what you're seeing? @ZyX I can confirm that it is a redrawing problem, nothing to do with missing glyphs. This happens on Ubuntu 12.04 and 13.04. Like the OP said, pressing Alt-Tab redraws the GVim window so it was a bit difficult taking the screenshot (I used screen recording). – glts Dec 20 '13 at 20:19
  • Yup glts, something like that! – Yan Yi Dec 21 '13 at 22:09

2 Answers2

4

So I found out whats the problem. Turns out after I removed one line from my .vimrc, the weird visual rendering bugs are gone.

Did not expect this innocuous looking line to be the cause:

set lines=50 columns=100

Not sure why this is the case though.

Yan Yi
  • 763
  • 1
  • 10
  • 29
  • Unfortunately, this solution does not apply/work for me. VirtualBox Linux Mint 17. Others noted here: http://stackoverflow.com/questions/25018843/gvim-redraw-issues – Leng Jun 08 '15 at 05:40
  • @Leng, it also didn't fix it for me. I'm running Ubuntu in virtualbox, so it might be a problem with virtualbox. – user9886 Sep 11 '15 at 09:18
  • 1
    @user9886 I'm not sure where exactly the issue lies; my hunch is currently with GVIM itself, as no other applications have issues with these setups. More information here - https://github.com/linuxmint/Cinnamon/issues/3876 – Leng Sep 11 '15 at 23:03
  • Worked for me, ubuntu 18.04 virtual box 5.2.28. – Pedro Muniz May 12 '19 at 16:14
1

Maybe a late reply. I'm running ubuntu 16.04 on a virtualbox machine, and had the same issue with the default VI. Fixed by just installing VIM on top:

sudo apt-get install vim

Hugo Pinto
  • 11
  • 1