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

The --edit flag drops you directly into the file at the exact line where the binding is defined. 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.0.tar.gz (251.5 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.0-py3-none-any.whl (6.4 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: confhelp-0.1.0.tar.gz
  • Upload date:
  • Size: 251.5 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.0.tar.gz
Algorithm Hash digest
SHA256 08ea93613dc6633deef3240526d87decc9f8a8342a835ef122aaf44b13693e6a
MD5 d2062364917cc346fafa402761d948a3
BLAKE2b-256 76122447f47188e82468a147c13dda8086227715ec8b22f0d89ff48482f1906e

See more details on using hashes here.

File details

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

File metadata

  • Download URL: confhelp-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 6.4 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.0-py3-none-any.whl
Algorithm Hash digest
SHA256 07a17cf41324ed36ac0c99659921ea79b33979726e4bce9b2c2cf4e0667e4296
MD5 320b4c17702d81a7bd18a25ab065a58b
BLAKE2b-256 b17e334bd7fe61c448bf4843888ca44fe0e42083c58e920022f13119df490d8c

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