Skip to main content
@gentleduck/vim

Keyboard commands for React

A typed keyboard engine for React. Hotkeys, sequences, chords, a key recorder, and a Mod key that fits each platform.

  • useKeyBind

    Binds one combo, like ctrl+k, meta+shift+p, or mod+s. Platform-aware, with preventDefault support.

  • useKeySequence

    Multi-step sequences like g then d, with a configurable timeout between steps and chord mode.

  • useKeyCommands

    Registers a whole command palette at once. Bind each command to a shortcut and render the list.

  • useKeyRecorder

    Records key presses for settings screens, so users can pick their own shortcuts and you can save them.

  • Mod key

    Mod means Cmd on macOS and Ctrl everywhere else. One binding feels native on both.

  • Framework-agnostic core

    The parser, matcher, sequence engine, and recorder are plain TypeScript. The React hooks are a thin layer on top.

Install

Wrap your app in KeyProvider, then start binding.

  1. Install

    bun add @gentleduck/vim
  2. Bind your first shortcut

    import { KeyProvider, useKeyBind } from '@gentleduck/vim/react'

Free & open source

gentleduck is MIT licensed and will always be free and open source. Every package ships with full source access — fork it, modify it, own it.

Become a Sponsor