Skip to content

Commit

Permalink
keys: Re-order editor text manipulation key bindings by importance.
Browse files Browse the repository at this point in the history
The text manipulation hotkeys are re-ordered to place more powerful
commands at the beginning of the category in the help menu and the doc.

As part of this process, the editor key bindings are grouped by their
categories within the source file, improving readability.

Hotkeys document regenerated.
  • Loading branch information
Niloth-p authored and neiljp committed Jun 1, 2024
1 parent d3dd70b commit 49b67cc
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 26 deletions.
8 changes: 4 additions & 4 deletions docs/hotkeys.md
Original file line number Diff line number Diff line change
Expand Up @@ -97,14 +97,14 @@
## Editor: Text Manipulation
|Command|Key Combination|
| :--- | :---: |
|Delete previous character (to left)|<kbd>Ctrl</kbd> + <kbd>h</kbd>|
|Transpose characters|<kbd>Ctrl</kbd> + <kbd>t</kbd>|
|Undo last action|<kbd>Ctrl</kbd> + <kbd>_</kbd>|
|Clear text box|<kbd>Ctrl</kbd> + <kbd>l</kbd>|
|Cut forwards to the end of the line|<kbd>Ctrl</kbd> + <kbd>k</kbd>|
|Cut backwards to the start of the line|<kbd>Ctrl</kbd> + <kbd>u</kbd>|
|Cut forwards to the end of the current word|<kbd>Meta</kbd> + <kbd>d</kbd>|
|Cut backwards to the start of the current word|<kbd>Ctrl</kbd> + <kbd>w</kbd> / <kbd>Meta</kbd> + <kbd>Backspace</kbd>|
|Cut the current line|<kbd>Meta</kbd> + <kbd>x</kbd>|
|Paste last cut section|<kbd>Ctrl</kbd> + <kbd>y</kbd>|
|Undo last action|<kbd>Ctrl</kbd> + <kbd>_</kbd>|
|Clear text box|<kbd>Ctrl</kbd> + <kbd>l</kbd>|
|Delete previous character (to left)|<kbd>Ctrl</kbd> + <kbd>h</kbd>|
|Transpose characters|<kbd>Ctrl</kbd> + <kbd>t</kbd>|

44 changes: 22 additions & 22 deletions zulipterminal/config/keys.py
Original file line number Diff line number Diff line change
Expand Up @@ -340,14 +340,24 @@ class KeyBinding(TypedDict):
'help_text': 'Jump forward one word',
'key_category': 'editor_navigation',
},
'DELETE_LAST_CHARACTER': {
'keys': ['ctrl h'],
'help_text': 'Delete previous character (to left)',
'PREV_LINE': {
'keys': ['up', 'ctrl p'],
'help_text': 'Jump to the previous line',
'key_category': 'editor_navigation',
},
'NEXT_LINE': {
'keys': ['down', 'ctrl n'],
'help_text': 'Jump to the next line',
'key_category': 'editor_navigation',
},
'UNDO_LAST_ACTION': {
'keys': ['ctrl _'],
'help_text': 'Undo last action',
'key_category': 'editor_text_manipulation',
},
'TRANSPOSE_CHARACTERS': {
'keys': ['ctrl t'],
'help_text': 'Transpose characters',
'CLEAR_MESSAGE': {
'keys': ['ctrl l'],
'help_text': 'Clear text box',
'key_category': 'editor_text_manipulation',
},
'CUT_TO_END_OF_LINE': {
Expand Down Expand Up @@ -380,24 +390,14 @@ class KeyBinding(TypedDict):
'help_text': 'Paste last cut section',
'key_category': 'editor_text_manipulation',
},
'UNDO_LAST_ACTION': {
'keys': ['ctrl _'],
'help_text': 'Undo last action',
'DELETE_LAST_CHARACTER': {
'keys': ['ctrl h'],
'help_text': 'Delete previous character (to left)',
'key_category': 'editor_text_manipulation',
},
'PREV_LINE': {
'keys': ['up', 'ctrl p'],
'help_text': 'Jump to the previous line',
'key_category': 'editor_navigation',
},
'NEXT_LINE': {
'keys': ['down', 'ctrl n'],
'help_text': 'Jump to the next line',
'key_category': 'editor_navigation',
},
'CLEAR_MESSAGE': {
'keys': ['ctrl l'],
'help_text': 'Clear text box',
'TRANSPOSE_CHARACTERS': {
'keys': ['ctrl t'],
'help_text': 'Transpose characters',
'key_category': 'editor_text_manipulation',
},
'FULL_RENDERED_MESSAGE': {
Expand Down

0 comments on commit 49b67cc

Please sign in to comment.