From 9f9259683c9ef664076d3ca425a929d3fe60dff3 Mon Sep 17 00:00:00 2001 From: aryanshridhar Date: Mon, 10 May 2021 21:22:46 +0530 Subject: [PATCH] settings_panel: Bind vim keys to SettingsPanelMenu. Added a commit to bind vim keys with the SettingsPanelMenu, allowing users to control the settings and organization tabs using 'h','j','k' and 'l' keys. vim_left('h') -> Switch between tab by shifting focus to the left. vim_right('l') -> Switch between tab by shifting focus to the right. vim_up('k') -> Move up. vim_down('j') -> Move down. --- static/js/keydown_util.js | 4 ++++ static/js/settings_panel_menu.js | 6 ++++++ 2 files changed, 10 insertions(+) diff --git a/static/js/keydown_util.js b/static/js/keydown_util.js index ace21ffabc..11237fa0a7 100644 --- a/static/js/keydown_util.js +++ b/static/js/keydown_util.js @@ -8,6 +8,10 @@ const keys = { 38: "up_arrow", 39: "right_arrow", 40: "down_arrow", + 72: "vim_left", + 74: "vim_down", + 75: "vim_up", + 76: "vim_right", }; export function handle(opts) { diff --git a/static/js/settings_panel_menu.js b/static/js/settings_panel_menu.js index d21f2385ac..ec3b9bad96 100644 --- a/static/js/settings_panel_menu.js +++ b/static/js/settings_panel_menu.js @@ -70,6 +70,12 @@ export class SettingsPanelMenu { enter_key: () => this.enter_panel(), up_arrow: () => this.prev(), down_arrow: () => this.next(), + + // Binding vim keys as well + vim_left: toggler.maybe_go_left, + vim_right: toggler.maybe_go_right, + vim_up: () => this.prev(), + vim_down: () => this.next(), }, }); }