add "g" and "G" to vim keys

This commit is contained in:
mohammad hashemy 2022-02-21 20:45:38 +03:30
parent 7b3d996a73
commit 682313027f
4 changed files with 5 additions and 5 deletions

View file

@ -595,7 +595,7 @@ force_tty = False
#* Example: "cpu:0:default,mem:0:tty,proc:1:default cpu:0:braille,proc:0:tty"
presets = "cpu:1:default,proc:0:default cpu:0:default,mem:0:default,net:0:default cpu:0:block,net:0:tty"
#* Set to True to enable "h,j,k,l" keys for directional control in lists.
#* Set to True to enable "h,j,k,l,g,G" keys for directional control in lists.
#* Conflicting keys for h:"help" and k:"kill" is accessible while holding shift.
vim_keys = False

View file

@ -54,7 +54,7 @@ namespace Config {
"#* Use withespace \" \" as separator between different presets.\n"
"#* Example: \"cpu:0:default,mem:0:tty,proc:1:default cpu:0:braille,proc:0:tty\""},
{"vim_keys", "#* Set to True to enable \"h,j,k,l\" keys for directional control in lists.\n"
{"vim_keys", "#* Set to True to enable \"h,j,k,l,g,G\" keys for directional control in lists.\n"
"#* Conflicting keys for h:\"help\" and k:\"kill\" is accessible while holding shift."},
{"rounded_corners", "#* Rounded corners on boxes, is ignored if TTY mode is ON."},

View file

@ -1070,11 +1070,11 @@ namespace Proc {
if (selected > 0 and start >= numpids - select_max) selected = select_max;
else start = clamp(start + select_max, 0, max(0, numpids - select_max));
}
else if (cmd_key == "home") {
else if (cmd_key == "home" or (vim_keys and cmd_key == "g")) {
start = 0;
if (selected > 0) selected = 1;
}
else if (cmd_key == "end") {
else if (cmd_key == "end" or (vim_keys and cmd_key == "G")) {
start = max(0, numpids - select_max);
if (selected > 0) selected = select_max;
}

View file

@ -416,7 +416,7 @@ namespace Input {
Menu::show(Menu::Menus::SignalChoose);
return;
}
else if (is_in(key, "up", "down", "page_up", "page_down", "home", "end") or (vim_keys and is_in(key, "j", "k"))) {
else if (is_in(key, "up", "down", "page_up", "page_down", "home", "end") or (vim_keys and is_in(key, "j", "k", "g", "G"))) {
proc_mouse_scroll:
redraw = false;
auto old_selected = Config::getI("proc_selected");