Gemini CLI Keybindings

Master keyboard shortcuts, enable Vim mode, and create custom keybindings to navigate Gemini CLI faster. This guide covers every built-in shortcut, configuration option, and popular setup so you can work at the speed of thought.

Default Keybindings

Gemini CLI ships with a set of default keyboard shortcuts that work out of the box. These follow standard terminal conventions, so most of them will feel familiar if you have used any command-line tool before. Learning these shortcuts is the fastest way to improve your productivity without any configuration.

Cancel current operationCtrl+C
Exit Gemini CLICtrl+D
Autocomplete suggestionTab
Navigate command historyUp / Down
Clear screenCtrl+L
Search command historyCtrl+R
Undo last inputCtrl+Z
Slash commands/commands

These defaults apply to the standard Emacs-style editing mode. If you switch to Vim mode, the shortcuts listed above still work in insert mode, while normal mode adds a complete set of Vim navigation keys.

Enable Vim Mode

If you are a Vim user, Gemini CLI has built-in support for Vim-style keybindings. Enabling Vim mode gives you modal editing with normal, insert, and visual modes directly inside your Gemini CLI session. This is one of the most requested features among power users who want their muscle memory to carry over from their editor.

Activate Vim Keybindings

# Enable Vim mode globally

gemini config set editor.mode vim

# Verify it is active

gemini config get editor.mode

# Switch back to default Emacs mode

gemini config set editor.mode emacs

Vim Mode Features

Once Vim mode is enabled, you get full modal editing support. Gemini CLI implements the most commonly used Vim motions and operators, making it easy to edit long prompts, navigate through output, and manipulate text without reaching for the mouse.

  • NNormal mode -- navigate with h/j/k/l, use w/b for word movement, dd to delete lines, yy to yank, p to paste
  • IInsert mode -- type freely, press Esc to return to normal mode. Enter insert mode with i, a, o, or I, A, O
  • VVisual mode -- select text with v (character), V (line), or Ctrl+V (block), then operate on the selection

Key Mappings in Vim Mode

# Normal mode navigation

h / j / k / l Move cursor left/down/up/right

w / b Jump forward/backward by word

0 / $ Jump to start/end of line

gg / G Jump to first/last line

# Editing in normal mode

dd Delete entire line

dw Delete word forward

ciw Change inner word

yy Yank (copy) line

p Paste after cursor

u Undo

Ctrl+R Redo

# Search

/pattern Search forward

?pattern Search backward

n / N Next/previous match

Custom Keybindings

Beyond the defaults, Gemini CLI lets you define your own keyboard shortcuts by editing a JSON configuration file. Custom keybindings let you map any key combination to any command, including slash commands, shell actions, and built-in operations. This is where you can truly tailor the tool to fit your personal workflow.

Configuration File Location

# Default keybindings config path

~/.gemini/keybindings.json

# Open in your default editor

gemini config edit keybindings

# Show current keybindings

gemini config get keybindings

Example Keybindings Configuration

{

"bindings": [

{

"key": "ctrl+s",

"command": "submit",

"description": "Submit current prompt"

},

{

"key": "ctrl+n",

"command": "newConversation",

"description": "Start a new conversation"

},

{

"key": "ctrl+e",

"command": "openEditor",

"description": "Open prompt in external editor"

},

{

"key": "ctrl+shift+c",

"command": "copyLastResponse",

"description": "Copy last AI response to clipboard"

}

]

}

Each binding requires a key and a command. The description field is optional but recommended for readability.

Chord Keybindings (Multi-Key Sequences)

Gemini CLI supports chord bindings, which are key sequences where you press one combination followed by another. This is similar to how VS Code handles multi-step shortcuts. Chord bindings are useful when you run out of simple key combinations or want to group related commands under a common prefix.

{

"bindings": [

{

"key": "ctrl+k ctrl+d",

"command": "formatDocument",

"description": "Format the current document"

},

{

"key": "ctrl+k ctrl+c",

"command": "toggleComment",

"description": "Toggle comment on selection"

},

{

"key": "ctrl+k ctrl+s",

"command": "saveSession",

"description": "Save current session to file"

}

]

}

Keybinding Profiles

Profiles let you maintain multiple keybinding configurations and switch between them depending on your task or environment. For example, you might use a Vim-heavy profile for editing-intensive work and a minimal profile when pair programming with someone who prefers standard shortcuts.

Create and Switch Profiles

# Create a new keybinding profile

gemini config keybindings --profile vim-power

# Switch between profiles

gemini config keybindings --use vim-power

gemini config keybindings --use default

# List all available profiles

gemini config keybindings --list-profiles

# Delete a profile

gemini config keybindings --delete-profile vim-power

Share Profiles via Dotfiles

Keybinding profiles are stored as individual JSON files in your Gemini config directory. You can version-control them in your dotfiles repository and symlink them across machines for a consistent experience everywhere.

# Profile files are stored here

~/.gemini/profiles/vim-power.json

~/.gemini/profiles/vscode.json

~/.gemini/profiles/minimal.json

# Add to your dotfiles repo

cp ~/.gemini/profiles/*.json ~/dotfiles/gemini/

# Symlink on a new machine

ln -s ~/dotfiles/gemini/vim-power.json ~/.gemini/profiles/vim-power.json

Popular Keybinding Setups

Below are three complete keybinding configurations you can copy into your ~/.gemini/keybindings.json file. Each one is designed for a different type of user. Pick the one closest to your workflow and customize from there.

Vim Power User

Optimized for developers who live in Vim. Enables Vim mode and adds shortcuts that mirror common Vim plugin behavior. Ideal if you already use Vim or Neovim as your primary editor.

{

"editor.mode": "vim",

"bindings": [

{ "key": "ctrl+s", "command": "submit" },

{ "key": "ctrl+p", "command": "historyPrevious" },

{ "key": "ctrl+n", "command": "historyNext" },

{ "key": "ctrl+w", "command": "deleteWordBackward" },

{ "key": "ctrl+u", "command": "clearLine" },

{ "key": "ctrl+a", "command": "moveToLineStart" },

{ "key": "ctrl+e", "command": "moveToLineEnd" },

{ "key": "ctrl+k ctrl+k", "command": "killToEndOfLine" },

{ "key": "ctrl+k ctrl+u", "command": "killToStartOfLine" },

{ "key": "ctrl+j", "command": "newlineBelow" },

{ "key": "ctrl+shift+j", "command": "joinLines" }

]

}

VS Code User

Mirrors the most common VS Code shortcuts. Great for developers who spend most of their time in VS Code and want consistent muscle memory across their editor and CLI.

{

"editor.mode": "emacs",

"bindings": [

{ "key": "ctrl+enter", "command": "submit" },

{ "key": "ctrl+shift+k", "command": "deleteLine" },

{ "key": "ctrl+d", "command": "selectNextOccurrence" },

{ "key": "ctrl+shift+l", "command": "selectAllOccurrences" },

{ "key": "alt+up", "command": "moveLineUp" },

{ "key": "alt+down", "command": "moveLineDown" },

{ "key": "ctrl+/", "command": "toggleComment" },

{ "key": "ctrl+k ctrl+c", "command": "addComment" },

{ "key": "ctrl+k ctrl+u", "command": "removeComment" },

{ "key": "ctrl+shift+p", "command": "commandPalette" },

{ "key": "ctrl+n", "command": "newConversation" }

]

}

Minimal

A lightweight setup that adds only the most essential shortcuts. Perfect for beginners or developers who prefer to keep things simple and learn keybindings gradually.

{

"editor.mode": "emacs",

"bindings": [

{ "key": "ctrl+enter", "command": "submit" },

{ "key": "ctrl+n", "command": "newConversation" },

{ "key": "ctrl+shift+c", "command": "copyLastResponse" },

{ "key": "ctrl+h", "command": "showHistory" }

]

}

Troubleshooting Keybindings

Keyboard shortcuts can sometimes conflict with your terminal emulator, operating system, or multiplexer. Below are the most common issues and how to resolve them.

Terminal Conflicts

Some terminal emulators intercept key combinations before they reach Gemini CLI. For example, many terminals use Ctrl+Shift+C for copy and Ctrl+Shift+V for paste, which can shadow your custom bindings.

# Check which keys your terminal captures

gemini keybindings --test

# Common terminals that intercept keys:

# - GNOME Terminal: Ctrl+Shift+C/V (copy/paste)

# - iTerm2: Cmd+D (split pane)

# - Windows Terminal: Ctrl+Shift+T (new tab)

# Solution: Remap in your terminal settings

# or choose non-conflicting keys in Gemini CLI

tmux and Screen Conflicts

If you use tmux or GNU Screen, their prefix keys can intercept shortcuts meant for Gemini CLI. The default tmux prefix is Ctrl+B, and Screen uses Ctrl+A. Any binding that starts with these prefixes will be captured by the multiplexer.

# Check your tmux prefix

tmux show-option -g prefix

# Option 1: Change tmux prefix to avoid conflicts

# In ~/.tmux.conf:

set -g prefix C-Space

# Option 2: Use keys that bypass tmux

# Alt-based keybindings are rarely captured by tmux

{ "key": "alt+s", "command": "submit" }

Reset to Defaults

If your keybindings are broken or producing unexpected behavior, you can reset everything back to the factory defaults. This removes all custom bindings and restores the original configuration.

# Reset all keybindings to defaults

gemini config reset keybindings

# Or manually delete the config file

rm ~/.gemini/keybindings.json

# Restart Gemini CLI to regenerate defaults

gemini

Debug Mode for Keybindings

When a keybinding does not work as expected, enable debug mode to see exactly which keys Gemini CLI receives and how it interprets them. This is the fastest way to identify conflicts or misconfigurations.

# Start Gemini CLI with keybinding debug output

gemini --debug-keys

# Example debug output:

# [KEY] ctrl+s -> command: submit (matched)

# [KEY] ctrl+k -> chord prefix (waiting...)

# [KEY] ctrl+k ctrl+d -> command: formatDocument (matched)

# Show all registered keybindings

gemini keybindings --list

# Check for conflicts

gemini keybindings --check-conflicts

Related Questions

Next Steps

Now that your keybindings are set up, explore more ways to customize Gemini CLI: