Date
1 - 1 of 1
Adding vim key binding to htop.
Abanoub Sameh
From 4ca529f835febc3b6f656873cc9537a52bd001c9 Mon Sep 17 00:00:00 2001
From: Abanoub Sameh <abanoubsameh@...>
Date: Sun, 30 May 2021 13:27:00 +0200
Subject: [PATCH] Add vim key bindings to htop
I have been using htop for sometime, and I didn't like the default key
bindings. Hence this patch, which I made for myself, but I sent in the
hope that you may like the idea, and maybe rather than implementing the
basics only, we can add more vim keys, maybe add a visual mode, maybe a
stack to evaluate basic vim commands.
I don't know if you would like the idea, or if some version of htop
already supports this, or how hard it would be to implement my other ideas.
Signed-off-by: Abanoub Sameh <abanoubsameh@...>
---
Action.c | 5 ++---
Panel.c | 4 ++--
2 files changed, 4 insertions(+), 5 deletions(-)
diff --git a/Action.c b/Action.c
index d6fd737..1810871 100644
--- a/Action.c
+++ b/Action.c
@@ -681,9 +681,8 @@ void Action_setBindings(Htop_Action* keys) {
keys['a'] = actionSetAffinity;
keys['c'] = actionTagAllChildren;
keys['e'] = actionShowEnvScreen;
- keys['h'] = actionHelp;
- keys['k'] = actionKill;
- keys['l'] = actionLsof;
+ keys['d'] = actionKill;
+ keys['n'] = actionLsof;
keys['m'] = actionToggleMergedCommand;
keys['p'] = actionToggleProgramPath;
keys['q'] = actionQuit;
diff --git a/Panel.c b/Panel.c
index 69933ae..832dfb4 100644
--- a/Panel.c
+++ b/Panel.c
@@ -350,7 +350,7 @@ bool Panel_onKey(Panel* this, int key) {
} while (0)
switch (key) {
- case KEY_DOWN:
+ case 'j':
case KEY_CTRL('N'):
#ifdef KEY_C_DOWN
case KEY_C_DOWN:
@@ -358,7 +358,7 @@ bool Panel_onKey(Panel* this, int key) {
this->selected++;
break;
- case KEY_UP:
+ case 'k':
case KEY_CTRL('P'):
#ifdef KEY_C_UP
case KEY_C_UP:
--
2.31.1
From: Abanoub Sameh <abanoubsameh@...>
Date: Sun, 30 May 2021 13:27:00 +0200
Subject: [PATCH] Add vim key bindings to htop
I have been using htop for sometime, and I didn't like the default key
bindings. Hence this patch, which I made for myself, but I sent in the
hope that you may like the idea, and maybe rather than implementing the
basics only, we can add more vim keys, maybe add a visual mode, maybe a
stack to evaluate basic vim commands.
I don't know if you would like the idea, or if some version of htop
already supports this, or how hard it would be to implement my other ideas.
Signed-off-by: Abanoub Sameh <abanoubsameh@...>
---
Action.c | 5 ++---
Panel.c | 4 ++--
2 files changed, 4 insertions(+), 5 deletions(-)
diff --git a/Action.c b/Action.c
index d6fd737..1810871 100644
--- a/Action.c
+++ b/Action.c
@@ -681,9 +681,8 @@ void Action_setBindings(Htop_Action* keys) {
keys['a'] = actionSetAffinity;
keys['c'] = actionTagAllChildren;
keys['e'] = actionShowEnvScreen;
- keys['h'] = actionHelp;
- keys['k'] = actionKill;
- keys['l'] = actionLsof;
+ keys['d'] = actionKill;
+ keys['n'] = actionLsof;
keys['m'] = actionToggleMergedCommand;
keys['p'] = actionToggleProgramPath;
keys['q'] = actionQuit;
diff --git a/Panel.c b/Panel.c
index 69933ae..832dfb4 100644
--- a/Panel.c
+++ b/Panel.c
@@ -350,7 +350,7 @@ bool Panel_onKey(Panel* this, int key) {
} while (0)
switch (key) {
- case KEY_DOWN:
+ case 'j':
case KEY_CTRL('N'):
#ifdef KEY_C_DOWN
case KEY_C_DOWN:
@@ -358,7 +358,7 @@ bool Panel_onKey(Panel* this, int key) {
this->selected++;
break;
- case KEY_UP:
+ case 'k':
case KEY_CTRL('P'):
#ifdef KEY_C_UP
case KEY_C_UP:
--
2.31.1