vis

a vi-like editor based on Plan 9's structural regular expressions

git clone https://9o.is/git/vis.git

commit 0a72bffc3fada38856fad19a09efff8c19a0b536
parent 28683a731b5c646db50bc3eda32f6c0e55b7cee1
Author: Marc André Tanner <mat@brain-dump.org>
Date:   Sun,  4 Jan 2015 22:25:09 +0100

Support relative line jumps :+nn / :-nn

Diffstat:
Mvis.c | 10++++++++++
1 file changed, 10 insertions(+), 0 deletions(-)

diff --git a/vis.c b/vis.c @@ -1658,6 +1658,16 @@ static Filepos parse_pos(char **cmd) { } text_regex_free(regex); break; + case '+': + case '-': + { + CursorPos curspos = window_cursor_getpos(win); + long long line = curspos.line + strtoll(*cmd, cmd, 10); + if (line < 0) + line = 0; + pos = text_pos_by_lineno(txt, line); + break; + } default: if ('0' <= **cmd && **cmd <= '9') pos = text_pos_by_lineno(txt, strtoul(*cmd, cmd, 10));