summaryrefslogtreecommitdiff
path: root/packages/cli/src/ui/commands
diff options
context:
space:
mode:
Diffstat (limited to 'packages/cli/src/ui/commands')
-rw-r--r--packages/cli/src/ui/commands/types.ts1
-rw-r--r--packages/cli/src/ui/commands/vimCommand.ts25
2 files changed, 26 insertions, 0 deletions
diff --git a/packages/cli/src/ui/commands/types.ts b/packages/cli/src/ui/commands/types.ts
index 1684677c..59b0178c 100644
--- a/packages/cli/src/ui/commands/types.ts
+++ b/packages/cli/src/ui/commands/types.ts
@@ -58,6 +58,7 @@ export interface CommandContext {
loadHistory: UseHistoryManagerReturn['loadHistory'];
/** Toggles a special display mode. */
toggleCorgiMode: () => void;
+ toggleVimEnabled: () => Promise<boolean>;
};
// Session-specific data
session: {
diff --git a/packages/cli/src/ui/commands/vimCommand.ts b/packages/cli/src/ui/commands/vimCommand.ts
new file mode 100644
index 00000000..40e658df
--- /dev/null
+++ b/packages/cli/src/ui/commands/vimCommand.ts
@@ -0,0 +1,25 @@
+/**
+ * @license
+ * Copyright 2025 Google LLC
+ * SPDX-License-Identifier: Apache-2.0
+ */
+
+import { CommandKind, SlashCommand } from './types.js';
+
+export const vimCommand: SlashCommand = {
+ name: 'vim',
+ description: 'toggle vim mode on/off',
+ kind: CommandKind.BUILT_IN,
+ action: async (context, _args) => {
+ const newVimState = await context.ui.toggleVimEnabled();
+
+ const message = newVimState
+ ? 'Entered Vim mode. Run /vim again to exit.'
+ : 'Exited Vim mode.';
+ return {
+ type: 'message',
+ messageType: 'info',
+ content: message,
+ };
+ },
+};