diff --git a/docs/hotkeys.md b/docs/hotkeys.md index c05e0886e3..2cccfb4888 100644 --- a/docs/hotkeys.md +++ b/docs/hotkeys.md @@ -83,19 +83,28 @@ |Autocomplete @mentions, #stream_names, :emoji: and topics|Ctrl + f| |Cycle through autocomplete suggestions in reverse|Ctrl + r| |Narrow to compose box message recipient|Meta + .| -|Jump to the beginning of line|Ctrl + a| -|Jump to the end of line|Ctrl + e| -|Jump backward one word|Meta + b| -|Jump forward one word|Meta + f| -|Delete previous character (to left)|Ctrl + h| -|Transpose characters|Ctrl + t| + +## Editor: Navigation +|Command|Key Combination| +| :--- | :---: | +|Start of line|Ctrl + a / Home| +|End of line|Ctrl + e / End| +|Start of current or previous word|Meta + b / Shift + Left| +|Start of next word|Meta + f / Shift + Right| +|Previous line|Up / Ctrl + p| +|Next line|Down / Ctrl + n| + +## Editor: Text Manipulation +|Command|Key Combination| +| :--- | :---: | +|Undo last action|Ctrl + _| +|Clear text box|Ctrl + l| |Cut forwards to the end of the line|Ctrl + k| |Cut backwards to the start of the line|Ctrl + u| |Cut forwards to the end of the current word|Meta + d| -|Cut backwards to the start of the current word|Ctrl + w| +|Cut backwards to the start of the current word|Ctrl + w / Meta + Backspace| +|Cut the current line|Meta + x| |Paste last cut section|Ctrl + y| -|Undo last action|Ctrl + _| -|Jump to the previous line|Up / Ctrl + p| -|Jump to the next line|Down / Ctrl + n| -|Clear compose box|Ctrl + l| +|Delete previous character|Ctrl + h| +|Swap with previous character|Ctrl + t| diff --git a/zulipterminal/config/keys.py b/zulipterminal/config/keys.py index 9e2ace94f9..9c000ce122 100644 --- a/zulipterminal/config/keys.py +++ b/zulipterminal/config/keys.py @@ -321,79 +321,84 @@ class KeyBinding(TypedDict): 'key_category': 'general', }, 'BEGINNING_OF_LINE': { - 'keys': ['ctrl a'], - 'help_text': 'Jump to the beginning of line', - 'key_category': 'msg_compose', + 'keys': ['ctrl a', 'home'], + 'help_text': 'Start of line', + 'key_category': 'editor_navigation', }, 'END_OF_LINE': { - 'keys': ['ctrl e'], - 'help_text': 'Jump to the end of line', - 'key_category': 'msg_compose', + 'keys': ['ctrl e', 'end'], + 'help_text': 'End of line', + 'key_category': 'editor_navigation', }, 'ONE_WORD_BACKWARD': { - 'keys': ['meta b'], - 'help_text': 'Jump backward one word', - 'key_category': 'msg_compose', + 'keys': ['meta b', 'shift left'], + 'help_text': 'Start of current or previous word', + 'key_category': 'editor_navigation', }, 'ONE_WORD_FORWARD': { - 'keys': ['meta f'], - 'help_text': 'Jump forward one word', - 'key_category': 'msg_compose', + 'keys': ['meta f', 'shift right'], + 'help_text': 'Start of next word', + 'key_category': 'editor_navigation', }, - 'DELETE_LAST_CHARACTER': { - 'keys': ['ctrl h'], - 'help_text': 'Delete previous character (to left)', - 'key_category': 'msg_compose', + 'PREV_LINE': { + 'keys': ['up', 'ctrl p'], + 'help_text': 'Previous line', + 'key_category': 'editor_navigation', }, - 'TRANSPOSE_CHARACTERS': { - 'keys': ['ctrl t'], - 'help_text': 'Transpose characters', - 'key_category': 'msg_compose', + 'NEXT_LINE': { + 'keys': ['down', 'ctrl n'], + 'help_text': 'Next line', + 'key_category': 'editor_navigation', + }, + 'UNDO_LAST_ACTION': { + 'keys': ['ctrl _'], + 'help_text': 'Undo last action', + 'key_category': 'editor_text_manipulation', + }, + 'CLEAR_MESSAGE': { + 'keys': ['ctrl l'], + 'help_text': 'Clear text box', + 'key_category': 'editor_text_manipulation', }, 'CUT_TO_END_OF_LINE': { 'keys': ['ctrl k'], 'help_text': 'Cut forwards to the end of the line', - 'key_category': 'msg_compose', + 'key_category': 'editor_text_manipulation', }, 'CUT_TO_START_OF_LINE': { 'keys': ['ctrl u'], 'help_text': 'Cut backwards to the start of the line', - 'key_category': 'msg_compose', + 'key_category': 'editor_text_manipulation', }, 'CUT_TO_END_OF_WORD': { 'keys': ['meta d'], 'help_text': 'Cut forwards to the end of the current word', - 'key_category': 'msg_compose', + 'key_category': 'editor_text_manipulation', }, 'CUT_TO_START_OF_WORD': { - 'keys': ['ctrl w'], + 'keys': ['ctrl w', 'meta backspace'], 'help_text': 'Cut backwards to the start of the current word', - 'key_category': 'msg_compose', + 'key_category': 'editor_text_manipulation', + }, + 'CUT_WHOLE_LINE': { + 'keys': ['meta x'], + 'help_text': 'Cut the current line', + 'key_category': 'editor_text_manipulation', }, 'PASTE_LAST_CUT': { 'keys': ['ctrl y'], 'help_text': 'Paste last cut section', - 'key_category': 'msg_compose', - }, - 'UNDO_LAST_ACTION': { - 'keys': ['ctrl _'], - 'help_text': 'Undo last action', - 'key_category': 'msg_compose', + 'key_category': 'editor_text_manipulation', }, - 'PREV_LINE': { - 'keys': ['up', 'ctrl p'], - 'help_text': 'Jump to the previous line', - 'key_category': 'msg_compose', - }, - 'NEXT_LINE': { - 'keys': ['down', 'ctrl n'], - 'help_text': 'Jump to the next line', - 'key_category': 'msg_compose', + 'DELETE_LAST_CHARACTER': { + 'keys': ['ctrl h'], + 'help_text': 'Delete previous character', + 'key_category': 'editor_text_manipulation', }, - 'CLEAR_MESSAGE': { - 'keys': ['ctrl l'], - 'help_text': 'Clear compose box', - 'key_category': 'msg_compose', + 'TRANSPOSE_CHARACTERS': { + 'keys': ['ctrl t'], + 'help_text': 'Swap with previous character', + 'key_category': 'editor_text_manipulation', }, 'FULL_RENDERED_MESSAGE': { 'keys': ['f'], @@ -415,6 +420,8 @@ class KeyBinding(TypedDict): "msg_actions": "Message actions", "stream_list": "Stream list actions", "msg_compose": "Composing a Message", + "editor_navigation": "Editor: Navigation", + "editor_text_manipulation": "Editor: Text Manipulation", } ZT_TO_URWID_CMD_MAPPING = {