-
Notifications
You must be signed in to change notification settings - Fork 14
Feature/customizable keybindings #27
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Implements a comprehensive keybinding system that allows users to customize
keyboard shortcuts via TOML configuration files.
Key features:
- Mode-based keybinding architecture (Normal, Interactive, LinkFollow, etc.)
- 50+ bindable actions covering all application functionality
- Flexible key string parsing ("ctrl-c", "alt-enter", "shift-tab")
- Default keybindings matching existing vim-style shortcuts
- User keybindings merge with defaults (user config takes precedence)
- Dynamic help text generation reflecting actual key mappings
Configuration example (in ~/.config/treemd/config.toml):
```toml
[keybindings.Normal]
"ctrl-q" = "Quit"
"space" = "ToggleExpand"
[keybindings.LinkFollow]
"ctrl-enter" = "FollowLink"
```
This lays the groundwork for a future keybinding settings modal similar
to the theme picker.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Add keybinds-rs crate with crossterm and serde features to provide robust multi-key sequence support and pattern-based key matching. Also update strum to 0.27 for improved enum derivation capabilities.
Replace custom key parsing logic with keybinds-rs, providing: - Multi-key sequence support (e.g., 'g g', 'Ctrl+x Ctrl+c') - Simplified dispatch API via KeybindingMode - Consistent key string format across all platforms - Removed parse.rs module in favor of keybinds-rs parser The new system maintains all existing keybindings while enabling advanced features like multi-key sequences and custom patterns.
Update TUI integration to use the new keybindings dispatch API: - Call dispatch() instead of get_action() with KeyCode/KeyModifiers - Use is_sequence_ongoing() to handle multi-key sequences - Pass crossterm KeyEvent directly to dispatch method - Minor help text formatting updates These changes maintain the existing functionality while supporting the new multi-key sequence capabilities.
Add detailed documentation for the new custom keybindings feature: - Keybinding syntax guide (single keys, modifiers, sequences, special keys) - Complete list of available modes with descriptions - Example configuration showing common patterns - Notes on key format conventions Also update navigation keybinding descriptions in the shortcuts table for clarity and consistency.
|
cc @firecat53 - I made this PR with you in mind. This should enable custom keys! If you have a chance to check out this branch and ensure it works great for your usecase and keybindings! |
|
Keybindings seem to work. However:
|
|
Also, the "PageUp" and "PageDown" actions don't work in the |
|
|
|
@firecat53 you are the amazing! Working on these in the next 15-20mins! |
- JumpToParent now works in both Outline and Content focus - PageDown/PageUp now properly scroll help popup when in Help mode - Add scroll_help_page_down/up methods for half-page scrolling
|
Moving this to #35 |
No description provided.