diff --git a/docs/cli/sandbox.md b/docs/cli/sandbox.md index 66f894d835..3574e9d231 100644 --- a/docs/cli/sandbox.md +++ b/docs/cli/sandbox.md @@ -309,7 +309,9 @@ $env:SANDBOX_SET_UID_GID="false" # Disable UID/GID mapping **Missing commands** -- Add to custom Dockerfile. +- Add to a custom Dockerfile. Automatic `BUILD_SANDBOX` builds are only + available when running Gemini CLI from source; npm installs need a prebuilt + image instead. - Install via `sandbox.bashrc`. **Network issues** diff --git a/docs/reference/configuration.md b/docs/reference/configuration.md index f0acd3f5a4..05368f20fe 100644 --- a/docs/reference/configuration.md +++ b/docs/reference/configuration.md @@ -2509,6 +2509,10 @@ sandbox image: BUILD_SANDBOX=1 gemini -s ``` +Building a custom sandbox with `BUILD_SANDBOX` is only supported when running +Gemini CLI from source. If you installed the CLI with npm, build the Docker +image separately and reference that image in your sandbox configuration. + ## Usage statistics To help us improve Gemini CLI, we collect anonymized usage statistics. This data diff --git a/docs/reference/keyboard-shortcuts.md b/docs/reference/keyboard-shortcuts.md index 783de916fa..98d31c0ae2 100644 --- a/docs/reference/keyboard-shortcuts.md +++ b/docs/reference/keyboard-shortcuts.md @@ -248,6 +248,83 @@ a `key` combination. - `Double-click` on a paste placeholder (alternate buffer mode only): Expand to view full content inline. Double-click again to collapse. +## Vi mode shortcuts + +When vim mode is enabled with `/vim` or `general.vimMode: true`, Gemini CLI +supports NORMAL and INSERT modes. + +### Mode switching + +| Action | Keys | +| -------------------------------------------- | --------- | +| Enter NORMAL mode from INSERT mode | `Esc` | +| Enter INSERT mode at the cursor | `i` | +| Enter INSERT mode after the cursor | `a` | +| Enter INSERT mode at the start of the line | `I` | +| Enter INSERT mode at the end of the line | `A` | +| Insert a new line below and switch to INSERT | `o` | +| Insert a new line above and switch to INSERT | `O` | +| Clear input in NORMAL mode | `Esc Esc` | + +### Navigation in NORMAL mode + +| Action | Keys | +| --------------------------------- | --------------- | +| Move left | `h` | +| Move down | `j` | +| Move up | `k` | +| Move right | `l` | +| Move to start of line | `0` | +| Move to first non-whitespace char | `^` | +| Move to end of line | `$` | +| Move forward by word | `w` | +| Move backward by word | `b` | +| Move to end of word | `e` | +| Move forward by WORD | `W` | +| Move backward by WORD | `B` | +| Move to end of WORD | `E` | +| Go to first line | `gg` | +| Go to last line | `G` | +| Go to line N | `N G` or `N gg` | + +Counts are supported for navigation commands. For example, `5j` moves down five +lines and `3w` moves forward three words. + +### Editing in NORMAL mode + +| Action | Keys | +| ------------------------------ | ----- | +| Delete character under cursor | `x` | +| Delete to end of line | `D` | +| Delete line | `dd` | +| Change to end of line | `C` | +| Change line | `cc` | +| Delete forward word | `dw` | +| Delete backward word | `db` | +| Delete to end of word | `de` | +| Delete forward WORD | `dW` | +| Delete backward WORD | `dB` | +| Delete to end of WORD | `dE` | +| Change forward word | `cw` | +| Change backward word | `cb` | +| Change to end of word | `ce` | +| Change forward WORD | `cW` | +| Change backward WORD | `cB` | +| Change to end of WORD | `cE` | +| Delete to start of line | `d0` | +| Delete to first non-whitespace | `d^` | +| Change to start of line | `c0` | +| Change to first non-whitespace | `c^` | +| Delete from first line to here | `dgg` | +| Delete from here to last line | `dG` | +| Change from first line to here | `cgg` | +| Change from here to last line | `cG` | +| Undo last change | `u` | +| Repeat last command | `.` | + +Counts are also supported for editing commands. For example, `3dd` deletes three +lines and `2cw` changes two words. + ## Limitations - On [Windows Terminal](https://en.wikipedia.org/wiki/Windows_Terminal): diff --git a/packages/core/src/config/config.test.ts b/packages/core/src/config/config.test.ts index a43921e144..3ac1aa2c34 100644 --- a/packages/core/src/config/config.test.ts +++ b/packages/core/src/config/config.test.ts @@ -304,6 +304,53 @@ describe('Server Config (config.ts)', () => { }); }); + describe('setShellExecutionConfig', () => { + it('should preserve existing shell execution fields that are not being updated', () => { + const config = new Config({ + ...baseParams, + sandbox: { + enabled: true, + command: 'windows-native', + networkAccess: false, + }, + shellBackgroundCompletionBehavior: 'notify', + }); + + expect(config.getShellExecutionConfig()).toEqual( + expect.objectContaining({ + sandboxConfig: expect.objectContaining({ + enabled: true, + command: 'windows-native', + networkAccess: false, + }), + backgroundCompletionBehavior: 'notify', + }), + ); + + config.setShellExecutionConfig({ + terminalWidth: 123, + terminalHeight: 45, + showColor: true, + pager: 'cat', + sanitizationConfig: config.sanitizationConfig, + sandboxManager: config.sandboxManager, + }); + + expect(config.getShellExecutionConfig()).toEqual( + expect.objectContaining({ + terminalWidth: 123, + terminalHeight: 45, + sandboxConfig: expect.objectContaining({ + enabled: true, + command: 'windows-native', + networkAccess: false, + }), + backgroundCompletionBehavior: 'notify', + }), + ); + }); + }); + beforeEach(() => { // Reset mocks if necessary vi.clearAllMocks(); diff --git a/packages/core/src/config/config.ts b/packages/core/src/config/config.ts index 2ef6fc26a8..5e8507eba4 100644 --- a/packages/core/src/config/config.ts +++ b/packages/core/src/config/config.ts @@ -3334,6 +3334,7 @@ export class Config implements McpContext, AgentLoopContext { setShellExecutionConfig(config: ShellExecutionConfig): void { this.shellExecutionConfig = { + ...this.shellExecutionConfig, terminalWidth: config.terminalWidth ?? this.shellExecutionConfig.terminalWidth, terminalHeight: