vip

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

vip.c (721B)


      1 #include <stdio.h>
      2 #include <stdlib.h>
      3 #include <string.h>
      4 #include <ctype.h>
      5 #include <termios.h>
      6 #include <sys/ioctl.h>
      7 #include <sys/types.h>
      8 
      9 #include "vip.h"
     10 #include "term.h"
     11 #include "editor.h"
     12 #include "bar.h"
     13 #include "io.h"
     14 
     15 editor vip;
     16 
     17 void abAppend(struct abuf *ab, const char *s, int len)
     18 {
     19 	char *new = realloc(ab->b, ab->len + len);
     20 	if (new == NULL) return;
     21 	memcpy(&new[ab->len], s, len);
     22 	ab->b = new;
     23 	ab->len += len;
     24 }
     25 
     26 void abFree(struct abuf *ab)
     27 {
     28 	free(ab->b);
     29 }
     30 
     31 int main(int argc, char **argv)
     32 {
     33 	setup_term();
     34 	init_editor();
     35 	if (argc >= 2) {
     36 		open_editor(argv[1]);
     37 	}
     38 
     39 	set_status_bar_message("By night0721 and gnucolas");
     40 
     41 	while (1) {
     42 		refresh_screen();
     43 		process_key();
     44 	}
     45 	return 0;
     46 }