Gemini CLI Keyboard Shortcuts
Keyboard shortcuts, approval modes, and slash commands for Gemini CLI — Google's open-source terminal AI agent — on MacWindowsLinux. These are the default keybindings (remappable in ~/.gemini/keybindings.json).
Starting & Approval Modes
| Action | Shortcut |
|---|---|
| Run without installing | npx https://github.com/google-gemini/gemini-clinpx https://github.com/google-gemini/gemini-clinpx https://github.com/google-gemini/gemini-cli |
| Install globally with npm | npm install -g @google/gemini-clinpm install -g @google/gemini-clinpm install -g @google/gemini-cli |
| Start Gemini CLI | geminigeminigemini |
| Submit your prompt | EnterEnterEnter |
| Cycle approval modes (Default → Auto-Edit → Plan) | ShiftTabShiftTabShiftTab |
| Toggle YOLO mode (auto-approve all tool calls) | CtrlYCtrlYCtrlY |
| Switch to Plan mode (read-only) and view the plan | /plan/plan/plan |
| Cancel the current request, or quit when input is empty | CtrlCCtrlCCtrlC |
| Exit when the input buffer is empty | CtrlDCtrlDCtrlD |
| Dismiss a dialog or cancel focus | EscEscEsc |
Input & Editing
| Action | Shortcut |
|---|---|
| Insert a newline without submitting | CtrlJCtrlJCtrlJ |
| Move cursor to start / end of line | CtrlACtrlACtrlA |
| Move cursor to end of line | CtrlECtrlECtrlE |
| Delete from cursor to end of line | CtrlKCtrlKCtrlK |
| Delete from cursor to start of line | CtrlUCtrlUCtrlU |
| Delete the previous word | CtrlWCtrlWCtrlW |
| Clear all input text | CtrlCCtrlCCtrlC |
| Open the prompt in an external editor | CtrlGCtrlGCtrlG |
| Clear the screen and redraw the UI | CtrlLCtrlLCtrlL |
| Toggle the shortcuts panel (on an empty prompt) | ??? |
History, Suggestions & Navigation
| Action | Shortcut |
|---|---|
| Previous entry in history | CtrlPCtrlPCtrlP |
| Next entry in history | CtrlNCtrlNCtrlN |
| Reverse-search through history | CtrlRCtrlRCtrlR |
| Accept the inline suggestion | TabTabTab |
| Queue the prompt to run after the current task | TabTabTab |
| Rewind: edit input, or step back through interactions | EscEscEscEscEscEsc |
| Scroll content up / down | ShiftUpShiftUpShiftUp |
| Toggle the full TODO list | CtrlTCtrlTCtrlT |
Slash Commands
| Action | Shortcut |
|---|---|
| Display help and available commands | /help/help/help |
| Clear the screen and session scrollback | /clear/clear/clear |
| Replace the chat context with a summary (save tokens) | /compress/compress/compress |
| Browse and resume previous sessions | /resume/resume/resume |
| Generate a tailored GEMINI.md context file | /init/init/init |
| Manage instructional memory (GEMINI.md) | /memory/memory/memory |
| Manage model configuration | /model/model/model |
| Navigate backward and revert chat or file changes | /rewind/rewind/rewind |
| Undo file edits a tool made (restore checkpoint) | /restore/restore/restore |
| Manage configured MCP servers | /mcp/mcp/mcp |
| List currently available tools | /tools/tools/tools |
| Copy Gemini's last output to the clipboard | /copy/copy/copy |
| Show detailed session statistics | /stats/stats/stats |
| Toggle vim mode (NORMAL / INSERT) | /vim/vim/vim |
| Change the visual theme | /theme/theme/theme |
| Exit Gemini CLI | /quit/quit/quit |
File References & Shell
| Action | Shortcut |
|---|---|
| Reference a file or directory in your prompt | @path/to/file@path/to/file@path/to/file |
| Run a single shell command | !command!command!command |
| Toggle persistent shell mode | !!! |
| Paste from the clipboard | CmdVCtrlVCtrlV |
No shortcuts found. Try a different search term.
Frequently Asked Questions
What is Gemini CLI?
Gemini CLI is Google's official open-source terminal AI agent — a command-line tool that reads, writes, and runs code in your project from the terminal, powered by Gemini models. It's Google's counterpart to Claude Code, Codex CLI, and Grok Build. You install it with npm (npm install -g @google/gemini-cli) or run it instantly with npx, and it requires Node.js 20 or newer.
How do I switch modes in Gemini CLI?
Press Shift+Tab to cycle through the approval modes: Default (prompts before each action) → Auto-Edit (auto-approves edits) → Plan (read-only, drafts a plan without changing files). Plan mode is skipped in the rotation while the agent is busy. You can jump straight to Plan mode with /plan, and Ctrl+Y toggles YOLO mode, which auto-approves every tool call.
How do I insert a new line in Gemini CLI without sending?
Press Ctrl+J to insert a newline without submitting. Shift+Enter, Alt+Enter, and Ctrl+Enter also work in terminals that support them, but Ctrl+J is the most reliable. Note: Shift+Enter is not supported in macOS Terminal.app and only works in Windows Terminal 1.25+. You can also type \ at the end of a line and press Enter.
Can I customize Gemini CLI keyboard shortcuts?
Yes. The shortcuts on this page are the defaults, and Gemini CLI lets you remap any of them in ~/.gemini/keybindings.json (a VS Code-style schema). To unbind a command, prefix it with a minus sign. Run /vim to switch the input to vim-style editing if you prefer modal keys.
How do I reference files in Gemini CLI?
Type @ followed by a path, like @src/app.ts or @README.md, to inject that file or directory's content into your prompt. It's git-aware, so ignored files (node_modules, dist, .env) are excluded by default. To run a shell command, prefix the line with ! (for example !git status), or type ! alone to toggle persistent shell mode.
How is Gemini CLI different from the Gemini chat app?
Gemini CLI is a terminal coding agent for developers — it works in your shell and edits your project files. The Gemini chat app is Google's web and mobile conversational assistant, covered on the Gemini keyboard shortcuts page. They share the underlying models but have completely different interfaces and shortcuts.