Skip to main content

Config-driven parser for keybindings with fzf interface

Project description

confhelp

PyPI version Python Tests License: MIT

Config-driven parser for extracting keybindings from dotfiles.

demo

Why

Most developers accumulate keybindings across tmux, zsh, vim, and other tools. These bindings live scattered across config files, and remembering them all becomes impossible.

The typical solution is maintaining a static YAML or markdown file listing shortcuts. But this falls out of sync - you add a binding and forget to update the docs.

confhelp solves this by parsing your actual config files. Define regex patterns once, and confhelp extracts bindings directly from source. Your help system stays in sync because it reads the same files you edit.

Install

pip install confhelp

Usage

# Output all bindings
confhelp -c config.toml -b ~/dotfiles

# Interactive fzf selection
confhelp -c config.toml -b ~/dotfiles --select

# Select and open in $EDITOR at line
confhelp -c config.toml -b ~/dotfiles --edit

# JSON output
confhelp -c config.toml -b ~/dotfiles -f json

Example output:

[tmux]   prefix+g   display-popup -w 80%...   .tmux.conf:42
[alias]  gs         git status                .zsh_aliases:15
[bind]   ^[e        edit-command-line         .zshrc:89

The --edit flag drops you directly into the file at the exact line. Change the binding, save, done.

Config Format

Define parsers in TOML. Each section describes how to extract bindings from a set of files:

[tmux]
paths = [".tmux.conf"]
match_line = "^bind"
regex = 'bind(?:-key)?\s+(?:-n\s+)?(\S+)(.*)'
key_group = 1
desc_group = 2
type = "tmux"
truncate = 100

[alias]
paths = [".zsh_aliases", ".zsh_claude"]
regex = "alias\\s+(?:-[gs]\\s+)?([^=]+)=(.*)"
key_group = 1
desc_group = 2
type = "alias"
strip_quotes = true

[abbrev]
paths = [".zsh_abbreviations"]
mode = "abbrev_block"
type = "abbrev"

Config Options

Option Description
paths List of files to parse (relative to base-dir)
regex Pattern with capture groups for key/desc
key_group Capture group number for the key
desc_group Capture group number for description
match_line Only process lines matching this pattern
skip_comment Skip lines starting with #
truncate Max length for description
strip_quotes Remove surrounding quotes from desc
desc_literal Use fixed string as description
desc_from_comment Extract desc from trailing # comment
mode Special modes: abbrev_block for zsh abbreviations

Output Formats

  • pipe (default): [type]|key|desc|file:line
  • tsv: Tab-separated
  • json: JSON array

The pipe format works well with column -t -s'|' for aligned display.

Integration Examples

confhelp outputs text. How you display it is up to you.

Alacritty Popup

Spawn a centered popup window showing bindings. Enter jumps to the file:

selection=$(confhelp -c config.toml -b ~/dotfiles | column -t -s'|' | fzf)
# parse selection, open in editor

See examples/alacritty-popup.sh for a complete implementation.

tmux Popup

tmux display-popup -w 80% -h 80% -E 'confhelp -c config.toml -b ~/dotfiles --select'

See examples/tmux-popup.sh for a complete implementation.

Rofi/dmenu

confhelp -c config.toml -b ~/dotfiles | rofi -dmenu

Acknowledgments

Inspired by Extracto.

License

MIT

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

confhelp-0.1.1.tar.gz (252.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

confhelp-0.1.1-py3-none-any.whl (6.5 kB view details)

Uploaded Python 3

File details

Details for the file confhelp-0.1.1.tar.gz.

File metadata

  • Download URL: confhelp-0.1.1.tar.gz
  • Upload date:
  • Size: 252.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for confhelp-0.1.1.tar.gz
Algorithm Hash digest
SHA256 6999d61e7088cf53abba41c116cef5bb933c9a2be0f61a7cd8806f3f1582a6f3
MD5 84e563ac39b4004bc4c4ad7f1056ac22
BLAKE2b-256 63fdf7537c651b1db6fcb83121fb2b20f1d7726e4ac1dbe7a126659e08e56f92

See more details on using hashes here.

File details

Details for the file confhelp-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: confhelp-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 6.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for confhelp-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 701d9318a847078d2d6fe756d46e87ab91755d69d0544a5ebee715205f59c351
MD5 7f5530275020d51f558d72516a58527e
BLAKE2b-256 786c7d35e1429cff1f1859b785acf9d65886dee5f5d3145df23679d755da31ce

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page