Mapping Esc is always a little tricky and generally inviting this kind of trouble, even though it shouldn't happen.
The "canonical" method for your mapping is:
nnoremap <silent> <C-l> :nohlsearch<CR><C-l>
That way Ctrl+L (which normally redraws your screen) will stop highlighting and redraw the screen.
I think I've found out what happens, but I still have no solution. I assumed Vim received a string containing an <ESC>
and "2c", so I used the following mapping to make it visible:
nnoremap <Esc> :"
It resulted in the following prompt on startup:
:"[>0;261;0c
Which means something sent <ESC>[>0;261;0c
on startup. Now looking up the original xterm
control sequences, we find that:
ESC [ Control Sequence Introducer (CSI is 0x9b)
and
CSI > P s c
Send Device Attributes (Secondary DA).
P s = 0 or omitted → request the
terminal’s identification code. The
response depends on the decTerminalID
resource setting. It should apply only
to VT220 and up, but xterm extends
this to VT100.
→ CSI > P p ; P v ; P c c
where P p denotes the terminal type
P p = 0 → ‘‘VT100’’.
P p = 1 → ‘‘VT220’’.
and P v is the firmware
version (for xterm, this was
originally the XFree86 patch number,
starting with 95). In a DEC terminal,
P c indicates the ROM cartridge
registration number and is always
zero.
So in my case something sends CSI >
with P p = 0 (→ terminal type VT100), P v = 261 (→ my xterm
version), and P c = 0.
Still I have no idea where it comes from or how to stop it. My best guess is that some information exchange between the terminal and Vim fails and something is bugged up.