From 08d2e6964eee74a156e6ca4996e90f5e0a2d676f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc=20Andr=C3=A9=20Tanner?= Date: Sat, 29 Aug 2020 13:39:50 +0200 Subject: vis: implement C-n in normal mode with a mapping to viw --- config.def.h | 2 +- main.c | 20 -------------------- 2 files changed, 1 insertion(+), 21 deletions(-) diff --git a/config.def.h b/config.def.h index 3717404..6a4555e 100644 --- a/config.def.h +++ b/config.def.h @@ -184,7 +184,7 @@ static const KeyBinding bindings_normal[] = { { "", ACTION(SELECTIONS_NEW_LINE_BELOW) }, { "", ACTION(SELECTIONS_NEW_LINE_ABOVE) }, { "", ACTION(SELECTIONS_REMOVE_COLUMN_EXCEPT) }, - { "", ACTION(SELECTIONS_MATCH_WORD) }, + { "", ALIAS("viw") }, { "", ACTION(SELECTIONS_REMOVE_LAST) }, { "", ACTION(REDO) }, { "", ACTION(SELECTIONS_PREV) }, diff --git a/main.c b/main.c index d838cc2..4e9f6df 100644 --- a/main.c +++ b/main.c @@ -66,8 +66,6 @@ static const char *selections_remove_column(Vis*, const char *keys, const Arg *a static const char *selections_remove_column_except(Vis*, const char *keys, const Arg *arg); /* move to the previous (arg->i < 0) or next (arg->i > 0) selection */ static const char *selections_navigate(Vis*, const char *keys, const Arg *arg); -/* select the word the selection is currently over */ -static const char *selections_match_word(Vis*, const char *keys, const Arg *arg); /* select the next region matching the current selection */ static const char *selections_match_next(Vis*, const char *keys, const Arg *arg); /* clear current selection but select next match */ @@ -256,7 +254,6 @@ enum { VIS_ACTION_WINDOW_SLIDE_DOWN, VIS_ACTION_PUT_AFTER, VIS_ACTION_PUT_BEFORE, - VIS_ACTION_SELECTIONS_MATCH_WORD, VIS_ACTION_SELECTIONS_NEW_LINE_ABOVE, VIS_ACTION_SELECTIONS_NEW_LINE_ABOVE_FIRST, VIS_ACTION_SELECTIONS_NEW_LINE_BELOW, @@ -890,11 +887,6 @@ static const KeyAction vis_action[] = { VIS_HELP("Put text before the cursor") operator, { .i = VIS_OP_PUT_BEFORE } }, - [VIS_ACTION_SELECTIONS_MATCH_WORD] = { - "vis-selections-select-word", - VIS_HELP("Select word under cursor") - selections_match_word, - }, [VIS_ACTION_SELECTIONS_NEW_LINE_ABOVE] = { "vis-selection-new-lines-above", VIS_HELP("Create a new selection on the line above") @@ -1333,18 +1325,6 @@ static const char *selections_clear(Vis *vis, const char *keys, const Arg *arg) return keys; } -static const char *selections_match_word(Vis *vis, const char *keys, const Arg *arg) { - Text *txt = vis_text(vis); - View *view = vis_view(vis); - for (Selection *s = view_selections(view); s; s = view_selections_next(s)) { - Filerange word = text_object_word(txt, view_cursors_pos(s)); - if (text_range_valid(&word)) - view_selections_set(s, &word); - } - vis_mode_switch(vis, VIS_MODE_VISUAL); - return keys; -} - static const Selection *selection_new_primary(View *view, Filerange *r) { Text *txt = view_text(view); size_t pos = text_char_prev(txt, r->end); -- cgit v1.2.3