seanyeh / vibreoffice

Vi Mode for LibreOffice/OpenOffice

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

"0" should go to the start of the line

perrycate opened this issue · comments

This might be trickier than some of the other issues due to the way Libreoffice handles Line endings, but hopefully there's a way since "$" works fine.

I second this motion. Also, "|" (pipe) should go to the first character of the line, unless preceded by a count (column number), which then jumps to that character on the line.

This patch should add 0 as an alias to the ^ key:

commit d5c3f176cbbf09c22eb3898f04137d9f66b9cb3f
Author: Mikael Berthe <mikael@lilotux.net>
Date:   Wed Nov 4 18:33:45 2015 +0100

    Add 0 to jump to the first character of the line

diff --git a/src/vibreoffice.vbs b/src/vibreoffice.vbs
index 1d6e8c5..9f55bb0 100644
--- a/src/vibreoffice.vbs
+++ b/src/vibreoffice.vbs
@@ -425,7 +425,10 @@ Function ProcessNumberKey(oEvent)
     dim c
     c = CStr(oEvent.KeyChar)

-    If c >= "0" and c <= "9" Then
+    If c > "0" and c <= "9" Then
+        addToMultiplier(CInt(c))
+        ProcessNumberKey = True
+    ElseIf c = "0" and getRawMultiplier() > 0 Then
         addToMultiplier(CInt(c))
         ProcessNumberKey = True
     Else
@@ -934,7 +937,7 @@ Function ProcessMovementKey(keyChar, Optional bExpand, Optional keyModifiers)
         bSetCursor = False
     ' ----------

-    ElseIf keyChar = "^" Then
+    ElseIf keyChar = "0" or keyChar = "^" Then
         getCursor().gotoStartOfLine(bExpand)
         bSetCursor = False
     ElseIf keyChar = "$" Then