2025-07-25 15:36:42 -07:00
|
|
|
/**
|
|
|
|
|
* @license
|
|
|
|
|
* Copyright 2025 Google LLC
|
|
|
|
|
* SPDX-License-Identifier: Apache-2.0
|
|
|
|
|
*/
|
|
|
|
|
|
2025-08-26 00:04:53 +02:00
|
|
|
import type { SlashCommand } from './types.js';
|
|
|
|
|
import { CommandKind } from './types.js';
|
2025-07-25 15:36:42 -07:00
|
|
|
|
|
|
|
|
export const vimCommand: SlashCommand = {
|
|
|
|
|
name: 'vim',
|
2025-10-17 13:20:15 -07:00
|
|
|
description: 'Toggle vim mode on/off',
|
2025-07-25 15:36:42 -07:00
|
|
|
kind: CommandKind.BUILT_IN,
|
2025-12-01 12:29:03 -05:00
|
|
|
autoExecute: true,
|
2025-07-25 15:36:42 -07:00
|
|
|
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,
|
|
|
|
|
};
|
|
|
|
|
},
|
|
|
|
|
};
|