Free Novel Read

Learning Old School Linux Page 7

Text Manipulation

  When it comes to text editing on Linux, there are a number of popular choices, including vi and emacs. Never one to shy away from expressing a preference, I have always been a strong proponent of emacs. It is arcane and hard to get started with, and has its own unique syntax and way of looking at the world, but it is still the best editor and integrated development environment (IDE) for Linux systems, for C programming.

  Editor Round Up

  In the early stone age, proto-nerds performed many important calculations with primitive devices called "TRS-80s", "VAXes", and "mainframes." Even back in this primitive era, as caveman programmers sat under trees, doing software development with surprisingly sophisticated flint tools, the text editor had developed into several distinct species. Some were headed for extinction, a few have survived, or spawned successful progeny, and remain a part of the text editing ecology to this day.

  Ed - A Purists Editor

  When I was a little boy, I was taken with all the other New Jersey school kids to see Valley Forge, and other Revolutionary War sites. While the tour guides and teachers droned on and on about something or the other, we all had the same question, and it always went unanswered: How did they fit in those tiny uniforms and beds they had on display? The uniforms in the display cases looked children's Halloween costumes. The bunks were about four feet long.

  Were those soldiers really that small?

  Ed is like those old soldiers - it fits into such a tiny space that you wonder if it is for real. In the case of ed, the space is computing space, and ed uses so little memory and processor that you could probably run it on a wristwatch. It doesn't even both displaying any text - you're just supposed to know what is in your document, from a previous print-out. (After all, if you don't know what's in there in the first place, why are you editing it?)

  In all fairness to the developers of ed, the so-called "glass teletype" hadn't been invented yet, so there was no way to display text except print it our on a teletype. (And that's how they knew you had a print out of the code somewhere.)

  These days ed can still be found on just about every Linux workstation, though I doubt there are any users out there. It's genes live on in a descendant called sed, a utility for processing text files.

  vi and the Twisted Mutants it Spawned

  Eventually the bright idea of hooking up a TV to a computer resulted in the glass teletype, After several years of using ed to edit their programs, some programmers came to a startling conclusion: displaying the text on the screen would be useful for editing. Instead of having to remember where everything was in the file, you could just look at it on the screen!

  The visual orientation of this editor dictated its name: vi.

  Although vi was an improvement on ed, it is a far cry from today's modern editors. In fact, due to it's bizarre command structure and weird way of only editing one file at a time leave my soul filled with horror. It's not uncommon for new users to be driven completely mad by an attempt to use vi.

  Despite its numerous problems, the vi editor continues to lurk in its harsh ecological niche. It has even spawned a nightmarish array of descendant, including vim. Like a species of tapeworm, it has even succeeded in parasitically embedding itself inside another editor, with vi emulation modes.

  Truly is it said: you can't have "evil" without "vi."

  Emacs - The God Particle of Software

  The CERN eggheads are firing up the Large Hadron Collider in their attempt to find the so-called God Particle. (does it makes anyone else a little nervous, the way they are constantly assuring us that they're not going to destroy the planet?)

  If they were looking for editors instead of particles, the one they would find would be emacs.

  Widely acclaimed as the best integrated development environment in the history of computer programming, emacs is a programmers paradise and playground. It's fun, it's effective, it does everything you can think of, and twice as much that never even occurred to you (but is quite useful).

  With emacs, pogrammers don't ever leave editor - all aspects of program development are done from the compiler, coding, compiling, debugging, and running. Emacs was the first free software product released by the Free Software Foundation, and remains a core part of Linux/GNU. To get started type "emacs" at the command prompt, or look for it on your menus.

  Emacs is extremely adaptable. It has been ported to just about every platform, and works over a high-bandwidth connection with X Window, or a low-bandwidth connection via an ASCII-based interface.

  Pico and Nano

  Back in the day, there was a Unix email program called pine, and it came with an associated editor, pico, for composing email. Many became enamored of this editor, and started using it for code development. Due to free software license restrictions, pico eventually became extinct, but it's direct descendant, nano, lives on.

  The original pico had appeal in the days of very limited hardware. It was better than vi (which almost everything is), and not as slow as emacs used to be on days when the computer was busy. But that hasn't been a problem for about 25 years, so it's hard to see why nano lives on, yet it certainly does.

  Many new features have been added along the way, of course. Now nano boasts more features than almost any other editor of the olden days, though by today's bloated standards it is still quite svelte. This is an ASCII-only editor, those who need a fancy GUI need to move on to another choice. Nano has its own web page at https://www.nano-editor.org.

  The GUI Accessories

  If you are reading this on a Linux box, take a look in the menus, perhaps under something like "Accessories," and you will find a text editor. On KDE systems this is a program called kate, one GNOME systems, gedit.

  In the world of commercial desktop computing, the free accessories which come with the operating system are minimally functional. After all, they aren't making any extra money on that software, so there's not much motivation for a commercial company to continue to improve and develop them. Linux, as is so often the case, is a different kettle of fish entirely. In the Linux world really great programmers will continue to develop tools, just for the bragging rights, resume bullets, and sense of pride that come with contributing to a free software project.

  Given the usual dynamics of Linux software, it's not really surprising to find that these GUI accessories are full-powered text editors, with some interesting features. They can handle multiple files, code syntax highlighting, and spell checking. Unlike all of the text editors above, these editors work only with an X Window connection - they are graphical only.

  Kate has a web page at https://kate-editor.org/; gedit's web page is at https://www.gnome.org/projects/gedit.

  Eclipse - A Very Fancy IDE

  Started by IBM in 2001, the open-source eclipse editor is an attempt to rebuild the IDE from scratch in Java. The result is impressive, and certainly equals or surpasses the Microsoft IDE, Visual Studio, which it much resembles. Although the editor itself is written in Java, it may be used to code in any language. The fact that it's built in Java has no impact on what type of files can be edited.

  The Java base does have one implication: it is inherently slower than C/C++, the language used for most other editors. However this is not noticeable on high-end developer workstations.

  Other Editing Critters

  There are so many other species of text editor in Linux, it's a real testimony to the ecological richness the free software. Some other interesting specimens include jEdit, a Java IDE written in Java (https://www.jedit.org/), NEdit, a Linux clone of Windows text editors (https://www.nedit.org/), Eddie, a clone of the Macintosh development IDE (https://www.el34.com/index.html), Scribes, a very focused text editor that tries to automate things (https://scribes.sourceforge.net/), Diakonos, which aims to be easier to configure than emacs, more powerful than pico or nano, and not as cryptic as vi (https://purepistos.net/diakonos).

  So go out there and edit people! Perhaps the software you create will be the next great ed
itor.