Wednesday, March 30, 2016

junk characters printed when I type ESC

I attached screenshot of the kind of junk characters printed on the 1st line at the beginning of the line.

Step to reproduce: press ESC in Insert mode.

These characters are display only. If I get VIM to refresh (Ctrl-Z to background and back to foreground) characters will be gone.


My configuration:

Debian 8.2
VIM 7.4, included patches 1-488, 576.

I narrowed down the issue to the following part of vimrc configuration. While the issue is fixed I have a few questions.

I use ssh a lot and I can be using a different terminal application. Every terminal app pretends to be xterm, but every terminal is slightly different. For example we have putty, Tera Term, Gnome's Terminal, cygwin, xterm itself. What's a better way to tweak vim configuration to a specific terminal. I created MYHOST variable that points to cygwin in cygwin case.

Shall I tell each terminal to report its name (TERM variable) at a risk of having a lot of other software totally confused?

" check if in tera term (the code used to check for xterm)
if &term =~ "teraterm"
" In Gnome 3's Terminal pressing ESC prints junk characters
" instead of changing cursor.
" Thus, I have disabled the code that's known to work in Tera Term and
" Cygwin

" Tera Term scenario as documented in
" http://www.teraterm.org/manual/en/usage/tips/vim.html
"
" In insert mode: Blink vertical line
let &t_SI.="\e[5 q"
" In normal mode: Blink block
let &t_EI.="\e[1 q"
" delay to wait for cursor to change from Insert to Normal mode
" temoutlen solution appears to be the least complicated and it works
set timeoutlen=160

" For details about
" - Speed up vsplit scrolling
" - Auto indent can be disabled on pasting from clipboard
" See:
" http://www.teraterm.org/manual/en/usage/tips/vim.html

" Allow title retrival and storage
" Thus default phraze "thanks for flying vim" is not displayed
let &t_ti .= "\e[22;0t"
let &t_te .= "\e[23;0t"
endif

--
--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

No comments: