1

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.

  • 1
    Do you have any kind of error highlighting plugin? hex 1B (octal 033) is the escape character, so I'm wondering if it's maybe a broken ANSI color code sequence? – steeldriver Mar 19 '15 at 12:03
  • And what is the TERM variable set to? echo $TERM in the shell or in the vim command line? – muru Mar 19 '15 at 13:26
  • $TERM=screen-256color-bce For error highlighting I use syntastic. .vimrc has: set t_Co = 256 let g:solarized_termcolors=16 (because I also use solarized colorscheme) – Tom P. Mar 19 '15 at 13:32
  • Tried without bce? TERM=screen-256color - note that setting a -256color TERM should be enough, you needn't set t_Co as well. – muru Mar 19 '15 at 13:56
  • Should I set this in the .vimrc file? Or do I have to put this in a .bash_profile for example? – Tom P. Mar 19 '15 at 14:03
2

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.

  • 1
    I ran into this in a new computer, running gnome. I like the visual bell (normally it makes the screen flash), but obviously inserting characters that don't go away is annoying. I wonder why this works on some machines and not others. – redbmk Jan 2 '16 at 19:24

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

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