diff options
| author | Marc André Tanner <mat@brain-dump.org> | 2016-02-11 10:32:49 +0100 |
|---|---|---|
| committer | Marc André Tanner <mat@brain-dump.org> | 2016-02-11 10:32:49 +0100 |
| commit | a9db1caf19d34f13319a3ebf92100c2c92015582 (patch) | |
| tree | 2bf64c214e276ab4ff7fc460cb889675c93e4d48 /vis-text-objects.c | |
| parent | 979d51bcb65ccceec95f34a10fdf6446ac97473c (diff) | |
| download | vis-a9db1caf19d34f13319a3ebf92100c2c92015582.tar.gz vis-a9db1caf19d34f13319a3ebf92100c2c92015582.tar.xz | |
vis: implement gn and gN text objects
The behaviour when no match is found is not yet optimal.
Diffstat (limited to 'vis-text-objects.c')
| -rw-r--r-- | vis-text-objects.c | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/vis-text-objects.c b/vis-text-objects.c index a4fe36f..14f299d 100644 --- a/vis-text-objects.c +++ b/vis-text-objects.c @@ -9,6 +9,14 @@ void vis_textobject(Vis *vis, enum VisTextObject id) { } } +static Filerange search_forward(Vis *vis, Text *txt, size_t pos) { + return text_object_search_forward(txt, pos, vis->search_pattern); +} + +static Filerange search_backward(Vis *vis, Text *txt, size_t pos) { + return text_object_search_backward(txt, pos, vis->search_pattern); +} + TextObject vis_textobjects[] = { [VIS_TEXTOBJECT_INNER_WORD] = { .txt = text_object_word }, [VIS_TEXTOBJECT_OUTER_WORD] = { .txt = text_object_word_outer }, @@ -36,5 +44,7 @@ TextObject vis_textobjects[] = { [VIS_TEXTOBJECT_INNER_FUNCTION] = { .txt = text_object_function_inner, }, [VIS_TEXTOBJECT_OUTER_LINE] = { .txt = text_object_line, }, [VIS_TEXTOBJECT_INNER_LINE] = { .txt = text_object_line_inner, }, + [VIS_TEXTOBJECT_SEARCH_FORWARD] = { .vis = search_forward, .type = SPLIT }, + [VIS_TEXTOBJECT_SEARCH_BACKWARD] = { .vis = search_backward, .type = SPLIT }, }; |
