-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathvimprobable.h
190 lines (168 loc) · 4.98 KB
/
vimprobable.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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
/*
(c) 2009 by Leon Winter
(c) 2009-2011 by Hannes Schueller
(c) 2009-2010 by Matto Fransen
(c) 2010-2011 by Hans-Peter Deifel
(c) 2010-2011 by Thomas Adam
see LICENSE file
*/
/* macros */
#define LENGTH(x) (sizeof(x)/sizeof(x[0]))
/* enums */
enum { ModeNormal, ModePassThrough, ModeSendKey, ModeInsert, ModeHints }; /* modes */
enum { TargetCurrent, TargetNew }; /* target */
/* bitmask,
1 << 0: 0 = jumpTo, 1 = scroll
1 << 1: 0 = top/down, 1 = left/right
1 << 2: 0 = top/left, 1 = bottom/right
1 << 3: 0 = paging/halfpage, 1 = line
1 << 4: 0 = paging, 1 = halfpage aka buffer
*/
enum { ScrollJumpTo, ScrollMove };
enum { OrientationVert, OrientationHoriz = (1 << 1) };
enum { DirectionTop,
DirectionBottom = (1 << 2),
DirectionLeft = OrientationHoriz,
DirectionRight = OrientationHoriz | (1 << 2)
};
enum { UnitPage,
UnitLine = (1 << 3),
UnitBuffer = (1 << 4)
};
/* bitmask:
1 << 0: 0 = Reload/Cancel 1 = Forward/Back
Forward/Back:
1 << 1: 0 = Forward 1 = Back
Reload/Cancel:
1 << 1: 0 = Cancel 1 = Force/Normal Reload
1 << 2: 0 = Force Reload 1 = Reload
*/
enum { NavigationForwardBack = 1, NavigationReloadActions = (1 << 1) };
enum { NavigationCancel,
NavigationBack = (NavigationForwardBack | 1 << 1),
NavigationForward = (NavigationForwardBack),
NavigationReload = (NavigationReloadActions | 1 << 2),
NavigationForceReload = NavigationReloadActions
};
/* bitmask:
1 << 1: ClipboardPrimary (X11)
1 << 2: ClipboardGTK
1 << 3: 0 = SourceSelection 1 = SourceURL
*/
enum { ClipboardPrimary = 1 << 1, ClipboardGTK = 1 << 2 };
enum { SourceSelection, SourceURL = 1 << 3 };
/* bitmask:
1 << 0: 0 = ZoomReset 1 = ZoomIn/Out
1 << 1: 0 = ZoomOut 1 = ZoomIn
1 << 2: 0 = TextZoom 1 = FullContentZoom
*/
enum { ZoomReset,
ZoomOut,
ZoomIn = ZoomOut | (1 << 1)
};
enum { ZoomText, ZoomFullContent = (1 << 2) };
/* bitmask:
0 = Info, 1 = Warning, 2 = Error
1 << 2: 0 = AutoHide 1 = NoAutoHide
relevant for script:
1 << 3: 1 = Silent (no echo)
*/
enum { Info, Warning, Error, NoAutoHide = 1 << 2, Silent = 1 << 3 };
enum { NthSubdir, Rootdir };
enum { InsertCurrentURL = 1 };
enum { Increment, Decrement };
/* bitmask:
1 << 0: 0 = DirectionNext 1 = DirectionPrev (Relative)
1 << 0: 0 = DirectionBackwards 1 = DirectionForward (Absolute)
1 << 1: 0 = DirectionRelative 1 = DirectionAbsolute
1 << 2: 0 = CaseInsensitive 1 = CaseSensitive
1 << 3: 0 = No Wrapping 1 = Wrapping
*/
enum { DirectionRelative, DirectionAbsolute = 1 << 1 };
enum { DirectionNext, DirectionPrev, HideCompletion };
enum { DirectionBackwards = DirectionAbsolute, DirectionForward =
(1 << 0) | DirectionAbsolute };
enum { CaseInsensitive, CaseSensitive = 1 << 2 };
enum { Wrapping = 1 << 3 };
/* structs here */
typedef struct {
int i;
char *s;
} Arg;
typedef struct {
guint mask;
guint modkey;
guint key;
gboolean(*func) (const Arg * func);
Arg arg;
} Key;
typedef struct {
void *next;
Key Element;
} KeyList;
typedef struct {
guint mask;
guint modkey;
guint button;
gboolean(*func) (const Arg * arg);
const Arg arg;
} Mouse;
typedef struct {
char *name;
char (*var);
char *webkit;
gboolean intval;
gboolean boolval;
gboolean colourval;
gboolean reload;
} Setting;
typedef struct {
char *cmd;
gboolean(*func) (const Arg * arg);
const Arg arg;
} Command;
typedef struct {
char *handle;
char *uri;
} Searchengine;
struct map_pair {
char *line;
char what[20];
char value[240];
} my_pair;
typedef struct {
void *next;
char element[255];
} Listelement;
enum ConfigFileError {
SUCCESS = 0,
FILE_NOT_FOUND = -1,
READING_FAILED = -2,
SYNTAX_ERROR = -3
};
/* constants */
#define MOUSE_BUTTON_1 1
#define MOUSE_BUTTON_2 2
#define MOUSE_BUTTON_3 3
#define MOUSE_BUTTON_4 4
#define MOUSE_BUTTON_5 5
#define BUFFERSIZE 255
#define MAXTAGSIZE 200
/* bookmarks */
#define BOOKMARKS_STORAGE_FILENAME "%s/.config/vimprobable/bookmarks", getenv("HOME")
/* quickmarks */
#define QUICKMARK_FILE "%s/.config/vimprobable/quickmarks", getenv("HOME")
/* history */
#define HISTORY_MAX_ENTRIES 1000
#define HISTORY_STORAGE_FILENAME "%s/.config/vimprobable/history", getenv("HOME")
#define CLOSED_URL_FILENAME "%s/.config/vimprobable/closed", getenv("HOME")
/* searchengines */
#define SEARCHENGINES_STORAGE_FILENAME "%s/.config/vimprobable/searchengines", getenv("HOME")
/* Command size */
#define COMMANDSIZE 1024
/* maximum size of internal string variable handled by :set
* if you set this to anything lower than 8, colour values
* will stop working */
#define MAX_SETTING_SIZE 1024
/* completion list size */
#define MAX_LIST_SIZE 40