tvi: _, +, and | motions - neatvi - [fork] simple vi-type editor with UTF-8 support (HTM) git clone git://src.adamsgaard.dk/neatvi (DIR) Log (DIR) Files (DIR) Refs (DIR) README --- (DIR) commit 1f17a310ce1b7e9b2ce95245e2ba8e4f39843478 (DIR) parent 0b878c42f286e746c004dbd23127ed0fda2bf553 (HTM) Author: Ali Gholami Rudi <ali@rudi.ir> Date: Sun, 3 May 2015 19:40:10 +0430 vi: _, +, and | motions Diffstat: M vi.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) --- (DIR) diff --git a/vi.c b/vi.c t@@ -170,11 +170,15 @@ static int vi_motionln(int *row, int cmd, int pre1, int pre2) int mark; switch (c) { case '\n': + case '+': *row = MIN(*row + pre, lbuf_len(xb) - 1); break; case '-': *row = MAX(*row - pre, 0); break; + case '_': + *row = MIN(*row + pre - 1, lbuf_len(xb) - 1); + break; case '\'': if ((mark = vi_read()) > 0 && (isalpha(mark) || mark == '\'')) if (lbuf_markpos(xb, mark) >= 0) t@@ -352,6 +356,9 @@ static int vi_motion(int *row, int *col, int pre1, int pre2) lbuf_eol(xb, row, col, +1); lbuf_lnnext(xb, row, col, -1); break; + case '|': + *col = pre - 1; + break; case 127: case TERMCTRL('h'): *col = ren_cursor(ln, *col); t@@ -421,7 +428,7 @@ static void vc_motion(int c, int pre1) lbuf_eol(xb, &r1, &c1, -1); lbuf_eol(xb, &r2, &c2, +1); } else if ((mv = vi_motion(&r2, &c2, pre1, pre2))) { - if (strchr("^0bBhlwW ", mv)) + if (!strchr("fFtTeE$", mv)) closed = 0; } else { return;