0

I am using Vim 8.2 on XTerm(363) and use i3 version 4.19 as window manager on Arch Linux kernel version 5.4.89-1-lts. My i3 modifier key is the Windows key. When I use Win+h, Win+l, Win+k, or Win+j to move one window to the left, right, up, or down; Vim is catching these keyboard shortcuts and rings the terminal bell, when in normal mode, or inserts strange character sequences like the one below, when in insert mode.

<t_<fd>c><t_<fd>b>

<fd> being highlighted in red meaning it is a special character.

It looks like <t_<fd>b> appears when I make the XTerm with Vim the active window using Win+h, Win+j, Win+k, or Win+j and <t_<fd>c> appears when I make a different window the active window using the same keyboard shortcuts when the XTerm with Vim was the active window before.

Also occurs with empty vimrc.

This hasn't happened before this day. How to get rid of it?

2
  • 1
    Welcome to Vi and Vim! What does vim think term is? :help term.txt is probably going to be relevant
    – D. Ben Knoble
    Commented Jan 16, 2021 at 1:46
  • @D.BenKnoble Thank you, the output of :set term? is term=xterm. The codes described in :help term.txt are indeed similar to the ones appearing on my Vim. Yet I couldn't find t_<fd>c or t_<fd>b anywhere. Maybe cause 0xfd is outside ASCII range? Maybe it is pointing to the Windows key?
    – lsmw
    Commented Jan 16, 2021 at 2:05

1 Answer 1

1

Add this to your vimrc:

set t_fd=
set t_fe=

Some terminals including xterm support the focus event tracking feature. If this feature is enabled by the 't_fe' sequence, special key sequences are sent from the terminal to Vim every time the terminal gains or loses focus. Vim fires focus events (|FocusGained|/|FocusLost|) by handling them accordingly. Focus event tracking is disabled by a 't_fd' sequence when exiting "raw" mode. If you would like to disable this feature, add the following to your .vimrc:
set t_fd=
set t_fe=

Quoted from :h xterm-focus-event

Thanks to D. Ben Knoble for pointing me to :help term.txt, which mentions this option

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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