Skip to content

Feature: Custom Keybindings#131

Merged
Maxteabag merged 1 commit into
Maxteabag:mainfrom
xtrasmal:main
May 25, 2026
Merged

Feature: Custom Keybindings#131
Maxteabag merged 1 commit into
Maxteabag:mainfrom
xtrasmal:main

Conversation

@xtrasmal
Copy link
Copy Markdown
Contributor

@xtrasmal xtrasmal commented Feb 2, 2026

Implements user-facing JSON keymap configuration following the ThemeManager pattern. Users can now customize all keybindings by creating JSON files in ~/.sqlit/keymaps/ and setting custom_keymap in settings.json.

Features:

  • KeymapManager class for loading/validating custom keymaps
  • FileBasedKeymapProvider implementing KeymapProvider interface
  • JSON structure with leader_commands and action_keys arrays
  • Graceful error handling (invalid configs don't crash app)
  • Comprehensive test suite (11 tests covering all scenarios)
  • User documentation with examples and troubleshooting
  • Template keymap showing all default bindings

Integration:

  • Loads during app startup after theme initialization
  • Settings key: custom_keymap (default/name)
  • Directory: ~/.sqlit/keymaps/
  • Follows established sqlit theme configuration pattern

Files:

  • sqlit/core/keymap_manager.py: Manager implementation
  • config/keymap.template.json: User template with examples
  • docs/custom-keymaps.md: Complete user guide
  • tests/ui/keybindings/test_keymap_manager.py: Test coverage

This enables power users to customize keybindings per CONTRIBUTING.md line 243 which explicitly permits keyboard binding customization.

Implements user-facing JSON keymap configuration following the
ThemeManager pattern. Users can now customize all keybindings by
creating JSON files in ~/.sqlit/keymaps/ and setting custom_keymap
in settings.json.

Features:
- KeymapManager class for loading/validating custom keymaps
- FileBasedKeymapProvider implementing KeymapProvider interface
- JSON structure with leader_commands and action_keys arrays
- Graceful error handling (invalid configs don't crash app)
- Comprehensive test suite (11 tests covering all scenarios)
- User documentation with examples and troubleshooting
- Template keymap showing all default bindings

Integration:
- Loads during app startup after theme initialization
- Settings key: custom_keymap (default/name)
- Directory: ~/.sqlit/keymaps/
- Follows established sqlit configuration patterns

Files:
- sqlit/core/keymap_manager.py: Manager implementation
- config/keymap.template.json: User template with examples
- docs/custom-keymaps.md: Complete user guide
- tests/ui/keybindings/test_keymap_manager.py: Test coverage

This enables power users to customize keybindings per CONTRIBUTING.md
line 243 which explicitly permits keyboard binding customization.
@xtrasmal xtrasmal changed the title Feature: keybindings customization Feature: Custom Keybindings Feb 2, 2026
@xtrasmal
Copy link
Copy Markdown
Contributor Author

xtrasmal commented Feb 2, 2026

Files you can use as keymaps:

https://gist.github.com/xtrasmal/1c15deb40b0caeaae0740648b802b4d9

@aemonge
Copy link
Copy Markdown

aemonge commented Mar 19, 2026

I would love this feature, especially since the auto-compeltion I prefer C-N / C-P as selection and C-K as accepting selection.

@nestor-custodio
Copy link
Copy Markdown

Oh this is incredible. Custom keybindings are the only thing preventing me from fully switching over to sqlit.

+1'ing in hopes this PR sees a merge and release. 🙏

@Maxteabag
Copy link
Copy Markdown
Owner

Great idea, thanks.

@xtrasmal I think it would make more sense if the custom keymap was additive, meaning you only replace the keymaps of the JSON you've configured. So that you don't need to paste in the entire JSON just to replace one or two keybindings.

I would like to see that the keyhints in the footer and the help menu reflect the custom keybindings too.

Let me know what you think.

@Maxteabag Maxteabag merged commit 55705ce into Maxteabag:main May 25, 2026
pull Bot pushed a commit to Stars1233/sqlit that referenced this pull request May 25, 2026
Builds on Maxteabag#131 by xtrasmal. Overrides now merge over the defaults
rather than replacing the whole map, the footer and help screen
reflect custom keys, and a config with conflicting bindings is
rejected at startup. Also wires more screens (value view,
autocomplete, connection editor, etc.) into the keymap so user
overrides actually take effect there too.

Co-authored-by: Xander <1174877+xtrasmal@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants