summaryrefslogtreecommitdiffstats
path: root/src/btop_input.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/btop_input.cpp')
-rw-r--r--src/btop_input.cpp16
1 files changed, 9 insertions, 7 deletions
diff --git a/src/btop_input.cpp b/src/btop_input.cpp
index 6e4fc02..7d6be33 100644
--- a/src/btop_input.cpp
+++ b/src/btop_input.cpp
@@ -184,7 +184,9 @@ namespace Input {
if (key.empty()) return;
try {
auto& filtering = Config::getB("proc_filtering");
-
+ auto& vim_keys = Config::getB("vim_keys");
+ auto help_key = (vim_keys ? "H" : "h");
+ auto kill_key = (vim_keys ? "K" : "k");
//? Global input actions
if (not filtering) {
bool keep_going = false;
@@ -195,7 +197,7 @@ namespace Input {
Menu::show(Menu::Menus::Main);
return;
}
- else if (is_in(key, "F1", "h")) {
+ else if (is_in(key, "F1", help_key)) {
Menu::show(Menu::Menus::Help);
return;
}
@@ -254,13 +256,13 @@ namespace Input {
else
return;
}
- else if (key == "left") {
+ else if (key == "left" or (vim_keys and key == "h")) {
int cur_i = v_index(Proc::sort_vector, Config::getS("proc_sorting"));
if (--cur_i < 0)
cur_i = Proc::sort_vector.size() - 1;
Config::set("proc_sorting", Proc::sort_vector.at(cur_i));
}
- else if (key == "right") {
+ else if (key == "right" or (vim_keys and key == "l")) {
int cur_i = v_index(Proc::sort_vector, Config::getS("proc_sorting"));
if (std::cmp_greater(++cur_i, Proc::sort_vector.size() - 1))
cur_i = 0;
@@ -346,7 +348,7 @@ namespace Input {
if (key == "-" or key == "space") Proc::collapse = pid;
no_update = false;
}
- else if (is_in(key, "t", "k") and (Config::getB("show_detailed") or Config::getI("selected_pid") > 0)) {
+ else if (is_in(key, "t", kill_key) and (Config::getB("show_detailed") or Config::getI("selected_pid") > 0)) {
atomic_wait(Runner::active);
if (Config::getB("show_detailed") and Config::getI("proc_selected") == 0 and Proc::detailed.status == "Dead") return;
Menu::show(Menu::Menus::SignalSend, (key == "t" ? SIGTERM : SIGKILL));
@@ -358,7 +360,7 @@ namespace Input {
Menu::show(Menu::Menus::SignalChoose);
return;
}
- else if (is_in(key, "up", "down", "page_up", "page_down", "home", "end")) {
+ else if (is_in(key, "up", "down", "page_up", "page_down", "home", "end") or (vim_keys and is_in(key, "j", "k"))) {
proc_mouse_scroll:
redraw = false;
auto old_selected = Config::getI("proc_selected");
@@ -485,4 +487,4 @@ namespace Input {
}
}
-}
+} \ No newline at end of file