Team Ai
Datasetpublic

hschumann2/TempleOS-Source-Code

sourceHugging Faceupdated 1y agoView on Hugging Face
0likes847downloads
HomeKeyPlugIns.txt204 linesDownload Raw Back to root
1 2//Place this file in /Home and change3//anything you want.4 5U0 TimeIns()6{7  CDate cdt;8  cdt=Now;9  "$IV,1$----%D %T----$IV,0$\n",cdt,cdt;10}11 12Bool MyPutKey(I64 ch,I64 sc)13{//ch=ASCII; sc=scan_code14 15  //See Char for definition of scan codes.16  //See Key Allocations.17  //See Keyboard Devices.18 19  //You can customize keys.  This routine20  //is called before the main editor21  //key hndlr DocPutKey().22  //You can intercept any key.23 24  //Return TRUE if you completely25  //handled the key.26  I64 i;27  U8 *st1,*st2;28  if (sc&SCF_ALT && !(sc&SCF_CTRL)) {29    switch (ch) {30      case 0:31        switch (sc.u8[0]) {32          case SC_F1:33            if (sc&SCF_SHIFT) {34              if (sc&SCF_KEY_DESC)35                KeyDescSet("Dol /LTPURPLE");36              else37                "$LTPURPLE$";38            } else {39              if (sc&SCF_KEY_DESC)40                KeyDescSet("Dol /PURPLE");41              else42                "$PURPLE$";43            }44            return TRUE;45          case SC_F2:46            if (sc&SCF_SHIFT) {47              if (sc&SCF_KEY_DESC)48                KeyDescSet("Dol /LTRED");49              else50                "$LTRED$";51            } else {52              if (sc&SCF_KEY_DESC)53                KeyDescSet("Dol /RED");54              else55                "$RED$";56            }57            return TRUE;58          case SC_F3:59            if (sc&SCF_SHIFT) {60              if (sc&SCF_KEY_DESC)61                KeyDescSet("Dol /LTGREEN");62              else63                "$LTGREEN$";64            } else {65              if (sc&SCF_KEY_DESC)66                KeyDescSet("Dol /GREEN");67              else68                "$GREEN$";69            }70            return TRUE;71          case SC_F4:72            if (sc&SCF_SHIFT) {73              if (sc&SCF_KEY_DESC)74                KeyDescSet("Dol /Default Color");75              else76                "$FG$";77            } else {78              if (sc&SCF_KEY_DESC)79                KeyDescSet("Dol /BLUE");80              else81                "$BLUE$";82            }83            return TRUE;84          case SC_F7:85            if (!(sc&SCF_SHIFT)) {86              if (sc&SCF_KEY_DESC)87                KeyDescSet("Cmd /TimeIns");88              else89                TimeIns;90            }91            return TRUE;92        }93        break;94      case 'a':95        if (sc&SCF_KEY_DESC)96          KeyDescSet("Cmd /AutoComplete On");97        else98          AutoComplete(ON);99        return TRUE;100      case 'A':101        if (sc&SCF_KEY_DESC)102          KeyDescSet("Cmd /AutoComplete Off");103        else104          AutoComplete;105        return TRUE;106      case 'h':107        if (sc&SCF_KEY_DESC)108          KeyDescSet("Cmd /WinTileHorz");109        else110          WinTileHorz;111        return TRUE;112      case 'm':113        if (sc&SCF_KEY_DESC)114          KeyDescSet("Cmd /WinMax");115        else {116          WinBorder;117          WinMax;118        }119        return TRUE;120      case 'v':121        if (sc&SCF_KEY_DESC)122          KeyDescSet("Cmd /WinTileVert");123        else124          WinTileVert;125        return TRUE;126      case 'l':127        if (sc&SCF_KEY_DESC)128          KeyDescSet("Edit/Put Link to Cur Pos on Clip");129        else {130          ClipDel;131          st1=FileNameAbs(BIBLE_FILENAME);132          st2=FileNameAbs(DocPut->filename.name);133          if (!StrCmp(st1,st2)) {134            Free(st1);135            st1=BibleLine2Verse(DocPut->cur_entry->y+1,',');136            DocPrint(sys_clip_doc,"$LK,\"BF:%s\"$",st1);137          } else138            DocPrint(sys_clip_doc,"$LK,\"FL:%s,%d\"$",139                  st2,DocPut->cur_entry->y+1);140          Free(st1);141          Free(st2);142        }143        return TRUE;144      case 'L':145        if (sc&SCF_KEY_DESC)146          KeyDescSet("Edit/Place Anchor, Put Link to Clip");147        else {148          i=RandU32;149          ClipDel;150          DocPrint(sys_clip_doc,"$LK,\"<TODO>\",A=\"FA:%s,ANC%d\"$",151                DocPut->filename.name,i);152          "$AN,\"<TODO>\",A=\"ANC%d\"$",i;153        }154        return TRUE;155 156        //Ins your own ALT-key plug-ins157      case '1':158        if (sc&SCF_KEY_DESC)159          KeyDescSet("Dol /pi");160        else161          'pi';162        return TRUE;163      case '2':164        if (sc&SCF_KEY_DESC)165          KeyDescSet("Dol /theta");166        else167          'theta';168        return TRUE;169      case '3':170        if (sc&SCF_KEY_DESC)171          KeyDescSet("Dol /phi");172        else173          'phi';174        return TRUE;175      case '4':176        if (sc&SCF_KEY_DESC)177          KeyDescSet("Dol /omega");178        else179          'omega';180        return TRUE;181      case '9':182        if (sc&SCF_KEY_DESC)183          KeyDescSet("Dol /Indent 5");184        else185          "$ID,5$";186        return TRUE;187      case '0':188        if (sc&SCF_KEY_DESC)189          KeyDescSet("Dol /Unindent 5");190        else191          "$ID,-5$";192        return TRUE;193    }194  }195  return FALSE;196}197 198Bool MyPutS(U8 *)199{200  return FALSE;201}202 203KeyDevAdd(&MyPutKey,&MyPutS,0x20000000,TRUE);204