Support cursor shape changes for vim mode (beam in insert, block in normal)

Status Open
Maintainer reply None cached
Activity 4 comments · opened Mar 9, 2026

Feature Request

When vim mode is enabled (via /vim or /config), the cursor shape should change based on the current mode:

  • Insert mode: thin/beam cursor (\e[5 q or \e[6 q)
  • Normal mode: block cursor (\e[1 q or \e[2 q)

Current Behavior

The cursor appearance stays the same regardless of vim mode. The only visual indicator is the NORMAL/INSERT text in the prompt.

Expected Behavior

Claude Code should emit DECSCUSR escape sequences when switching between vim modes, similar to how shells with vi mode (zsh vi-mode, bash vi-mode) and terminal editors (neovim, vim) change the cursor shape.

Most modern terminals support this (iTerm2, WezTerm, Ghostty, Kitty, Alacritty, Windows Terminal, etc.), so this would provide a natural and familiar visual cue for vim mode users.

View original on GitHub ↗

3 Comments

yurukusa · 5 months ago

Until native DECSCUSR support is added, you can approximate this with terminal-level vim mode cursor shape changes.
If you use zsh with vi-mode, the terminal cursor shape already changes — Claude Code inherits the terminal settings. Add to ~/.zshrc:

function zle-keymap-select {
  if [[ $KEYMAP == vicmd ]] || [[ $1 == 'block' ]]; then
    echo -ne '\e[1 q'  # block cursor
  else
    echo -ne '\e[5 q'  # beam cursor
  fi
}
zle -N zle-keymap-select
echo -ne '\e[5 q'  # default beam

Note: this only affects your shell's vi-mode, not Claude Code's built-in /vim mode. Claude Code's input handler doesn't emit cursor shape escape sequences — that would need to be added in the TUI rendering layer.

unrelentingfox · 3 months ago

Emitting the DECSCUSR shape escape sequences should be a pretty quick fix. Bumping this again for visibility.

maosocial · 1 month ago

+1, would love to see this. Cursor shape switching between block (normal) and beam (insert) via DECSCUSR (\e[2 q / \e[6 q) is standard behavior in Neovim and other vim-mode-aware editors — makes it much easier to tell which mode you're in at a glance without reading the status text.

Showing cached comments. Read the full discussion on GitHub ↗