From: Daniel Carl <danielcarl@gmx.de>
Date: Sun, 23 Aug 2015 20:06:33 +0000 (+0200)
Subject: Added ^ as normal mode alias of 0 (#236).
X-Git-Url: https://git.owens.tech/wrapped.html/wrapped.html/git?a=commitdiff_plain;h=05b552b0c44f0586254a28d4585bdaadebb0b1ad;p=vimb.git

Added ^ as normal mode alias of 0 (#236).

Use the ^ to scroll to the absolute left of the document like
pentadactyl does.
---

diff --git a/doc/vimb.1 b/doc/vimb.1
index bb96e0a..9d03ca8 100644
--- a/doc/vimb.1
+++ b/doc/vimb.1
@@ -205,11 +205,12 @@ Or if \fIN\fP is given to \fIN\fP% of the page.
 Scroll to the bottom of the current page.
 Or if \fIN\fP is given to \fIN\fP% of the page.
 .TP
-.BI [ N ]0
-Scroll \fIN\fP steps to the left of current page.
+.B 0, ^
+Scroll to the absolute left of the document.
+Unlike in Vim, 0 and ^ work exactly the same way.
 .TP
-.BI [ N ]$
-Scroll \fIN\fP steps to the right of current page.
+.B $
+Scroll to the absolute right of the document.
 .TP
 .BI [ N ]h
 Scroll \fIN\fP steps to the left of page.
diff --git a/src/normal.c b/src/normal.c
index 9d11c26..57e0c0d 100644
--- a/src/normal.c
+++ b/src/normal.c
@@ -171,7 +171,7 @@ static struct {
 /* [   0x5b */ {normal_prevnext},
 /* \   0x5c */ {NULL},
 /* ]   0x5d */ {normal_prevnext},
-/* ^   0x5e */ {NULL},
+/* ^   0x5e */ {normal_scroll},
 /* _   0x5f */ {NULL},
 /* `   0x60 */ {NULL},
 /* a   0x61 */ {NULL},
@@ -700,7 +700,8 @@ static VbResult normal_scroll(const NormalCmdInfo *info)
             /* save the position to mark ' */
             vb.state.marks[VB_MARK_TICK] = gtk_adjustment_get_value(adjust);
             break;
-        case '0':
+        case '0': /* fall through */
+        case '^':
             adjust = vb.gui.adjust_h;
             new    = gtk_adjustment_get_lower(adjust);
             break;