Vim Arrow Keys Insert A B C D

Workaround available Linux, SSH, WSL Updated October 21, 2026

Quick answer

Vim is running in vi-compatible mode or with the wrong TERM. Add set nocompatible to your vimrc (or install full Vim) and check $TERM.

Most likely fix: Create a vimrc with nocompatible.

Symptoms

Pressing arrow keys in Insert mode inserts new lines with A, B, C or D instead of moving the cursor; common over SSH or on minimal installs.

Why it happens

  • No vimrc loaded, so Vim runs in vi-compatible mode
  • Minimal vim-tiny build installed (Debian/Ubuntu)
  • Wrong $TERM value in SSH or VM sessions

How to fix it

Try these in order — the most common fix is first.

  1. 1. Create a vimrc with nocompatible

    1. Add set nocompatible to ~/.vimrc (an empty ~/.vimrc also turns compatible mode off)
    2. Restart Vim
  2. 2. Install the full Vim package

    1. Debian/Ubuntu: sudo apt install vim
    2. Check vim --version to confirm 'Huge' or 'Normal' version
  3. 3. Fix the terminal type

    1. echo $TERM
    2. Try export TERM=xterm-256color and reopen Vim
  4. 4. Check the global vimrc

    1. vim --version shows the system vimrc path
    2. Make sure that file exists and isn't setting compatible

This guide also covers

  • vim arrow keys abcd
  • vim arrow keys not working insert mode
  • vi arrow keys print letters

Still not working?

If Vim keeps failing, you're not alone. See every Vim problem users report or the alternatives people switch to.

Other Vim errors