-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathmotion.h
37 lines (30 loc) · 1.08 KB
/
motion.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
#pragma once
#include <stdbool.h>
#include <stddef.h>
struct motion_context {
size_t pos;
struct window *window;
struct editor *editor;
};
struct motion {
char name;
size_t (*op)(struct motion_context);
// Whether the motion is linewise (vs. characterwise).
// (See :help linewise in vim for details).
bool linewise;
// Whether the motion is exclusive (vs. inclusive).
// (See :help exclusive in vim for details).
// This is only relevant for characterwise motions.
bool exclusive;
// Whether the motion callback should be invoked repeatedly
// (as opposed to being aware of editor->count).
bool repeat;
};
struct tb_event;
struct motion *motion_get(struct editor *editor, struct tb_event *ev);
size_t motion_apply(struct motion *motion, struct editor *editor);
// TODO(isbadawi): This is an awkward place to put this.
// But a lot of knowledge about words lives in motion.c right now.
struct buf *motion_word_under_cursor(struct window *window);
struct buf *motion_word_before_cursor(struct window *window);
struct buf *motion_filename_under_cursor(struct window *window);