vis
a vi-like editor based on Plan 9's structural regular expressions
git clone https://9o.is/git/vis.git
commit 0e86622c00f37583b1c824d121eaab4815da7fe4 parent 10e5df115f7e7c8e0d88bc9f4d4dc9a14afc1ace Author: Marc André Tanner <mat@brain-dump.org> Date: Mon, 4 Apr 2016 13:02:25 +0200 vis: in visual mode allow navigation among cursors using <C-j> and <C-k> Diffstat:
| M | config.def.h | | | 2 | ++ |
| M | main.c | | | 8 | ++++++-- |
2 files changed, 8 insertions(+), 2 deletions(-)
diff --git a/config.def.h b/config.def.h @@ -273,6 +273,8 @@ static const KeyBinding bindings_visual[] = { { "<C-f>", ALIAS("<PageDown>") }, { "<C-u>", ACTION(CURSORS_PREV) }, { "<C-d>", ACTION(CURSORS_NEXT) }, + { "<C-k>", ALIAS("<C-u>") }, + { "<C-j>", ALIAS("<C-d>") }, { "x", ALIAS("d") }, { "r", ALIAS("c") }, { "s", ALIAS("c") }, diff --git a/main.c b/main.c @@ -1401,8 +1401,12 @@ static const char *cursors_remove(Vis *vis, const char *keys, const Arg *arg) { static const char *cursors_navigate(Vis *vis, const char *keys, const Arg *arg) { View *view = vis_view(vis); - if (!view_cursors_multiple(view)) - return wscroll(vis, keys, arg); + if (!view_cursors_multiple(view)) { + Filerange sel = view_selection_get(view); + if (!text_range_valid(&sel)) + return wscroll(vis, keys, arg); + return keys; + } Cursor *c = view_cursors_primary_get(view); for (int count = vis_count_get_default(vis, 1); count > 0; count--) { if (arg->i > 0) {