Add some basic vim movements


Abanoub Sameh
 

From 913dc42ab7e89facc861cfe18d40ef618c5b1232 Mon Sep 17 00:00:00 2001
From: Abanoub Sameh <abanoubsameh@...>
Date: Mon, 31 May 2021 20:07:00 +0200
Subject: [PATCH] Add vim g and G movements

This patch adds g key to jump to the top, and the G key to jump to the
buttom. Next there can be a small parser that can take a number and a
command, or a more complex command and do it.
ex: 10j dd gg ...
I don't know how hard that would be, if possible at all.

Signed-off-by: Abanoub Sameh <abanoubsameh@...>
---
Panel.c | 6 ++++++
1 file changed, 6 insertions(+)

diff --git a/Panel.c b/Panel.c
index 813bca9..d576d79 100644
--- a/Panel.c
+++ b/Panel.c
@@ -430,6 +430,12 @@ bool Panel_onKey(Panel* this, int key) {
this->scrollH = MAXIMUM(this->selectedLen - this->w, 0);
this->needsRedraw = true;
break;
+ case 'g':
+ this->selected = 0;
+ break;
+ case 'G':
+ this->selected = Panel_size(this);
+ break;
default:
return false;
}
--
2.31.1