Created
April 25, 2014 15:07
-
-
Save ooesili/11292865 to your computer and use it in GitHub Desktop.
vi keybindings for htop-1.0.3; adapted from a patch written by Evan LeCompte - https://github.com/Evanlec
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/Panel.c b/Panel.c | |
index 26b1190..05f7bc7 100644 | |
--- a/Panel.c | |
+++ b/Panel.c | |
@@ -343,11 +343,13 @@ bool Panel_onKey(Panel* this, int key) { | |
assert (this != NULL); | |
switch (key) { | |
case KEY_DOWN: | |
+ case 'j': | |
case KEY_CTRLN: | |
if (this->selected + 1 < Vector_size(this->items)) | |
this->selected++; | |
return true; | |
case KEY_UP: | |
+ case 'k': | |
case KEY_CTRLP: | |
if (this->selected > 0) | |
this->selected--; | |
@@ -375,6 +377,7 @@ bool Panel_onKey(Panel* this, int key) { | |
return true; | |
#endif | |
case KEY_LEFT: | |
+ case 'h': | |
case KEY_CTRLB: | |
if (this->scrollH > 0) { | |
this->scrollH -= CRT_scrollHAmount; | |
@@ -382,6 +385,7 @@ bool Panel_onKey(Panel* this, int key) { | |
} | |
return true; | |
case KEY_RIGHT: | |
+ case 'l': | |
case KEY_CTRLF: | |
this->scrollH += CRT_scrollHAmount; | |
this->needsRedraw = true; | |
diff --git a/htop.c b/htop.c | |
index b343809..54bf631 100644 | |
--- a/htop.c | |
+++ b/htop.c | |
@@ -70,7 +70,7 @@ static void printHelpFlag() { | |
} | |
static struct { const char* key; const char* info; } helpLeft[] = { | |
- { .key = " Arrows: ", .info = "scroll process list" }, | |
+ { .key = " hjlk: ", .info = "scroll process list" }, | |
{ .key = " Digits: ", .info = "incremental PID search" }, | |
{ .key = " F3 /: ", .info = "incremental name search" }, | |
{ .key = " F4 \\: ",.info = "incremental name filtering" }, | |
@@ -90,18 +90,18 @@ static struct { const char* key; const char* info; } helpRight[] = { | |
{ .key = " Space: ", .info = "tag process" }, | |
{ .key = " c: ", .info = "tag process and its children" }, | |
{ .key = " U: ", .info = "untag all processes" }, | |
- { .key = " F9 k: ", .info = "kill process/tagged processes" }, | |
+ { .key = " F9 d: ", .info = "kill process/tagged processes" }, | |
{ .key = " F7 ]: ", .info = "higher priority (root only)" }, | |
{ .key = " F8 [: ", .info = "lower priority (+ nice)" }, | |
#if (HAVE_LIBHWLOC || HAVE_NATIVE_AFFINITY) | |
{ .key = " a: ", .info = "set CPU affinity" }, | |
#endif | |
{ .key = " i: ", .info = "set IO prority" }, | |
- { .key = " l: ", .info = "list open files with lsof" }, | |
+ { .key = " L: ", .info = "list open files with lsof" }, | |
{ .key = " s: ", .info = "trace syscalls with strace" }, | |
{ .key = " ", .info = "" }, | |
{ .key = " F2 S: ", .info = "setup" }, | |
- { .key = " F1 h: ", .info = "show this help screen" }, | |
+ { .key = " F1 ?: ", .info = "show this help screen" }, | |
{ .key = " F10 q: ", .info = "quit" }, | |
{ .key = NULL, .info = NULL } | |
}; | |
@@ -684,7 +684,6 @@ int main(int argc, char** argv) { | |
break; | |
} | |
case KEY_F(1): | |
- case 'h': | |
case '?': | |
{ | |
showHelp(pl); | |
@@ -720,7 +719,7 @@ int main(int argc, char** argv) { | |
CRT_enableDelay(); | |
break; | |
} | |
- case 'l': | |
+ case 'L': | |
{ | |
Process* p = (Process*) Panel_getSelected(panel); | |
if (!p) break; | |
@@ -783,7 +782,7 @@ int main(int argc, char** argv) { | |
break; | |
} | |
case KEY_F(9): | |
- case 'k': | |
+ case 'd': | |
{ | |
Panel* signalsPanel = (Panel*) SignalsPanel_new(); | |
const char* fuFunctions[] = {"Send ", "Cancel ", NULL}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment