diff options
author | Felix Wiegand | 2024-01-29 10:26:56 +0100 |
---|---|---|
committer | Felix Wiegand | 2024-01-29 10:26:56 +0100 |
commit | 6ce4fc4541232b87041f0eef02ed3d08b3ed537e (patch) | |
tree | e68370d2f0905fe51ba381a1c579fcb90eba60c8 | |
parent | 8e3f0d0a7b58b0fe8ef1392273fec741d551c945 (diff) | |
download | aur-6ce4fc4541232b87041f0eef02ed3d08b3ed537e.tar.gz |
Update patch
-rw-r--r-- | .SRCINFO | 4 | ||||
-rw-r--r-- | PKGBUILD | 4 | ||||
-rw-r--r-- | vim-keybindings.patch | 486 |
3 files changed, 238 insertions, 256 deletions
@@ -1,6 +1,6 @@ pkgbase = htop-vim-git pkgdesc = Interactive text-mode process viewer. Patched for vim keybindings - pkgver = 3.2.2.167.ge49a40ad + pkgver = 3.3.0.20.g32cb3027 pkgrel = 1 epoch = 1 url = https://github.com/htop-dev/htop @@ -21,6 +21,6 @@ pkgbase = htop-vim-git source = git+https://github.com/htop-dev/htop.git source = vim-keybindings.patch sha256sums = SKIP - sha256sums = 1abc087a6c9b50d5e831e3ea04352143831a015374f8c059625f19ae7d30e5b9 + sha256sums = 81341dff8633e21a6dd92a3a1802e4ccca431234d8b65eff99ede5ce922ad5b8 pkgname = htop-vim-git @@ -2,7 +2,7 @@ _pkgname=htop pkgname=${_pkgname}-vim-git -pkgver=3.2.2.167.ge49a40ad +pkgver=3.3.0.20.g32cb3027 pkgrel=1 epoch=1 pkgdesc="Interactive text-mode process viewer. Patched for vim keybindings" @@ -19,7 +19,7 @@ options=('!emptydirs') source=("git+${url}.git" 'vim-keybindings.patch') sha256sums=('SKIP' - '1abc087a6c9b50d5e831e3ea04352143831a015374f8c059625f19ae7d30e5b9') + '81341dff8633e21a6dd92a3a1802e4ccca431234d8b65eff99ede5ce922ad5b8') pkgver() { cd "${srcdir}/${_pkgname}" diff --git a/vim-keybindings.patch b/vim-keybindings.patch index 0b6554ffcdce..9e3e87d3f496 100644 --- a/vim-keybindings.patch +++ b/vim-keybindings.patch @@ -1,297 +1,279 @@ diff --git a/Action.c b/Action.c -index 61cc1ef9..6e7a75c5 100644 +index 4049a952..9ef91740 100644 --- a/Action.c +++ b/Action.c -@@ -639,7 +639,7 @@ static const struct { - } helpLeft[] = { - { .key = " #: ", .roInactive = false, .info = "hide/show header meters" }, - { .key = " Tab: ", .roInactive = false, .info = "switch to next screen tab" }, -- { .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" }, -@@ -668,7 +668,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 = true, .info = "lower priority (+ nice)" }, - #if (defined(HAVE_LIBHWLOC) || defined(HAVE_AFFINITY)) -@@ -676,15 +676,15 @@ static const struct { - #endif - { .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" }, - #ifdef SCHEDULER_SUPPORT - { .key = " Y: ", .roInactive = true, .info = "set scheduling policy" }, - #endif - { .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 } - }; -@@ -896,6 +896,7 @@ void Action_setBindings(Htop_Action* keys) { - keys['H'] = actionToggleUserlandThreads; - keys['I'] = actionInvertSortOrder; - keys['K'] = actionToggleKernelThreads; -+ keys['L'] = actionLsof; - keys['M'] = actionSortByMemory; - keys['N'] = actionSortByPID; - keys['O'] = actionToggleRunningInContainer; -@@ -915,9 +916,6 @@ void Action_setBindings(Htop_Action* keys) { +@@ -894,6 +894,7 @@ void Action_setBindings(Htop_Action* keys) { + keys['/'] = actionIncSearch; + keys['<'] = actionSetSortColumn; + keys['='] = actionExpandOrCollapse; ++ keys['o'] = actionExpandOrCollapse; + keys['>'] = actionSetSortColumn; + keys['?'] = actionHelp; + keys['C'] = actionSetup; +@@ -920,9 +921,9 @@ 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['h'] = actionHelp; ++ keys['x'] = actionKill; ++ keys['L'] = actionLsof; keys['m'] = actionToggleMergedCommand; keys['p'] = actionToggleProgramPath; keys['q'] = actionQuit; -@@ -925,7 +923,8 @@ void Action_setBindings(Htop_Action* keys) { +@@ -930,7 +931,7 @@ void Action_setBindings(Htop_Action* keys) { keys['t'] = actionToggleTreeView; keys['u'] = actionFilterByUser; keys['w'] = actionShowCommandScreen; - keys['x'] = actionShowLocks; + keys['X'] = actionShowLocks; -+ keys['x'] = actionKill; keys[KEY_F(1)] = actionHelp; keys[KEY_F(2)] = actionSetup; keys[KEY_F(3)] = actionIncSearch; -@@ -937,6 +936,7 @@ void Action_setBindings(Htop_Action* keys) { - keys[KEY_F(9)] = actionKill; - keys[KEY_F(10)] = actionQuit; - keys[KEY_F(18)] = actionExpandCollapseOrSortColumn; -+ keys['o'] = actionExpandCollapseOrSortColumn; - keys[KEY_RECLICK] = actionExpandOrCollapse; - keys[KEY_SHIFT_TAB] = actionPrevScreen; - keys['\t'] = actionNextScreen; +diff --git a/AvailableMetersPanel.c b/AvailableMetersPanel.c +index 9a1d367c..f1c07175 100644 +--- a/AvailableMetersPanel.c ++++ b/AvailableMetersPanel.c +@@ -59,7 +59,7 @@ static HandlerResult AvailableMetersPanel_eventHandler(Panel* super, int ch) { + + switch (ch) { + case KEY_F(5): +- case 'l': ++ //case 'l': + case 'L': + AvailableMetersPanel_addMeter(header, this->meterPanels[0], Platform_meterTypes[type], param, 0); + result = HANDLED; +@@ -69,7 +69,7 @@ static HandlerResult AvailableMetersPanel_eventHandler(Panel* super, int ch) { + case 0x0d: + case KEY_ENTER: + case KEY_F(6): +- case 'r': ++ //case 'r': + case 'R': + AvailableMetersPanel_addMeter(header, this->meterPanels[this->columns - 1], Platform_meterTypes[type], param, this->columns - 1); + result = (KEY_LEFT << 16) | SYNTH_KEY; diff --git a/CategoriesPanel.c b/CategoriesPanel.c -index 31c7da05..8f8f06de 100644 +index 64a3f062..b67711cc 100644 --- a/CategoriesPanel.c +++ b/CategoriesPanel.c -@@ -122,6 +122,14 @@ 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 'l': ch = KEY_RIGHT; break; -+ } -+ - switch (ch) { - case EVENT_SET_SELECTED: +@@ -129,11 +129,19 @@ static HandlerResult CategoriesPanel_eventHandler(Panel* super, int ch) { result = HANDLED; -diff --git a/MainPanel.c b/MainPanel.c -index 7ca7b201..267efaba 100644 ---- a/MainPanel.c -+++ b/MainPanel.c -@@ -51,7 +51,7 @@ static const char* MainPanel_getValue(Panel* this, int i) { - return Row_sortKeyString(row); - } - --static HandlerResult MainPanel_eventHandler(Panel* super, int ch) { -+HandlerResult MainPanel_eventHandler(Panel* super, int ch) { - MainPanel* this = (MainPanel*) super; - Machine* host = this->state->host; - Htop_Reaction reaction = HTOP_OK; -diff --git a/MainPanel.h b/MainPanel.h -index 19229d59..05209eba 100644 ---- a/MainPanel.h -+++ b/MainPanel.h -@@ -51,4 +51,6 @@ void MainPanel_setFunctionBar(MainPanel* this, bool readonly); - - void MainPanel_delete(Object* object); - -+HandlerResult MainPanel_eventHandler(Panel* super, int ch); -+ - #endif + break; + case KEY_UP: ++ case 'k': + case KEY_CTRL('P'): + case KEY_DOWN: ++ case 'j': + case KEY_CTRL('N'): + case KEY_NPAGE: ++ case KEY_CTRL('D'): ++ case KEY_CTRL('F'): + case KEY_PPAGE: ++ case KEY_CTRL('B'): ++ case KEY_CTRL('U'): ++ case 'g': ++ case 'G': + case KEY_HOME: + case KEY_END: { + int previous = selected; +diff --git a/ColumnsPanel.c b/ColumnsPanel.c +index 66625666..5a8c5951 100644 +--- a/ColumnsPanel.c ++++ b/ColumnsPanel.c +@@ -57,6 +57,7 @@ static HandlerResult ColumnsPanel_eventHandler(Panel* super, int ch) { + } + break; + case KEY_UP: ++ case 'k': + if (!this->moving) + break; + /* else fallthrough */ +@@ -68,6 +69,7 @@ static HandlerResult ColumnsPanel_eventHandler(Panel* super, int ch) { + result = HANDLED; + break; + case KEY_DOWN: ++ case 'j': + if (!this->moving) + break; + /* else fallthrough */ +diff --git a/MetersPanel.c b/MetersPanel.c +index 2678fb2f..8d174f9f 100644 +--- a/MetersPanel.c ++++ b/MetersPanel.c +@@ -117,6 +117,7 @@ static HandlerResult MetersPanel_eventHandler(Panel* super, int ch) { + break; + } + case KEY_UP: ++ case 'k': + if (!this->moving) + break; + /* else fallthrough */ +@@ -128,6 +129,7 @@ static HandlerResult MetersPanel_eventHandler(Panel* super, int ch) { + result = HANDLED; + break; + case KEY_DOWN: ++ case 'j': + if (!this->moving) + break; + /* else fallthrough */ +@@ -139,6 +141,7 @@ static HandlerResult MetersPanel_eventHandler(Panel* super, int ch) { + result = HANDLED; + break; + case KEY_RIGHT: ++ case 'l': + sideMove = moveToNeighbor(this, this->rightNeighbor, selected); + if (this->moving && !sideMove) { + // lock user here until it exits positioning-mode +@@ -148,6 +151,7 @@ static HandlerResult MetersPanel_eventHandler(Panel* super, int ch) { + // let ScreenManager handle focus. + break; + case KEY_LEFT: ++ case 'h': + sideMove = moveToNeighbor(this, this->leftNeighbor, selected); + if (this->moving && !sideMove) { + result = HANDLED; diff --git a/Panel.c b/Panel.c -index d1bc6a7b..de741f2c 100644 +index 4784a658..7a0d5f39 100644 --- a/Panel.c +++ b/Panel.c -@@ -358,6 +358,7 @@ bool Panel_onKey(Panel* this, int key) { +@@ -360,6 +360,7 @@ bool Panel_onKey(Panel* this, int key) { switch (key) { - case KEY_DOWN: -+ case 'j': - case KEY_CTRL('N'): - #ifdef KEY_C_DOWN - case KEY_C_DOWN: -@@ -366,6 +367,7 @@ bool Panel_onKey(Panel* this, int key) { - break; + case KEY_DOWN: ++ case 'j': + case KEY_CTRL('N'): + #ifdef KEY_C_DOWN + case KEY_C_DOWN: +@@ -368,6 +369,7 @@ bool Panel_onKey(Panel* this, int key) { + break; + + case KEY_UP: ++ case 'k': + case KEY_CTRL('P'): + #ifdef KEY_C_UP + case KEY_C_UP: +@@ -376,7 +378,8 @@ bool Panel_onKey(Panel* this, int key) { + break; - case KEY_UP: -+ case 'k': - case KEY_CTRL('P'): - #ifdef KEY_C_UP - case KEY_C_UP: -@@ -374,7 +376,7 @@ bool Panel_onKey(Panel* this, int key) { - break; + case KEY_LEFT: +- case KEY_CTRL('B'): ++ case 'h': ++ //case KEY_CTRL('B'): + if (this->scrollH > 0) { + this->scrollH -= MAXIMUM(CRT_scrollHAmount, 0); + this->needsRedraw = true; +@@ -384,19 +387,30 @@ bool Panel_onKey(Panel* this, int key) { + break; - case KEY_LEFT: -- case KEY_CTRL('B'): -+ case 'h': - if (this->scrollH > 0) { - this->scrollH -= MAXIMUM(CRT_scrollHAmount, 0); + case KEY_RIGHT: +- case KEY_CTRL('F'): ++ case 'l': ++ //case KEY_CTRL('F'): + this->scrollH += CRT_scrollHAmount; this->needsRedraw = true; -@@ -382,16 +384,27 @@ bool Panel_onKey(Panel* this, int key) { - break; + break; - case KEY_RIGHT: -- case KEY_CTRL('F'): -+ case 'l': - this->scrollH += CRT_scrollHAmount; - this->needsRedraw = true; - break; + case KEY_PPAGE: ++ case KEY_CTRL('B'): + PANEL_SCROLL(-(this->h - Panel_headerHeight(this))); + break; -+ case KEY_CTRL('U'): -+ this->selected -= (this->h - 1) / 2; -+ this->needsRedraw = true; -+ break; -+ case KEY_CTRL('D'): -+ this->selected += (this->h - 1) / 2; -+ this->needsRedraw = true; -+ break; ++ case KEY_CTRL('U'): ++ PANEL_SCROLL(-(this->h - Panel_headerHeight(this))/2); ++ break; + - case KEY_PPAGE: -+ case KEY_CTRL('B'): - PANEL_SCROLL(-(this->h - Panel_headerHeight(this))); - break; - - case KEY_NPAGE: -+ case KEY_CTRL('F'): - PANEL_SCROLL(+(this->h - Panel_headerHeight(this))); - break; - -@@ -404,10 +417,12 @@ bool Panel_onKey(Panel* this, int key) { - break; - - case KEY_HOME: -+ case 'g': - this->selected = 0; - break; - - case KEY_END: -+ case 'G': - this->selected = size - 1; - break; + case KEY_NPAGE: ++ case KEY_CTRL('F'): + PANEL_SCROLL(+(this->h - Panel_headerHeight(this))); + break; -diff --git a/README b/README -index 7ace7cd1..f90f4631 100644 ---- a/README -+++ b/README -@@ -21,6 +21,48 @@ The information displayed is configurable through a graphical setup and can be s ++ case KEY_CTRL('D'): ++ PANEL_SCROLL(+(this->h - Panel_headerHeight(this))/2); ++ break; ++ + case KEY_WHEELUP: + PANEL_SCROLL(-CRT_scrollWheelVAmount); + break; +@@ -406,10 +420,12 @@ bool Panel_onKey(Panel* this, int key) { + break; - Tasks related to processes (e.g. killing and renicing) can be done without entering their PIDs. + case KEY_HOME: ++ case 'g': + this->selected = 0; + break; -+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 libncurses(w). + case KEY_END: ++ case 'G': + this->selected = size - 1; + break; - `htop` is written in C. diff --git a/ScreenManager.c b/ScreenManager.c -index f4d59a42..5a52ac42 100644 +index e7e82e1d..9318b7c5 100644 --- a/ScreenManager.c +++ b/ScreenManager.c -@@ -18,6 +18,7 @@ in the source distribution for its full text. - #include "FunctionBar.h" - #include "Machine.h" - #include "Macros.h" -+#include "MainPanel.h" - #include "Object.h" - #include "Platform.h" - #include "ProcessTable.h" -@@ -318,14 +319,16 @@ void ScreenManager_run(ScreenManager* this, Panel** lastFocus, int* lastKey, con - redraw = false; - continue; - } -- switch (ch) { -- case KEY_ALT('H'): ch = KEY_LEFT; break; -- case KEY_ALT('J'): ch = KEY_DOWN; break; -- case KEY_ALT('K'): ch = KEY_UP; break; -- case KEY_ALT('L'): ch = KEY_RIGHT; break; -- } - redraw = true; - if (Panel_eventHandlerFn(panelFocus)) { -+ if (Panel_eventHandlerFn(panelFocus) != MainPanel_eventHandler) { -+ switch (ch) { -+ case 'h': case KEY_ALT('H'): ch = KEY_LEFT; break; -+ case 'j': case KEY_ALT('J'): ch = KEY_DOWN; break; -+ case 'k': case KEY_ALT('K'): ch = KEY_UP; break; -+ case 'l': case KEY_ALT('L'): ch = KEY_RIGHT; break; -+ } -+ } - result = Panel_eventHandler(panelFocus, ch); - } - if (result & SYNTH_KEY) { -@@ -359,7 +362,7 @@ void ScreenManager_run(ScreenManager* this, Panel** lastFocus, int* lastKey, con - continue; +@@ -324,9 +324,11 @@ void ScreenManager_run(ScreenManager* this, Panel** lastFocus, int* lastKey, con + + switch (ch) { + case KEY_ALT('H'): ch = KEY_LEFT; break; ++ case 'h': ch = KEY_LEFT; break; + case KEY_ALT('J'): ch = KEY_DOWN; break; + case KEY_ALT('K'): ch = KEY_UP; break; + case KEY_ALT('L'): ch = KEY_RIGHT; break; ++ case 'l': ch = KEY_RIGHT; break; } - case KEY_LEFT: -- case KEY_CTRL('B'): -+ case 'h': - if (this->panelCount < 2) { - goto defaultHandler; - } -@@ -380,7 +383,7 @@ tryLeft: + redraw = true; +diff --git a/ScreenTabsPanel.c b/ScreenTabsPanel.c +index e48e5fb8..6f152ce6 100644 +--- a/ScreenTabsPanel.c ++++ b/ScreenTabsPanel.c +@@ -81,9 +81,15 @@ static HandlerResult ScreenTabsPanel_eventHandler(Panel* super, int ch) { + /* pass onto the Names panel for creating new screen */ + return ScreenNamesPanel_eventHandlerNormal(&this->names->super, ch); + case KEY_UP: ++ case 'k': + case KEY_DOWN: ++ case 'j': + case KEY_NPAGE: ++ case KEY_CTRL('D'): ++ case KEY_CTRL('F'): + case KEY_PPAGE: ++ case KEY_CTRL('B'): ++ case KEY_CTRL('U'): + case KEY_HOME: + case KEY_END: { + int previous = selected; +diff --git a/ScreensPanel.c b/ScreensPanel.c +index 4138066b..6c7c4801 100644 +--- a/ScreensPanel.c ++++ b/ScreensPanel.c +@@ -194,7 +194,11 @@ static HandlerResult ScreensPanel_eventHandlerNormal(Panel* super, int ch) { + result = HANDLED; break; - case KEY_RIGHT: -- case KEY_CTRL('F'): -+ case 'l': - case 9: - if (this->panelCount < 2) { - goto defaultHandler; + case KEY_NPAGE: ++ case KEY_CTRL('D'): ++ case KEY_CTRL('F'): + case KEY_PPAGE: ++ case KEY_CTRL('B'): ++ case KEY_CTRL('U'): + case KEY_HOME: + case KEY_END: + Panel_onKey(super, ch); +@@ -214,6 +218,7 @@ static HandlerResult ScreensPanel_eventHandlerNormal(Panel* super, int ch) { + result = HANDLED; + break; + case KEY_UP: ++ case 'k': + if (!this->moving) { + Panel_onKey(super, ch); + break; +@@ -227,6 +232,7 @@ static HandlerResult ScreensPanel_eventHandlerNormal(Panel* super, int ch) { + result = HANDLED; + break; + case KEY_DOWN: ++ case 'j': + if (!this->moving) { + Panel_onKey(super, ch); + break; |