New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

@gentleduck/vim

Package Overview
Dependencies
Maintainers
1
Versions
16
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@gentleduck/vim

A keyboard command engine with hotkey parsing, sequences, recording, and React hooks.

latest
Source
npmnpm
Version
0.1.18
Version published
Weekly downloads
119
-73.73%
Maintainers
1
Weekly downloads
 
Created
Source

@gentleduck/vim

Keyboard command engine for React.

Bind hotkeys, record key sequences, and handle platform-aware modifier keys. Framework-agnostic core with React hooks included.

Why

  • Multi-step key sequences (g then d) with configurable timeout
  • Key recording for settings UIs where users customize their bindings
  • Platform-aware Mod key: resolves to Cmd on macOS, Ctrl everywhere else

Quick start

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

function App() {
  useKeyBind('ctrl+k', () => console.log('open palette'), {
    preventDefault: true,
  })

  return <div>Press Ctrl+K</div>
}

export default function Root() {
  return (
    <KeyProvider>
      <App />
    </KeyProvider>
  )
}

Features

  • Key parsing -- parse, normalize, and validate binding strings (Mod+Shift+S to structured descriptors)
  • Sequences -- multi-step key chains with timeout and progress tracking
  • Recording -- capture key combinations from user input for rebinding UIs
  • React hooks -- useKeyBind, useKeySequence, useKeyRecorder, useKeyCommands
  • Platform detection -- auto-detect macOS/Windows/Linux and resolve modifier labels
  • Conflict detection -- warn, error, or silently replace duplicate bindings
  • Per-binding options -- preventDefault, stopPropagation, ignoreInputs, requireReset

Modules

Each module is a separate subpath export and can be used independently:

ModuleImportPurpose
platform@gentleduck/vim/platformOS detection, Mod resolution
parser@gentleduck/vim/parserParse/normalize/validate bindings
matcher@gentleduck/vim/matcherMatch keyboard events
format@gentleduck/vim/formatPlatform-aware display formatting
command@gentleduck/vim/commandRegistry and key handler
sequence@gentleduck/vim/sequenceMulti-key sequence matching
recorder@gentleduck/vim/recorderKey combination recording
react@gentleduck/vim/reactReact context, hooks

Bundle

  • Zero runtime dependencies (React is a peer dep)
  • Tree-shakeable subpath exports
  • "sideEffects": false

Docs

gentleduck.org

License

MIT

Keywords

gentleduck

FAQs

Package last updated on 26 Mar 2026

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts