[GH-ISSUE #851] wiki: Using Different Keys --> Adding Key Aliases #621

Closed
opened 2026-03-04 01:06:30 +03:00 by kerem · 1 comment
Owner

Originally created by @abitrolly on GitHub (May 22, 2023).
Original GitHub issue: https://github.com/rivo/tview/issues/851

In Using Different Keys I would change the title to clarify that the chapter speaks about reusing key handler for a different key.

### Key Aliases

You can add another shortcut to function that is already mapped to specific key. For example,
if you want to `w` to behave like `j` - navigate upwards.

    textView.SetInputCapture(func(event *tcell.EventKey) *tcell.EventKey {
    	if event.Rune() == 'w' {
    		return tcell.NewEventKey(tcell.KeyRune, 'j', tcell.ModNone)
    	}
    	return event
    })
Originally created by @abitrolly on GitHub (May 22, 2023). Original GitHub issue: https://github.com/rivo/tview/issues/851 In [Using Different Keys](https://github.com/rivo/tview/wiki/CustomKeys) I would change the title to clarify that the chapter speaks about reusing key handler for a different key. ``` ### Key Aliases You can add another shortcut to function that is already mapped to specific key. For example, if you want to `w` to behave like `j` - navigate upwards. textView.SetInputCapture(func(event *tcell.EventKey) *tcell.EventKey { if event.Rune() == 'w' { return tcell.NewEventKey(tcell.KeyRune, 'j', tcell.ModNone) } return event }) ```
kerem closed this issue 2026-03-04 01:06:31 +03:00
Author
Owner

@rivo commented on GitHub (Jun 18, 2023):

Thanks. I've added some clarifications to the wiki (as well as some new information which was still missing).

<!-- gh-comment-id:1596108017 --> @rivo commented on GitHub (Jun 18, 2023): Thanks. I've added some clarifications to the wiki (as well as some new information which was still missing).
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/tview#621
No description provided.