jim

Simple, lightweight, modal, vim-inspired text editor
git clone git://git.janpasierb.com/jim.git
Log | Files | Refs | README | LICENSE

main.c (894B)


      1 #include"jim.h"
      2 #include"output.h"
      3 #include"term.h"
      4 #include"file.h"
      5 #include"input.h"
      6 #include"output.h"
      7 #include<stddef.h>
      8 
      9 struct editorConfig E;
     10 
     11 void initEditor() {
     12     E.rowoff = 0;
     13     E.coloff = 0;
     14     E.numrows = 0;
     15     E.row = NULL;
     16     E.filename = NULL;
     17     E.statusmsg[0] = '\0';
     18     E.clusterkey = '\0';
     19     E.mode = NORMAL;
     20     E.dirty = 0;
     21     E.isr = 1;
     22     E.isbold = 0;
     23 	E.isreplace = 0;
     24     E.cx = 0;
     25     E.cy = 0;
     26     E.rx = 0;
     27     E.syntax = NULL;
     28 
     29     if(getWindowSize(&E.screenrows, &E.screencols) == -1) die("getWindowSize");
     30     E.screenrows--;
     31 }
     32 
     33 int main(int argc, char* argv[]) {
     34     enableRawMode();
     35     initEditor();
     36     if(argc >= 2)
     37         editorOpen(argv[1]);
     38 
     39     editorSetStatusMessage("\"%.20s\" %dL", E.filename ? E.filename : "[No Name]", E.numrows);
     40 
     41     while(1) {
     42         editorRefreshScreen();
     43         editorProcessKeypress();
     44     }
     45 
     46     return 0;
     47 }