Suggestions to end the shortcuts shortage
Kate has since a while a lack of unused shortcuts. As a consequence, when developers add new actions they are often confronted with a difficult choice:
- Reassign existing shortcuts: likely to make some users unhappy which are used to that shortcut
- Not setting any shortcut: makes the feature less likely to be used, as now the difficult decision to assign a suitable (unused?) shortcut has been offloaded to the user
Overall, this leaves important actions without shortcuts in Kate (cursor history forward backwards navigation, many lsp actions such as rename, format, expand, shrink selection, all debug actions...) resulting in a degradation of usability as users need to assign core shortcuts first to be able to work efficiently with Kate.
Why is there a shortage in the first place?
- Kate has many actions
- When a shortcut is set once, it cannot be assigned elsewhere (see Solution Suggestion 2)
- We have assigned a lot of shortcuts for navigating forward and backward in different scenarios
Solution Suggestion 1 (short-term): A new pseudo meta key (EMacs style shortcuts)
Use Ctrl+<Key> as a "meta key", i.e. this meta key combination needs to pressed first before the actual shortcut which follows afterwards. This is known as EMacs style shortcut sequences in Qt https://doc.qt.io/qt-6/qkeysequence.html and already used in at least once place in KDE Plasma, namely the task manager (Enter Edit Mode Alt+D, Alt+S). VS Code also uses this to have more shortcuts that can be assigned (Ctrl+K is the "meta key" there).
As these shortcuts are slow to press, they should not be used for actions that need to be used in quick succession (such as some lsp and debug actions).
Solution Suggestion 2 (long-term): Conditional Shortcuts
As mentioned above, we cannot reassign shortcuts that are assigned once anywhere else. VS Code defines a condition for each action, when its shortcut is active. This allows assigning the same shortcut multiple times. For example, we could assign F2 to LSP Rename if the editor has focus and to Rename Document if Document tools view has focus.
Essentially, an implementation in KXMLGUI would need to ensure for a given condition there is only one shortcut of a name. Conditions must be exclusively formulated (responsibility of developers) and not changeable, but displayed in the shortcuts dialog. I would recommend making such a system opt-in for applications to introduce this additional complexity only when really needed.