Skip to content

Commit 88cd99e

Browse files
committed
lint-hotkeys: Refine display of keys in hotkeys doc.
Uses the new display functions from keys.py. Applies - Capitalization of special keys. - Fix "<kbd>page</kbd> + <kbd>up</kbd>" to "<kbd>PgUp</kbd>".
1 parent a2e616e commit 88cd99e

File tree

2 files changed

+46
-40
lines changed

2 files changed

+46
-40
lines changed

docs/hotkeys.md

+37-37
Original file line numberDiff line numberDiff line change
@@ -6,31 +6,31 @@
66
|Command|Key Combination|
77
| :--- | :---: |
88
|Show/hide help menu|<kbd>?</kbd>|
9-
|Show/hide markdown help menu|<kbd>meta</kbd> + <kbd>m</kbd>|
10-
|Show/hide about menu|<kbd>meta</kbd> + <kbd>?</kbd>|
11-
|Go Back|<kbd>esc</kbd>|
9+
|Show/hide markdown help menu|<kbd>Meta</kbd> + <kbd>m</kbd>|
10+
|Show/hide about menu|<kbd>Meta</kbd> + <kbd>?</kbd>|
11+
|Go Back|<kbd>Esc</kbd>|
1212
|Open draft message saved in this session|<kbd>d</kbd>|
13-
|Redraw screen|<kbd>ctrl</kbd> + <kbd>l</kbd>|
14-
|Quit|<kbd>ctrl</kbd> + <kbd>c</kbd>|
13+
|Redraw screen|<kbd>Ctrl</kbd> + <kbd>l</kbd>|
14+
|Quit|<kbd>Ctrl</kbd> + <kbd>c</kbd>|
1515
|View user information (From Users list)|<kbd>i</kbd>|
1616

1717
## Navigation
1818
|Command|Key Combination|
1919
| :--- | :---: |
20-
|Go up / Previous message|<kbd>up</kbd> / <kbd>k</kbd>|
21-
|Go down / Next message|<kbd>down</kbd> / <kbd>j</kbd>|
22-
|Go left|<kbd>left</kbd> / <kbd>h</kbd>|
23-
|Go right|<kbd>right</kbd> / <kbd>l</kbd>|
24-
|Scroll up|<kbd>page</kbd> + <kbd>up</kbd> / <kbd>K</kbd>|
25-
|Scroll down|<kbd>page</kbd> + <kbd>down</kbd> / <kbd>J</kbd>|
26-
|Go to bottom / Last message|<kbd>end</kbd> / <kbd>G</kbd>|
27-
|Narrow to all messages|<kbd>a</kbd> / <kbd>esc</kbd>|
20+
|Go up / Previous message|<kbd>Up</kbd> / <kbd>k</kbd>|
21+
|Go down / Next message|<kbd>Down</kbd> / <kbd>j</kbd>|
22+
|Go left|<kbd>Left</kbd> / <kbd>h</kbd>|
23+
|Go right|<kbd>Right</kbd> / <kbd>l</kbd>|
24+
|Scroll up|<kbd>PgUp</kbd> / <kbd>K</kbd>|
25+
|Scroll down|<kbd>PgDn</kbd> / <kbd>J</kbd>|
26+
|Go to bottom / Last message|<kbd>End</kbd> / <kbd>G</kbd>|
27+
|Narrow to all messages|<kbd>a</kbd> / <kbd>Esc</kbd>|
2828
|Narrow to all direct messages|<kbd>P</kbd>|
2929
|Narrow to all starred messages|<kbd>f</kbd>|
3030
|Narrow to messages in which you're mentioned|<kbd>#</kbd>|
3131
|Next unread topic|<kbd>n</kbd>|
3232
|Next unread direct message|<kbd>p</kbd>|
33-
|Perform current action|<kbd>enter</kbd>|
33+
|Perform current action|<kbd>Enter</kbd>|
3434

3535
## Searching
3636
|Command|Key Combination|
@@ -44,7 +44,7 @@
4444
## Message actions
4545
|Command|Key Combination|
4646
| :--- | :---: |
47-
|Reply to the current message|<kbd>r</kbd> / <kbd>enter</kbd>|
47+
|Reply to the current message|<kbd>r</kbd> / <kbd>Enter</kbd>|
4848
|Reply mentioning the sender of the current message|<kbd>@</kbd>|
4949
|Reply quoting the current message text|<kbd>></kbd>|
5050
|Reply directly to the sender of the current message|<kbd>R</kbd>|
@@ -57,7 +57,7 @@
5757
|Narrow to a topic/direct-chat, or stream/all-direct-messages|<kbd>z</kbd>|
5858
|Toggle first emoji reaction on selected message|<kbd>=</kbd>|
5959
|Add/remove thumbs-up reaction to the current message|<kbd>+</kbd>|
60-
|Add/remove star status of the current message|<kbd>ctrl</kbd> + <kbd>s</kbd> / <kbd>*</kbd>|
60+
|Add/remove star status of the current message|<kbd>Ctrl</kbd> + <kbd>s</kbd> / <kbd>*</kbd>|
6161
|Show/hide message information|<kbd>i</kbd>|
6262
|Show/hide message sender information|<kbd>u</kbd>|
6363
|Show/hide edit history (from message information)|<kbd>e</kbd>|
@@ -77,25 +77,25 @@
7777
## Composing a Message
7878
|Command|Key Combination|
7979
| :--- | :---: |
80-
|Cycle through recipient and content boxes|<kbd>tab</kbd>|
81-
|Send a message|<kbd>ctrl</kbd> + <kbd>d</kbd> / <kbd>meta</kbd> + <kbd>enter</kbd>|
82-
|Save current message as a draft|<kbd>meta</kbd> + <kbd>s</kbd>|
83-
|Autocomplete @mentions, #stream_names, :emoji: and topics|<kbd>ctrl</kbd> + <kbd>f</kbd>|
84-
|Cycle through autocomplete suggestions in reverse|<kbd>ctrl</kbd> + <kbd>r</kbd>|
85-
|Narrow to compose box message recipient|<kbd>meta</kbd> + <kbd>.</kbd>|
86-
|Jump to the beginning of line|<kbd>ctrl</kbd> + <kbd>a</kbd>|
87-
|Jump to the end of line|<kbd>ctrl</kbd> + <kbd>e</kbd>|
88-
|Jump backward one word|<kbd>meta</kbd> + <kbd>b</kbd>|
89-
|Jump forward one word|<kbd>meta</kbd> + <kbd>f</kbd>|
90-
|Delete previous character (to left)|<kbd>ctrl</kbd> + <kbd>h</kbd>|
91-
|Transpose characters|<kbd>ctrl</kbd> + <kbd>t</kbd>|
92-
|Cut forwards to the end of the line|<kbd>ctrl</kbd> + <kbd>k</kbd>|
93-
|Cut backwards to the start of the line|<kbd>ctrl</kbd> + <kbd>u</kbd>|
94-
|Cut forwards to the end of the current word|<kbd>meta</kbd> + <kbd>d</kbd>|
95-
|Cut backwards to the start of the current word|<kbd>ctrl</kbd> + <kbd>w</kbd>|
96-
|Paste last cut section|<kbd>ctrl</kbd> + <kbd>y</kbd>|
97-
|Undo last action|<kbd>ctrl</kbd> + <kbd>_</kbd>|
98-
|Jump to the previous line|<kbd>up</kbd> / <kbd>ctrl</kbd> + <kbd>p</kbd>|
99-
|Jump to the next line|<kbd>down</kbd> / <kbd>ctrl</kbd> + <kbd>n</kbd>|
100-
|Clear compose box|<kbd>ctrl</kbd> + <kbd>l</kbd>|
80+
|Cycle through recipient and content boxes|<kbd>Tab</kbd>|
81+
|Send a message|<kbd>Ctrl</kbd> + <kbd>d</kbd> / <kbd>Meta</kbd> + <kbd>Enter</kbd>|
82+
|Save current message as a draft|<kbd>Meta</kbd> + <kbd>s</kbd>|
83+
|Autocomplete @mentions, #stream_names, :emoji: and topics|<kbd>Ctrl</kbd> + <kbd>f</kbd>|
84+
|Cycle through autocomplete suggestions in reverse|<kbd>Ctrl</kbd> + <kbd>r</kbd>|
85+
|Narrow to compose box message recipient|<kbd>Meta</kbd> + <kbd>.</kbd>|
86+
|Jump to the beginning of line|<kbd>Ctrl</kbd> + <kbd>a</kbd>|
87+
|Jump to the end of line|<kbd>Ctrl</kbd> + <kbd>e</kbd>|
88+
|Jump backward one word|<kbd>Meta</kbd> + <kbd>b</kbd>|
89+
|Jump forward one word|<kbd>Meta</kbd> + <kbd>f</kbd>|
90+
|Delete previous character (to left)|<kbd>Ctrl</kbd> + <kbd>h</kbd>|
91+
|Transpose characters|<kbd>Ctrl</kbd> + <kbd>t</kbd>|
92+
|Cut forwards to the end of the line|<kbd>Ctrl</kbd> + <kbd>k</kbd>|
93+
|Cut backwards to the start of the line|<kbd>Ctrl</kbd> + <kbd>u</kbd>|
94+
|Cut forwards to the end of the current word|<kbd>Meta</kbd> + <kbd>d</kbd>|
95+
|Cut backwards to the start of the current word|<kbd>Ctrl</kbd> + <kbd>w</kbd>|
96+
|Paste last cut section|<kbd>Ctrl</kbd> + <kbd>y</kbd>|
97+
|Undo last action|<kbd>Ctrl</kbd> + <kbd>_</kbd>|
98+
|Jump to the previous line|<kbd>Up</kbd> / <kbd>Ctrl</kbd> + <kbd>p</kbd>|
99+
|Jump to the next line|<kbd>Down</kbd> / <kbd>Ctrl</kbd> + <kbd>n</kbd>|
100+
|Clear compose box|<kbd>Ctrl</kbd> + <kbd>l</kbd>|
101101

tools/lint-hotkeys

+9-3
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,11 @@ from collections import defaultdict
66
from pathlib import Path, PurePath
77
from typing import Dict, List, Tuple
88

9-
from zulipterminal.config.keys import HELP_CATEGORIES, KEY_BINDINGS
9+
from zulipterminal.config.keys import (
10+
HELP_CATEGORIES,
11+
KEY_BINDINGS,
12+
display_keys_for_command,
13+
)
1014

1115

1216
KEYS_FILE = (
@@ -129,8 +133,10 @@ def read_help_categories() -> Dict[str, List[Tuple[str, List[str]]]]:
129133
Get all help categories from KEYS_FILE
130134
"""
131135
categories = defaultdict(list)
132-
for item in KEY_BINDINGS.values():
133-
categories[item["key_category"]].append((item["help_text"], item["keys"]))
136+
for cmd, item in KEY_BINDINGS.items():
137+
categories[item["key_category"]].append(
138+
(item["help_text"], display_keys_for_command(cmd))
139+
)
134140
return categories
135141

136142

0 commit comments

Comments
 (0)