Moving to Linux: Working with Text (Part 1)
As I highlighted in my last post, plain text is an excellent medium for writers to begin their process. Actually, in many cases, plain text is a perfectly acceptable format for writers to end their process in as well, but for now, let’s assume that you’ll be moving your words to a different format such as a word processor or, as I am, a blogging system.
But as a method for drafting your ideas, using text format is good for a few reasons, including:
- Portable: It’s not only easy to work with plain text on almost any platform, it’s also small and easy to move back and forth.
- Focused: When you work with text, your focus is on developing the ideas, not what font they will appear in or whether they will be ragged-aligned or justified. Also, most text editors have few bells and whistles to distract you.
However, most people used to working in a word processor are used to having a number of facilities at their disposal, including the following:
- Formatting (bold, italics, etc…)
- Spell checker
- Search
- Compare (with another document)
Let’s introduce a couple of tools that will allow you to perform some of the above functions on text files that you have.
Formatting
I’ve recently discovered an excellent application that allows you to apply formatting to plain text. “txt2tags
” consists of two tools: text-based tags that you apply to your writing, and a tool that you run to transform your tagged text into other formats. You can be fairly productive with txt2tags
knowing only a couple of tags, as follows:
- Bolded text is enclosed in double asterisks: “**”
- Italicized text is enclosed in double slashes: “//”
- Underlined text is enclosed in double underscores: “__”
- Bulleted lists begin with a minus-sign and a space: “”- “”
- Numbered lists begin with a plus-sign and a space: “”+ “”
- Headers are enclosed in a number of equals signs equivalent to its level (e.g., and level-2 header would be enclosed by double-equal-signs, and be the same as an “<h2>” tag in HTML): “==”
As an example, I’ve drafted the two posts, “Moving to Linux: Tools for Writers” and this post, in the kate editor, using txt2tags
. This way I don’t have to worry about HTML tagging or style sheets while I’m drafting, yet I can easily convert this to HTML for posting into WordPress. To convert to HTML, you need only run a simple tool from the command line:
txt2tags -t html yourfile.txt
In this case, the addition of “-t html” tells the program to convert the file to “type HTML.” Once this is done, you should end up with a nicely formatted HTML document. For a fuller explanation of this tool, visit the excellent “cheat sheet” page at http://littlergirl.googlepages.com/txt2tagsCheatSheet.html.
Spell Checker
In addition to this rudimentary formatting, you are also able to spell check the drafts you’ve done in text format using tools in Linux. The text editor you are using may have this function built-in; if it does, it is likely that it is using the aspell
library and programs, which are commonly installed by default on most Linux distributions. You need not look for one of these that has it built-in, however, as you are always able to run this program from the command line.
For those who are (still) unfamiliar with this concept, the command line in Linux is akin to DOS. Many consider the command line to be archaic and unnecessary. But there are many actions that are easier, more powerful, or both, when executed from the command line. This is true for Windows, but (at least) doubly so for Linux.
Using the aspell program is simple as creating a text file and entering the following command (on a side note, we’ll get around to introducing you to the command prompt, and enter shell commands, in a later post):
aspell check yourfile.txt
The program then enters the aspell interface, which will walk through any misspelled words in the file, and give you options to revise them. You select your action through key presses. For example, I fixed the misspelled word in the file below by pressing “1.” aspell
replaced the word, and saved a copy of the old file (with the misspelled word) with a “.bak” extension.
By adding the above two tools to a descent text editor, you will have a good start on a plain text writers toolkit for the Linux platform. In the next post, we’ll explore going beyond the current document and look at searching and comparing across two or more documents (or directories filled with documents) with a few more command-line tools.
Great post. I’m gravitating towards the use of text editors for my online writing, and in fact, just posted a short article about using programmer’s editors because the “project” function simplifies .
My choices are Bluefish and Gedit (Ubunut Linux), and while neither is perfect, they’re a better fit for online work than word processors like Open Office and Word.
With the growing prevalence of online copywriting, I think a new class of word processor is needed – something that quickly and easily generates html-tagged copy, incorporates all the modern niceties, yet also posts blog articles, tweets, etc, (perhaps in console windows).
I can think of a few more goodies, and hope the next generation of word processor shows up soon (and that it shows on Linux first).
Thanks!
I could see the use for something between a word processor and a text editor, although at this point I’d also love to see ODT export for txt2tags.
I read your post too–turns out kate has the same concept, only generalized in its “Sessions” support. I don’t know if Bluefish makes you enter a bunch of information about web servers and such (I know Quanta would need some of that to create a project). The neat thing about kate is that there’s integration with the desktop, e.g., a “Kate Sessions” applet that you can park on your dashboard/menu bar in KDE4. So once you log in you’re literall one click away from any of your project.
Bluefish doesn’t require much beyond a name to create a project, and neither does the Gedit version (you need to install the “sessions” plugin in Gedit).
I haven’t explored the older editors yet (vim, emacs, etc), though emac’s ability to send & receive email raises the issue of an “online word worker” editor that offers modules/widgets/plugins for posting to blogs, tweets, chat, email, etc.
These days, that would account for 70% of my writing.