vip

VI Plus
git clone https://codeberg.org/night0721/vip
Log | Files | Refs | README | LICENSE

vip.h (988B)


      1 #ifndef VIP_H_
      2 #define VIP_H_
      3 
      4 #include <termios.h>
      5 #include <time.h>
      6 
      7 #define VERSION "0.0.1"
      8 
      9 #define COLOR_LEN 19
     10 
     11 enum keys {
     12 	BACKSPACE = 127,
     13 	ARROW_LEFT = 1000,
     14 	ARROW_RIGHT,
     15 	ARROW_UP,
     16 	ARROW_DOWN,
     17 	DEL_KEY,
     18 	HOME_KEY,
     19 	END_KEY,
     20 	PAGE_UP,
     21 	PAGE_DOWN
     22 };
     23 
     24 enum modes {
     25 	NORMAL,
     26 	INSERT,
     27 	VISUAL,
     28 	COMMAND
     29 };
     30 
     31 enum highlight {
     32 	DEFAULT = 0,
     33 	COMMENT,
     34 	MLCOMMENT,
     35 	KEYWORD1, /* default */
     36 	KEYWORD2, /* types */
     37 	STRING,
     38 	NUMBER,
     39 	MATCH,
     40 	RESET
     41 };
     42 
     43 #include "row.h"
     44 #include "syntax.h"
     45 #include "config.h"
     46 
     47 typedef struct editor {
     48 	int cx, cy; /* chars x, y */
     49 	int rx; /* render x */
     50 	int rowoff;
     51 	int coloff;
     52 	int screenrows, screencols;
     53 	int rows;
     54 	row *row;
     55 	int dirty;
     56 	int mode;
     57 	char *filename;
     58 	char statusmsg[80];
     59 	time_t statusmsg_time;
     60 	language *syntax;
     61 	struct termios termios;
     62 } editor;
     63 
     64 struct abuf {
     65 	char *b;
     66 	int len;
     67 };
     68 
     69 #define ABUF_INIT { NULL, 0 }
     70 void abAppend(struct abuf *ab, const char *s, int len);
     71 void abFree(struct abuf *ab);
     72 
     73 extern editor vip;
     74 
     75 #endif