brewedbits.dev

Personal blog with guides and news on selfhosting, Linux and AI, from the Netherlands

nextDash nextdash --aboutYour bookmarks. Your terminal. checks your links knows your Docker host one container, no cloudLive demo →nextdash.cc ↗

Tip: editorMode vim gives the Claude Code prompt Vim keys, and jj can be your Escape

Claude
~/tips/tip-claude-code-editormode-vim

"editorMode": "vim",

Turns on Vim-style editing in the Claude Code prompt, with jj as an optional Escape.

If your fingers want ciw and dd every time you fix a typo in a long prompt, Claude Code has a setting for you. Its prompt input has a Vim editing mode, and one line in your settings turns it on.

Pick Editor mode in /config, or write it into ~/.claude/settings.json yourself. The docs show this pair:

{
  "editorMode": "vim",
  "vimInsertModeRemaps": { "jj": "<Esc>" }
}

The first line switches vim mode on. The second maps jj in INSERT mode to Escape, and that’s the remap I’d add first. Each key in that map is exactly two characters, and <Esc> is the only target it accepts. Type the second j within one second and you land in NORMAL mode with neither character left in the prompt. Pause between them and you simply get “jj”. To go back to plain editing, set Editor mode to normal again.

NORMAL mode covers a decent subset of Vim: hjkl, w, b and e, f/t jumps with ; and ,, v and V selections, and d/c/y with text objects. A nice extra: / in NORMAL mode opens the reverse history search, the same one you get with Ctrl+R.

A couple of things behave differently from real Vim. Enter still sends your prompt, even in INSERT mode, so use o or O in NORMAL mode, or Ctrl+J, when you want a new line. And Claude Code only reads vimInsertModeRemaps from your user settings, the --settings flag or managed settings. In a project’s .claude/settings.json it’s ignored, which I think is the right call: a repository you clone can’t remap your keystrokes. The Vim motions themselves can’t be remapped through the keybindings file either.

Further reading: Vim editor mode in Claude Code, Edit prompts with Vim keybindings

Going deeper: Guide: advanced tmux, a config that grows with you, formats, layouts and more

More Claude tips /recap /focus /skill-doctor /autocompact 500k claude purge ~/work/my-repo --dry-run All Claude tips (83) All topics

Link