Skip to content

Latest commit

 

History

History
101 lines (83 loc) · 2.56 KB

File metadata and controls

101 lines (83 loc) · 2.56 KB

clack.nvim

Add mechanical keyboard sound effects to Neovim!

Requirements

  • Neovim >= 0.10.0 (vim.system() is required)
  • For legacy per-file .wav profiles, one of:
    • afplay (macOS)
    • aplay (Linux)
    • PowerShell (Windows)
  • For bundled single-file .ogg profiles, either:
    • ffplay
    • mpv
    • or ffmpeg plus the OS audio backend above

Warning

There is a noticable delay when using wireless headphones/earbuds. Use wired earbuds for the best experience.

Installation

Use your favorite plugin manager!

{
  "smit4k/clack.nvim",
  opts = {
    profile = "nk-cream",
    volume = 0.8,
    enabled = true,
    on_enter = true,
    on_space = true,
    on_save = true,
    on_non_insert = false,
  },
}

Available profiles are detected from sounds/<folder> and use the folder name as the profile id. Current bundled folders include:

  • cherrymx-blue-pbt
  • cherrymx-blue-abs
  • cherrymx-red-pbt
  • cherrymx-red-abs
  • cherrymx-brown-pbt
  • cherrymx-brown-abs
  • cherrymx-black-pbt
  • cherrymx-black-abs
  • topre-purple-hybrid-pbt
  • eg-crystal-purple
  • eg-oreo
  • holy-pandas
  • mxblue-travel
  • mxblack-travel
  • mxbrown-travel
  • cream-travel
  • turquoise
  • nk-cream

Commands:

  • :ClackEnable
  • :ClackDisable
  • :ClackToggle
  • :ClackProfile
  • :checkhealth clack

Set on_non_insert = true if you also want sounds for motions, counts, and other non-insert keystrokes. Run :checkhealth clack if playback is unavailable or a profile does not seem to load.

Sound assets

Sounds are resolved relative to the plugin install directory. clack.nvim now supports both the original pool layout and config.json packs that slice a single .ogg file into per-key clips.

Pool layout:

sounds/
  blue/
    key_1.wav key_2.wav key_3.wav key_4.wav
    enter_1.wav enter_2.wav enter_3.wav enter_4.wav
    space_1.wav space_2.wav space_3.wav space_4.wav
    save_1.wav save_2.wav save_3.wav save_4.wav
  red/
  topre/
  buckling_spring/

Single-file layout:

sounds/
  cherrymx-blue-pbt/
    config.json
    sound.ogg

For single-file packs, the plugin reads the defines map from config.json, keeps a small variation pool for generic typing, and pre-extracts those slices to cached .wav files in the temp directory when possible. If ffmpeg is unavailable, ffplay or mpv can play slices directly. Because Neovim only exposes inserted characters rather than raw keyboard scan codes, save sounds reuse the generic key pool and release-only slices are ignored.