summarylogtreecommitdiffstats
path: root/vim-keybindings.patch
diff options
context:
space:
mode:
Diffstat (limited to 'vim-keybindings.patch')
-rw-r--r--vim-keybindings.patch241
1 files changed, 141 insertions, 100 deletions
diff --git a/vim-keybindings.patch b/vim-keybindings.patch
index e886c3511a84..3b2201526acf 100644
--- a/vim-keybindings.patch
+++ b/vim-keybindings.patch
@@ -1,42 +1,42 @@
diff --git a/Action.c b/Action.c
-index 88ccf6d..76008e3 100644
+index 1d373ef..b89d94a 100644
--- a/Action.c
+++ b/Action.c
-@@ -433,7 +433,7 @@ static const struct {
- const char* key;
+@@ -459,7 +459,7 @@ static const struct {
+ bool roInactive;
const char* info;
} helpLeft[] = {
-- { .key = " Arrows: ", .info = "scroll process list" },
-+ { .key = " hjkl: ", .info = "scroll process list" },
- { .key = " Digits: ", .info = "incremental PID search" },
- { .key = " F3 /: ", .info = "incremental name search" },
- { .key = " F4 \\: ",.info = "incremental name filtering" },
-@@ -459,7 +459,7 @@ static const struct {
- { .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 x: ", .info = "kill process/tagged processes" },
- { .key = " F7 ]: ", .info = "higher priority (root only)" },
- { .key = " F8 [: ", .info = "lower priority (+ nice)" },
- #if (defined(HAVE_LIBHWLOC) || defined(HAVE_LINUX_AFFINITY))
-@@ -467,12 +467,12 @@ static const struct {
+- { .key = " Arrows: ", .roInactive = false, .info = "scroll process list" },
++ { .key = " hjkl: ", .roInactive = false, .info = "scroll process list" },
+ { .key = " Digits: ", .roInactive = false, .info = "incremental PID search" },
+ { .key = " F3 /: ", .roInactive = false, .info = "incremental name search" },
+ { .key = " F4 \\: ", .roInactive = false, .info = "incremental name filtering" },
+@@ -486,7 +486,7 @@ static const struct {
+ { .key = " Space: ", .roInactive = false, .info = "tag process" },
+ { .key = " c: ", .roInactive = false, .info = "tag process and its children" },
+ { .key = " U: ", .roInactive = false, .info = "untag all processes" },
+- { .key = " F9 k: ", .roInactive = true, .info = "kill process/tagged processes" },
++ { .key = " F9 x: ", .roInactive = true, .info = "kill process/tagged processes" },
+ { .key = " F7 ]: ", .roInactive = true, .info = "higher priority (root only)" },
+ { .key = " F8 [: ", .roInactive = false, .info = "lower priority (+ nice)" },
+ #if (defined(HAVE_LIBHWLOC) || defined(HAVE_AFFINITY))
+@@ -494,12 +494,12 @@ static const struct {
#endif
- { .key = " e: ", .info = "show process environment" },
- { .key = " i: ", .info = "set IO priority" },
-- { .key = " l: ", .info = "list open files with lsof" },
-- { .key = " x: ", .info = "list file locks of process" },
-+ { .key = " L: ", .info = "list open files with lsof" },
-+ { .key = " X: ", .info = "list file locks of process" },
- { .key = " s: ", .info = "trace syscalls with strace" },
- { .key = " w: ", .info = "wrap process command in multiple lines" },
- { .key = " F2 C S: ", .info = "setup" },
-- { .key = " F1 h: ", .info = "show this help screen" },
-+ { .key = " F1 ?: ", .info = "show this help screen" },
- { .key = " F10 q: ", .info = "quit" },
+ { .key = " e: ", .roInactive = false, .info = "show process environment" },
+ { .key = " i: ", .roInactive = true, .info = "set IO priority" },
+- { .key = " l: ", .roInactive = true, .info = "list open files with lsof" },
+- { .key = " x: ", .roInactive = false, .info = "list file locks of process" },
++ { .key = " L: ", .roInactive = true, .info = "list open files with lsof" },
++ { .key = " X: ", .roInactive = false, .info = "list file locks of process" },
+ { .key = " s: ", .roInactive = true, .info = "trace syscalls with strace" },
+ { .key = " w: ", .roInactive = false, .info = "wrap process command in multiple lines" },
+ { .key = " F2 C S: ", .roInactive = false, .info = "setup" },
+- { .key = " F1 h ?: ", .roInactive = false, .info = "show this help screen" },
++ { .key = " F1 ?: ", .roInactive = false, .info = "show this help screen" },
+ { .key = " F10 q: ", .roInactive = false, .info = "quit" },
{ .key = NULL, .info = NULL }
};
-@@ -638,12 +638,14 @@ void Action_setBindings(Htop_Action* keys) {
+@@ -673,12 +673,14 @@ void Action_setBindings(Htop_Action* keys) {
keys['H'] = actionToggleUserlandThreads;
keys['I'] = actionInvertSortOrder;
keys['K'] = actionToggleKernelThreads;
@@ -51,7 +51,7 @@ index 88ccf6d..76008e3 100644
keys['Z'] = actionTogglePauseProcessUpdate;
keys['['] = actionLowerPriority;
keys['\014'] = actionRedraw; // Ctrl+L
-@@ -653,17 +655,15 @@ void Action_setBindings(Htop_Action* keys) {
+@@ -688,17 +690,15 @@ void Action_setBindings(Htop_Action* keys) {
keys['a'] = actionSetAffinity;
keys['c'] = actionTagAllChildren;
keys['e'] = actionShowEnvScreen;
@@ -72,27 +72,27 @@ index 88ccf6d..76008e3 100644
keys[KEY_F(2)] = actionSetup;
keys[KEY_F(3)] = actionIncSearch;
diff --git a/CategoriesPanel.c b/CategoriesPanel.c
-index 4ee1ad4..51968c2 100644
+index 21010b3..459e87e 100644
--- a/CategoriesPanel.c
+++ b/CategoriesPanel.c
-@@ -67,6 +67,12 @@ static HandlerResult CategoriesPanel_eventHandler(Panel* super, int ch) {
+@@ -101,6 +101,12 @@ static HandlerResult CategoriesPanel_eventHandler(Panel* super, int ch) {
HandlerResult result = IGNORED;
int selected = Panel_getSelectedIndex(super);
+ switch (ch) {
-+ case 'k': ch = KEY_UP; break;
-+ case 'j': ch = KEY_DOWN; break;
+ case 'h': ch = KEY_LEFT; break;
++ case 'j': ch = KEY_DOWN; break;
++ case 'k': ch = KEY_UP; break;
+ case 'l': ch = KEY_RIGHT; break;
+ }
switch (ch) {
case EVENT_SET_SELECTED:
result = HANDLED;
diff --git a/MainPanel.c b/MainPanel.c
-index 859c513..8dfd13a 100644
+index e7033bf..ca5ba6c 100644
--- a/MainPanel.c
+++ b/MainPanel.c
-@@ -49,7 +49,7 @@ static const char* MainPanel_getValue(Panel* this, int i) {
+@@ -50,7 +50,7 @@ static const char* MainPanel_getValue(Panel* this, int i) {
return Process_getCommand(p);
}
@@ -102,10 +102,10 @@ index 859c513..8dfd13a 100644
HandlerResult result = IGNORED;
diff --git a/MainPanel.h b/MainPanel.h
-index 2427ca3..6354744 100644
+index 04f347d..6c8fd32 100644
--- a/MainPanel.h
+++ b/MainPanel.h
-@@ -48,4 +48,6 @@ void MainPanel_setState(MainPanel* this, State* state);
+@@ -46,4 +46,6 @@ void MainPanel_setState(MainPanel* this, State* state);
void MainPanel_delete(Object* object);
@@ -113,7 +113,7 @@ index 2427ca3..6354744 100644
+
#endif
diff --git a/Panel.c b/Panel.c
-index 5d10375..76242b3 100644
+index dea6401..a0ceccb 100644
--- a/Panel.c
+++ b/Panel.c
@@ -351,6 +351,7 @@ bool Panel_onKey(Panel* this, int key) {
@@ -141,7 +141,7 @@ index 5d10375..76242b3 100644
if (this->scrollH > 0) {
this->scrollH -= MAXIMUM(CRT_scrollHAmount, 0);
this->needsRedraw = true;
-@@ -375,16 +377,27 @@ bool Panel_onKey(Panel* this, int key) {
+@@ -375,16 +377,28 @@ bool Panel_onKey(Panel* this, int key) {
break;
case KEY_RIGHT:
@@ -155,6 +155,7 @@ index 5d10375..76242b3 100644
+ this->selected -= (this->h - 1) / 2;
+ this->needsRedraw = true;
+ break;
++
+ case KEY_CTRL('D'):
+ this->selected += (this->h - 1) / 2;
+ this->needsRedraw = true;
@@ -170,7 +171,7 @@ index 5d10375..76242b3 100644
PANEL_SCROLL(+(this->h - Panel_headerHeight(this)));
break;
-@@ -397,10 +410,12 @@ bool Panel_onKey(Panel* this, int key) {
+@@ -397,10 +411,12 @@ bool Panel_onKey(Panel* this, int key) {
break;
case KEY_HOME:
@@ -183,70 +184,19 @@ index 5d10375..76242b3 100644
this->selected = size - 1;
break;
-diff --git a/README b/README
-index 880597d..ffea919 100644
---- a/README
-+++ b/README
-@@ -19,6 +19,46 @@ The information displayed is configurable through a graphical setup and can be s
-
- Tasks related to processes (e.g. killing and renicing) can be done without entering their PIDs.
-
-+## Vim keybindings
-+
-+These are the keybindings added in this fork of htop:
-+
-+```
-+ g to the top (gg in vim)
-+
-+ <C-b> up 1 page
-+
-+ <C-u> up 1/2 page
-+
-+ k
-+
-+h l one character
-+
-+ j
-+
-+ <C-d> down 1/2 page
-+
-+ <C-f> down 1 page
-+
-+ G to the end
-+
-+--------------------------------------------------
-+
-+ o Expand/collapse (like in NERDTree)
-+```
-+
-+In order to accomodate these keybindings, the following changes
-+were made to the original keybindings:
-+
-+- `Ctrl+F` and `Ctrt+B` can no longer be used to navigate horizontally
-+- `h` can no longer be used to access the help, leaving `Ctrl+F1` & `?`
-+- `k` can no longer be used to kill processes, being replaced with `x`
-+- `l` can no longer be used to list open files, being replaced with `L`
-+- `x` can no longer be used to list file locks, being replaced with `X`
-+
-+
-+## Comparison between `htop` and classic `top`
-+
- Running `htop` requires `ncurses` libraries (typically named libncursesw*).
-
- For more information and details on how to contribute to `htop` visit [htop.dev](https://htop.dev).
diff --git a/ScreenManager.c b/ScreenManager.c
-index 0ab5231..06d0a79 100644
+index 914c510..67e6130 100644
--- a/ScreenManager.c
+++ b/ScreenManager.c
-@@ -14,6 +14,7 @@ in the source distribution for its full text.
+@@ -16,6 +16,7 @@ in the source distribution for its full text.
#include "CRT.h"
#include "FunctionBar.h"
+#include "MainPanel.h"
#include "Object.h"
+ #include "Platform.h"
#include "ProcessList.h"
- #include "ProvideCurses.h"
-@@ -214,14 +215,16 @@ void ScreenManager_run(ScreenManager* this, Panel** lastFocus, int* lastKey) {
+@@ -224,14 +225,16 @@ void ScreenManager_run(ScreenManager* this, Panel** lastFocus, int* lastKey) {
redraw = false;
continue;
}
@@ -269,7 +219,7 @@ index 0ab5231..06d0a79 100644
result = Panel_eventHandler(panelFocus, ch);
}
if (result & SYNTH_KEY) {
-@@ -251,7 +254,7 @@ void ScreenManager_run(ScreenManager* this, Panel** lastFocus, int* lastKey) {
+@@ -265,7 +268,7 @@ void ScreenManager_run(ScreenManager* this, Panel** lastFocus, int* lastKey) {
continue;
}
case KEY_LEFT:
@@ -278,7 +228,7 @@ index 0ab5231..06d0a79 100644
if (this->panelCount < 2) {
goto defaultHandler;
}
-@@ -272,7 +275,7 @@ tryLeft:
+@@ -286,7 +289,7 @@ tryLeft:
break;
case KEY_RIGHT:
@@ -287,3 +237,94 @@ index 0ab5231..06d0a79 100644
case 9:
if (this->panelCount < 2) {
goto defaultHandler;
+diff --git a/htop.1.in b/htop.1.in
+index ceec216..1d1a0d9 100644
+--- a/htop.1.in
++++ b/htop.1.in
+@@ -95,27 +95,30 @@ held.
+ The following commands are supported while in
+ .BR htop :
+ .TP 5
+-.B Up, Alt-k
++.B Up, k
+ Select (highlight) the previous process in the process list. Scroll the list
+ if necessary.
+ .TP
+-.B Down, Alt-j
++.B Down, j
+ Select (highlight) the next process in the process list. Scroll the list if
+ necessary.
+ .TP
+-.B Left, Alt-h
++.B Left, h
+ Scroll the process list left.
+ .TP
+-.B Right, Alt-l
++.B Right, l
+ Scroll the process list right.
+ .TP
+-.B PgUp, PgDn
++.B PgUp, Ctrl-B, PgDn, Ctrl-F
+ Scroll the process list up or down one window.
+ .TP
+-.B Home
++.B Ctrl-U, Ctrl-D
++Scroll the process list up or down half a window.
++.TP
++.B Home, g
+ Scroll to the top of the process list and select the first process.
+ .TP
+-.B End
++.B End, G
+ Scroll to the bottom of the process list and select the last process.
+ .TP
+ .B Ctrl-A, ^
+@@ -142,7 +145,7 @@ Trace process system calls: if strace(1) is installed, pressing this key
+ will attach it to the currently selected process, presenting a live
+ update of system calls issued by the process.
+ .TP
+-.B l
++.B L
+ Display open files for a process: if lsof(1) is installed, pressing this key
+ will display the list of file descriptors opened by the process.
+ .TP
+@@ -150,10 +153,10 @@ will display the list of file descriptors opened by the process.
+ Display the command line of the selected process in a separate screen, wrapped
+ onto multiple lines as needed.
+ .TP
+-.B x
++.B X
+ Display the active file locks of the selected process in a separate screen.
+ .TP
+-.B F1, h, ?
++.B F1, ?
+ Go to the help screen
+ .TP
+ .B F2, S
+@@ -182,7 +185,7 @@ between them as a tree. Toggling the key will switch between tree and
+ your previously selected sort view. Selecting a sort view will exit
+ tree view.
+ .TP
+-.B F6, <, >
++.B F6, <, >, o
+ Selects a field for sorting, also accessible through < and >.
+ The current sort field is indicated by a highlight in the header.
+ .TP
+@@ -200,7 +203,7 @@ This can only be done by the superuser.
+ .B Shift-F8, {
+ Decrease the selected process's autogroup priority (add to autogroup 'nice' value)
+ .TP
+-.B F9, k
++.B F9, x
+ "Kill" process: sends a signal which is selected in a menu, to one or a group
+ of processes. If processes were tagged, sends the signal to all tagged processes.
+ If none is tagged, sends to the currently selected process.
+@@ -212,7 +215,7 @@ Quit
+ Invert the sort order: if sort order is increasing, switch to decreasing, and
+ vice-versa.
+ .TP
+-.B +, \-, *
++.B +, \-, *, o
+ When in tree view mode, expand or collapse subtree. When a subtree is collapsed
+ a "+" sign shows to the left of the process name.
+ Pressing "*" will expand or collapse all children of PIDs without parents, so