buroventures-harald-code
Version:
Harald Code - AI-powered coding assistant CLI
29 lines (28 loc) • 968 B
TypeScript
/**
* @license
* Copyright 2025 Google LLC
* SPDX-License-Identifier: Apache-2.0
*/
import type { Key } from './useKeypress.js';
import type { TextBuffer } from '../components/shared/text-buffer.js';
export type VimMode = 'NORMAL' | 'INSERT';
/**
* React hook that provides vim-style editing functionality for text input.
*
* Features:
* - Modal editing (INSERT/NORMAL modes)
* - Navigation: h,j,k,l,w,b,e,0,$,^,gg,G with count prefixes
* - Editing: x,a,i,o,O,A,I,d,c,D,C with count prefixes
* - Complex operations: dd,cc,dw,cw,db,cb,de,ce
* - Command repetition (.)
* - Settings persistence
*
* @param buffer - TextBuffer instance for text manipulation
* @param onSubmit - Optional callback for command submission
* @returns Object with vim state and input handler
*/
export declare function useVim(buffer: TextBuffer, onSubmit?: (value: string) => void): {
mode: VimMode;
vimModeEnabled: boolean;
handleInput: (key: Key) => boolean;
};