Action to Wait for Next Input and Use Input to Execute Second Action #19752

Open
opened 2026-01-31 06:52:39 +00:00 by claunia · 0 comments
Owner

Originally created by @ljtpetersen on GitHub (Apr 22, 2023).

Description of the new feature/enhancement

This is inspired by the Vim method of switching panes, which is to do ^W followed by an arrow key pointing
in the direction of the pane to switch to. The idea would be to have some keybind which, when activated,
listens for the next keystroke. Whichever keystroke it receives is then compared in a user specified map
to check which action to execute. If there is no corresponding entry for the entered key, both the activation command and the following keystroke are forwarded to the tty. There may also be a timeout.

This feature would allow a user to have many more possible keybind combinations by executing these sequences.

Proposed technical implementation details (optional)

I'll try to describe the method again here, in a clearer manner. When the user enters the specific key combination, the terminal waits for the next input, perhaps timing out after a few seconds. Once the next input is received, the terminal compares it to a user specified mapping of keystrokes to actions. If the keystroke is in the mapping, the corresponding action is executed. If the keystroke is not in the mapping, the preceding key combination is passed first, then the following key stroke.

For example, imagine a key combination ^W with an mapping rightarrow to move to the pane to the right.
If the user enters ^W followed by rightarrow, the terminal will switch to the pane to the right, and the tty will receive no input. If the user enters ^W followed by l, which is not a key in the mapping, the tty will receive the input ^W followed by l. It may also be possible to configure a default action for when the user enters a key not within the mapping.

Originally created by @ljtpetersen on GitHub (Apr 22, 2023). <!-- 🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨 I ACKNOWLEDGE THE FOLLOWING BEFORE PROCEEDING: 1. If I delete this entire template and go my own path, the core team may close my issue without further explanation or engagement. 2. If I list multiple bugs/concerns in this one issue, the core team may close my issue without further explanation or engagement. 3. If I write an issue that has many duplicates, the core team may close my issue without further explanation or engagement (and without necessarily spending time to find the exact duplicate ID number). 4. If I leave the title incomplete when filing the issue, the core team may close my issue without further explanation or engagement. 5. If I file something completely blank in the body, the core team may close my issue without further explanation or engagement. All good? Then proceed! --> # Description of the new feature/enhancement This is inspired by the Vim method of switching panes, which is to do `^W` followed by an arrow key pointing in the direction of the pane to switch to. The idea would be to have some keybind which, when activated, listens for the next keystroke. Whichever keystroke it receives is then compared in a user specified map to check which action to execute. If there is no corresponding entry for the entered key, both the activation command and the following keystroke are forwarded to the tty. There may also be a timeout. <!-- A clear and concise description of what the problem is that the new feature would solve. Describe why and how a user would use this new functionality (if applicable). --> This feature would allow a user to have many more possible keybind combinations by executing these sequences. # Proposed technical implementation details (optional) <!-- A clear and concise description of what you want to happen. --> I'll try to describe the method again here, in a clearer manner. When the user enters the specific key combination, the terminal waits for the next input, perhaps timing out after a few seconds. Once the next input is received, the terminal compares it to a user specified mapping of keystrokes to actions. If the keystroke is in the mapping, the corresponding action is executed. If the keystroke is not in the mapping, the preceding key combination is passed first, then the following key stroke. For example, imagine a key combination `^W` with an mapping rightarrow to move to the pane to the right. If the user enters ^W followed by rightarrow, the terminal will switch to the pane to the right, and the tty will receive no input. If the user enters ^W followed by `l`, which is not a key in the mapping, the tty will receive the input `^W` followed by `l`. It may also be possible to configure a default action for when the user enters a key not within the mapping.
claunia added the Issue-FeatureNeeds-TriageNeeds-Tag-FixNeeds-Attention labels 2026-01-31 06:52:40 +00:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/terminal#19752