Skip to main content

Config-driven parser for keybindings with fzf interface

Project description

confhelp

PyPI 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): pipe-delimited [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.1.tar.gz (252.2 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.1-py3-none-any.whl (7.2 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: confhelp-0.2.1.tar.gz
  • Upload date:
  • Size: 252.2 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.1.tar.gz
Algorithm Hash digest
SHA256 d67a4339e2bd7134c5d4a18ce2a099041f08f6de98af770ad6ff19c3aaee37d7
MD5 ec9dfbd0f6488ef9e54abaed74ccda5a
BLAKE2b-256 b8f8146daa0cb493bf41a62dd04e767b590a8d6108e2a1d5537dc4851bf2fcc9

See more details on using hashes here.

Provenance

The following attestation bundles were made for confhelp-0.2.1.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.1-py3-none-any.whl.

File metadata

  • Download URL: confhelp-0.2.1-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.1-py3-none-any.whl
Algorithm Hash digest
SHA256 a2e8797527a26a774629e2c0f7cea347b2723ad57a32136496227eafcebec61b
MD5 090d1659eb49bcfa087771c7ee236750
BLAKE2b-256 10687262335227e394e4a3def5a7b44761b044fe503c3996490e7ec5f8fb0b4f

See more details on using hashes here.

Provenance

The following attestation bundles were made for confhelp-0.2.1-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