G is a portable general purpose programmable
text editor with calculator and macro facility.
Gis a general purpose programmable text editor with a long history, originally written in the B programming language for GCOS‑3/TSS, running on GE/Honeywell 6000-series mainframe systems.
-
Gcombines features from many sources. For example, the macro language was derived from the ICL George mainframe editors, regular expressions (among other things) come from UNIX vi, the screen editor keystrokes are similar to WordStar, and the mathematical syntax is inspired by the C programming language. -
The macro language is Turing complete, offering loops, conditionals, and arithmetic. Complete
Gmacro programs or individual commands can be executed from the command line, from an edit buffer or file, or from the home area at the top of the screen (interactively, so that the effects can be seen). In many cases,Gmacros can do the work of traditional UNIX text processing tools such assed,awk,cut, andfmt. -
Gcan operate as either a line editor or as a visual screen editor, similar toex/vion UNIX systems. -
The
Glanguage uses a conceptually simple two-file transcription (copy/edit) paradigm, which is transparent for the casual screen editor user. -
Gis designed to be as efficient as possible, to be highly portable, and to enable manipulation of large files.Ghas a very fast startup time and utilizes little memory compared to other applications - approximately 130 KiB for the standard build, 112 KiB for the Tiny build, and 32 KiB for the line-mode editor (measured using the Massif heap profiler on an AMD64 system running GNU/Linux). -
Gprovides a more flexible way of viewing files than commands likeTYPE,pg, ormore. -
Although
Gis not intended to be a fully featured word processor, it does have text and paragraph formatting abilities and can easily be used to produce simple documents.
-
Gcan be built for DOS, Windows, OS/2, Haiku, and many UNIX systems. IBM AIX, PASE for IBM i, Darwin, FreeBSD, NetBSD, OpenBSD, Solaris, illumos, and Linux are regularly tested and fully supported. -
A Curses library is required on UNIX systems. AT&T System V Curses, XPG4/XSI Extended Curses, PdCurses, PdCursesMod, NetBSD Curses, and NCurses are known to work.
-
A C compiler is required. Oracle Developer Studio, LLVM Clang, AMD AOCC, GNU GCC, IBM XLC, IBM OpenXL, Intel ICX, Intel ICC, DJGPP, Microsoft C, MSVC, SGI MIPSpro, Watcom C/C++, OpenWatcom V2, Borland C, and PCC are currently known to work.
-
The included
GNUmakefilecan be used if GNU Make (version 3.81 or later) is available. GNU Make is helpful, but is not required to buildG.
- Most users of UNIX-like operating systems can build
Gby simply invoking GNU Make (usually available asgmakeormake) without any additional options or configuration. The conventionalmaketargets are available, e.g.clean,strip, etc. - The following options affecting compilation may be set in the shell
environment or on the
makecommand-line, for example,make OPTION=1:CC: Overrides default C compiler selection, e.g.CC=clangLTO=1: Enables link-time optimizationLGC=1: Enables link-time garbage collection (reducing binary size)OPTFLAGS: Overrides default optimization flags, e.g.OPTFLAGS=-OzV=1: Enables verbose compilation messagesNOSSP=1: DisablesFORTIFY_SOURCEand compiler stack protectionsSTATIC=1: Attempt statically linking all required librariesDUMA=1: Enables support for the DUMA memory debugging libraryDSTATIC=1: Attempt statically linking DUMA library (needs GNU ld)DEBUG=1: Enables debugging code (for development or troubleshooting)LINE_G=1: Builds only the line-mode editor (no curses library needed)TINY_G=1: Disables features for lower memory use (default for PC DOS)FULL_G=1: OverridesTINY_Gdefault (enables a fully-featured build)CURSESLIB: Overrides curses library selection, e.g.-lcurses -ltinfoCOLOUR=0: Disables colours (required for some older curses libraries)
- Some less common options may be undocumented, and some option combinations may not be valid.
- For practical examples and complete details, review the
GNUmakefileand test script.
-
Historically,
Gwas available for many systems, including Amdahl UTS/V, AT&T System V, Berkeley (BSD) UNIX, BSDI BSD/OS, Commodore Amiga UNIX (AMIX), DG/UX, Honeywell GCOS/TSS, HP‑UX, IBM OS/2, ICL CDOS, ICL DRS/NX, JRG/Everex ESIX, Microsoft Xenix, MINIX, MWC Coherent, NCR SVR4 MP‑RAS, Novell/SCO UnixWare, Pyramid DC/OSx, Reliant UNIX/SINIX, SCO OpenServer, Sequent DYNIX, SGI IRIX, SunOS 3/4, Tulip SVR3, and DEC VAX/VMS. -
Line-mode
Gis known to build on IBM z/OS UNIX (USS) using XL C. -
Read the notes in the
GNUmakefilefor information relevant to buildingGon these systems.
Future plans for G:
- Overhauled documentation
- Improved online help viewer
- Proper Windows console support
- VGA-mode DOS port
- Dynamic resizing
- UTF-8/multibyte support
- Binaries via GitHub and GitLab releases
Gfor IBM PC DOS (MS-DOS, PC-DOS, DR-DOS, PTS-DOS, FreeDOS, etc.)GV4.7.4β for PC DOS, 16-bit 8086, Real mode, Tiny build, G-CursesGV4.7.4β for PC DOS, 16-bit 8086, Real mode, Full build, G-CursesGV4.7.3 for PC DOS, 16-bit 80386, Real mode, Fast-CursesGV4.7.3 for PC DOS, 32-bit 80386, Protected mode, DPMI, G-CursesGV4.7.3 for PC DOS, 32-bit 80386, Protected mode, DPMI, PdCursesMod
Gfor IBM OS/2GV4.7.4β for OS/2, 16-bit 80286, Protected mode, OS/2 console, PdCursesModGV4.7.4β for OS/2, 32-bit 80386, Protected mode, OS/2 console, PdCursesMod
Gfor Microsoft WindowsGV4.7.3 for Windows, 32-bit i686, Win32 GUI, PdCursesMod