This happens when `TERM` isn’t set to the correct `screen[-256color]` in Vim’s environment, usually by some shell startup script. If that is the case – for example, you have a
TERM=xterm-256color
, either remove it or make sure it checks the original value of `TERM` before changing it, e.g.
if [[ "$TERM" = xterm ]]; then
TERM=xterm-256color
fi