Ubuntu – VIM in gnome-terminal keeps printing weird 001B character

gnome-terminalvim

I have VIM installed on Ubuntu 12.04, and run the terminal version in the gnome-terminal. However, recently (I don't know what caused the change) when editing files in VIM it will sometimes insert a 001B character in a square box when pressing a "wrong" button.

E.g.:
When at the beginning of a line and I press h to move left, it will print one of those OO1B characters in a box over the leftmost character.

Or, when at the top of a file, and I press k, it will print such a character again.

Or when pressing . to repeat something without having a command to repeat, it will print such a character.

Each time it prints the character at the current cursor position. I have no idea what causes this.

My terminal profile uses:

  • Source Code Pro, Medium – font (but it also happens with system fixed width font)
  • Terminal character encoding is set to UTF-8 (But it also happens with other encodings)

It seems like it prints both a 001B in a square box, and a 'g' at the same cursor position. But it doens't actually 'write' it in the buffer. They are just shown on the screen and remain there until for example I change the character at that cursor position in the buffer. In which case it now shows the correct character again.

Terminal error

Anybody have any idea what might be causing this? I'm at a loss.

I use the solarized colorscheme, but it runs together with CSApprox because that's the only way I got the colors working almost completely (background for dark background is still off, but everything else is fine).
That's why my .vimrc has the following:

set t_Co=256  " To make CSApprox not nag
let g:solarized_termcolors=16  "so that solarized uses my terminal presets which I've configured to the solarized colors.

I use syntastic for highlighting syntax errors.

Best Answer

I have found the reason those escape appear by disabling everything in my .vimrc file and reenabling incrementally. For those people with the same problem, it is caused by the following setting in the .vimrc file:

set visualbell "Use a visual error indicator instead of a beep

Removing the above line fixed the problem.

Silly and logical, but well... There you have it.

Related Question