Update README to include recent changes to supported registers
[vis.git] / text-objects.h
blob5656a8a08cb9ddcf28cb6a901adf5cc47bda2e78
1 #ifndef TEXT_OBJECTS_H
2 #define TEXT_OBJECTS_H
4 /* these functions all take a file position. if this position is part of the
5 * respective text-object, a corresponding range is returned. if there is no
6 * such text-object at the given location, an empty range is returned.
7 */
9 #include <stddef.h>
10 #include "text.h"
12 /* return range covering the entire text */
13 Filerange text_object_entire(Text*, size_t pos);
14 /* entire document except leading and trailing empty lines */
15 Filerange text_object_entire_inner(Text*, size_t pos);
16 /* word which happens to be at pos without any neighbouring white spaces */
17 Filerange text_object_word(Text*, size_t pos);
18 /* includes trailing white spaces. if at pos happens to be a white space
19 * include all neighbouring leading white spaces and the following word. */
20 Filerange text_object_word_outer(Text*, size_t pos);
21 /* find next occurance of `word' (as word not substring) in forward/backward direction */
22 Filerange text_object_word_find_next(Text*, size_t pos, const char *word);
23 Filerange text_object_word_find_prev(Text*, size_t pos, const char *word);
24 /* same semantics as above but for a longword (i.e. delimited by white spaces) */
25 Filerange text_object_longword(Text*, size_t pos);
26 Filerange text_object_longword_outer(Text*, size_t pos);
28 Filerange text_object_line(Text*, size_t pos);
29 Filerange text_object_line_inner(Text*, size_t pos);
30 Filerange text_object_sentence(Text*, size_t pos);
31 Filerange text_object_paragraph(Text*, size_t pos);
33 /* C like function definition */
34 Filerange text_object_function(Text*, size_t pos);
35 /* inner variant only contains the function body */
36 Filerange text_object_function_inner(Text*, size_t pos);
37 /* these are inner text objects i.e. the delimiters themself are not
38 * included in the range */
39 Filerange text_object_square_bracket(Text*, size_t pos);
40 Filerange text_object_curly_bracket(Text*, size_t pos);
41 Filerange text_object_angle_bracket(Text*, size_t pos);
42 Filerange text_object_paranthese(Text*, size_t pos);
43 Filerange text_object_quote(Text*, size_t pos);
44 Filerange text_object_single_quote(Text*, size_t pos);
45 Filerange text_object_backtick(Text*, size_t pos);
46 /* text object delimited by arbitrary chars for which isboundary returns non-zero */
47 Filerange text_object_range(Text*, size_t pos, int (*isboundary)(int));
48 /* a number in either decimal, hex or octal format */
49 Filerange text_object_number(Text*, size_t pos);
50 Filerange text_object_filename(Text*, size_t pos);
51 /* match a search term in either forward or backward direction */
52 Filerange text_object_search_forward(Text*, size_t pos, Regex*);
53 Filerange text_object_search_backward(Text*, size_t pos, Regex*);
54 /* match all lines with same indendation level than the current one */
55 Filerange text_object_indentation(Text*, size_t pos);
57 /* extend a range to cover whole lines */
58 Filerange text_range_linewise(Text*, Filerange*);
59 /* trim leading and trailing white spaces from range */
60 Filerange text_range_inner(Text*, Filerange*);
61 /* test whether a given range covers whole lines */
62 bool text_range_is_linewise(Text*, Filerange*);
64 #endif