Skip to main content

Config-driven parser for keybindings with fzf interface

Project description

confhelp

PyPI version Python CI License: MIT

Config-driven parser for extracting keybindings from dotfiles.

demo

What: Extracts keybindings from config files (tmux, zsh, vim, etc.) using regex patterns defined in TOML.

How: Point confhelp at your dotfiles with a config defining patterns per file type. It outputs [type]|key|desc|file:line - pipe to fzf, rofi, or scripts.

Why: Static cheatsheets drift out of sync. tldr/cheat.sh show generic examples, not your bindings. Grepping configs works but no structure. confhelp gives you searchable, structured output from your actual configs with jump-to-definition.

Install

pip install confhelp

Usage

# Output all bindings (uses ~/.config/confhelp/config.toml)
confhelp -b ~/dotfiles

# Interactive fzf selection
confhelp -b ~/dotfiles --select

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

# JSON output
confhelp -b ~/dotfiles -f json

# Custom config
confhelp -c /path/to/config.toml -b ~/dotfiles

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 -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 -b ~/dotfiles --select'

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

Rofi/dmenu

confhelp -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.2.0.tar.gz (252.6 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.2.0-py3-none-any.whl (7.2 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for confhelp-0.2.0.tar.gz
Algorithm Hash digest
SHA256 8b6e9ffc4f65a98207cfcbcb3b75e945d86c986275b4d95a2dfcf7dd797c6d6e
MD5 fe062bef6b96e0441eef2550127e18fa
BLAKE2b-256 c07a675985b0adcac98acff8371c3a716abf253e5a1d1525251c01999ad0ff22

See more details on using hashes here.

Provenance

The following attestation bundles were made for confhelp-0.2.0.tar.gz:

Publisher: publish.yml on Piotr1215/confhelp

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

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

File metadata

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

File hashes

Hashes for confhelp-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 7786f79b6f721d738bcc079d3db8243d16828801055b3dc55cb72fe644bfd469
MD5 dd9c052b6be3d1e51398771eabb18e69
BLAKE2b-256 c5927ba285254bc8b8dfc56bec06e09a33a50c0217a86fd7f35f6a4f1fbb7e9f

See more details on using hashes here.

Provenance

The following attestation bundles were made for confhelp-0.2.0-py3-none-any.whl:

Publisher: publish.yml on Piotr1215/confhelp

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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